mirror of
https://github.com/hanzoai/cross-env.git
synced 2026-09-24 16:58:15 +00:00
fix: remove is-windows dependency (#207)
This commit is contained in:
@@ -193,6 +193,15 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bibo5088",
|
||||
"name": "bibo5088",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/17709887?v=4",
|
||||
"profile": "https://github.com/bibo5088",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"repoHost": "https://github.com",
|
||||
|
||||
+1
-2
@@ -25,8 +25,7 @@
|
||||
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^6.0.5",
|
||||
"is-windows": "^1.0.0"
|
||||
"cross-spawn": "^6.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"kcd-scripts": "^0.3.4"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import isWindowsMock from 'is-windows'
|
||||
import isWindowsMock from '../is-windows'
|
||||
import commandConvert from '../command'
|
||||
|
||||
jest.mock('../is-windows')
|
||||
|
||||
const env = {
|
||||
test: 'a',
|
||||
test1: 'b',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import crossSpawnMock from 'cross-spawn'
|
||||
import isWindowsMock from 'is-windows'
|
||||
import isWindowsMock from '../is-windows'
|
||||
|
||||
jest.mock('../is-windows')
|
||||
|
||||
const crossEnv = require('../')
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import isWindows from "../is-windows"
|
||||
|
||||
it(`should return true if the current OS is Windows`, () => {
|
||||
process.platform = 'win32'
|
||||
expect(isWindows()).toBe(true)
|
||||
|
||||
})
|
||||
|
||||
it(`should return false if the current OS is not Windows`, () => {
|
||||
process.platform = 'linux'
|
||||
expect(isWindows()).toBe(false)
|
||||
})
|
||||
|
||||
it(`should return true if the OSTYPE is cygwin or msys`, () => {
|
||||
process.platform = 'linux'
|
||||
|
||||
process.env.OSTYPE = 'cygwin'
|
||||
expect(isWindows()).toBe(true)
|
||||
|
||||
process.env.OSTYPE = 'msys'
|
||||
expect(isWindows()).toBe(true)
|
||||
|
||||
process.env.OSTYPE = ''
|
||||
expect(isWindows()).toBe(false)
|
||||
})
|
||||
@@ -1,6 +1,8 @@
|
||||
import isWindowsMock from 'is-windows'
|
||||
import isWindowsMock from '../is-windows'
|
||||
import varValueConvert from '../variable'
|
||||
|
||||
jest.mock('../is-windows')
|
||||
|
||||
const JSON_VALUE = '{\\"foo\\":\\"bar\\"}'
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
import isWindows from 'is-windows'
|
||||
import isWindows from './is-windows'
|
||||
|
||||
export default commandConvert
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export default () => process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import isWindows from 'is-windows'
|
||||
import isWindows from './is-windows'
|
||||
|
||||
const pathLikeEnvVarWhitelist = new Set(['PATH', 'NODE_PATH'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user