diff --git a/.all-contributorsrc b/.all-contributorsrc
index 4d0ab62..e1d3d42 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -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",
diff --git a/README.md b/README.md
index b4e3627..b973006 100755
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Run scripts that set and use environment variables across platforms
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][LICENSE]
-[](#contributors)
+[](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Donate][donate-badge]][donate]
[![Code of Conduct][coc-badge]][coc]
@@ -161,8 +161,10 @@ Thanks goes to these people ([emoji key][emojis]):
-
-
+| [
Kent C. Dodds](https://kentcdodds.com)
[π»](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds "Code") [π](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds "Documentation") [π](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds "Tests") | [
Ya Zhuang ](https://zhuangya.me)
[π](#plugin-zhuangya "Plugin/utility libraries") [π](https://github.com/kentcdodds/cross-env/commits?author=zhuangya "Documentation") | [
James Harris](https://wopian.me)
[π](https://github.com/kentcdodds/cross-env/commits?author=wopian "Documentation") | [
compumike08](https://github.com/compumike08)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Acompumike08 "Bug reports") [π](https://github.com/kentcdodds/cross-env/commits?author=compumike08 "Documentation") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=compumike08 "Tests") | [
Daniel RodrΓguez Rivero](https://github.com/danielo515)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Adanielo515 "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=danielo515 "Code") [π](https://github.com/kentcdodds/cross-env/commits?author=danielo515 "Documentation") | [
Jonas Keinholz](https://github.com/inyono)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Ainyono "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=inyono "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=inyono "Tests") | [
Hugo Wood](https://github.com/hgwood)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Ahgwood "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=hgwood "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=hgwood "Tests") |
+| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
+| [
Thiebaud Thomas](https://github.com/thomasthiebaud)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Athomasthiebaud "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=thomasthiebaud "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=thomasthiebaud "Tests") | [
Daniel Rey LΓ³pez](https://daniel.blog)
[π»](https://github.com/kentcdodds/cross-env/commits?author=DanReyLop "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=DanReyLop "Tests") | [
Amila Welihinda](http://amilajack.com)
[π](#infra-amilajack "Infrastructure (Hosting, Build-Tools, etc)") | [
Paul Betts](https://twitter.com/paulcbetts)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Apaulcbetts "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=paulcbetts "Code") | [
Turner Hayes](https://github.com/turnerhayes)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Aturnerhayes "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=turnerhayes "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=turnerhayes "Tests") | [
Suhas Karanth](https://github.com/sudo-suhas)
[π»](https://github.com/kentcdodds/cross-env/commits?author=sudo-suhas "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=sudo-suhas "Tests") | [
Sven](https://github.com/sventschui)
[π»](https://github.com/kentcdodds/cross-env/commits?author=sventschui "Code") [π](https://github.com/kentcdodds/cross-env/commits?author=sventschui "Documentation") [π‘](#example-sventschui "Examples") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=sventschui "Tests") |
+| [
D. NicolΓ‘s Lopez Zelaya](https://github.com/NicoZelaya)
[π»](https://github.com/kentcdodds/cross-env/commits?author=NicoZelaya "Code") | [
Johan Hernandez](http://bithavoc.io)
[π»](https://github.com/kentcdodds/cross-env/commits?author=bithavoc "Code") | [
Jordan Nielson](https://github.com/jnielson94)
[π](https://github.com/kentcdodds/cross-env/issues?q=author%3Ajnielson94 "Bug reports") [π»](https://github.com/kentcdodds/cross-env/commits?author=jnielson94 "Code") [β οΈ](https://github.com/kentcdodds/cross-env/commits?author=jnielson94 "Tests") | [
Jason Cooke](https://nz.linkedin.com/in/jsonc11)
[π](https://github.com/kentcdodds/cross-env/commits?author=Jason-Cooke "Documentation") | [
bibo5088](https://github.com/bibo5088)
[π»](https://github.com/kentcdodds/cross-env/commits?author=bibo5088 "Code") |
This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome!
diff --git a/package.json b/package.json
index c30e9fa..6123780 100644
--- a/package.json
+++ b/package.json
@@ -25,8 +25,7 @@
"author": "Kent C. Dodds (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"
diff --git a/__mocks__/is-windows.js b/src/__mocks__/is-windows.js
similarity index 100%
rename from __mocks__/is-windows.js
rename to src/__mocks__/is-windows.js
diff --git a/src/__tests__/command.js b/src/__tests__/command.js
index eb7d8a2..f5dbf99 100644
--- a/src/__tests__/command.js
+++ b/src/__tests__/command.js
@@ -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',
diff --git a/src/__tests__/index.js b/src/__tests__/index.js
index 0d073ce..5275528 100644
--- a/src/__tests__/index.js
+++ b/src/__tests__/index.js
@@ -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('../')
diff --git a/src/__tests__/is-windows.js b/src/__tests__/is-windows.js
new file mode 100644
index 0000000..aa1e128
--- /dev/null
+++ b/src/__tests__/is-windows.js
@@ -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)
+})
\ No newline at end of file
diff --git a/src/__tests__/variable.js b/src/__tests__/variable.js
index 9f3fbe9..a432a07 100644
--- a/src/__tests__/variable.js
+++ b/src/__tests__/variable.js
@@ -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(() => {
diff --git a/src/command.js b/src/command.js
index a1605e0..af28f82 100644
--- a/src/command.js
+++ b/src/command.js
@@ -1,5 +1,5 @@
import path from 'path'
-import isWindows from 'is-windows'
+import isWindows from './is-windows'
export default commandConvert
diff --git a/src/is-windows.js b/src/is-windows.js
new file mode 100644
index 0000000..b8e10d8
--- /dev/null
+++ b/src/is-windows.js
@@ -0,0 +1 @@
+export default () => process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)
\ No newline at end of file
diff --git a/src/variable.js b/src/variable.js
index 2bbcad9..ff14c0c 100644
--- a/src/variable.js
+++ b/src/variable.js
@@ -1,4 +1,4 @@
-import isWindows from 'is-windows'
+import isWindows from './is-windows'
const pathLikeEnvVarWhitelist = new Set(['PATH', 'NODE_PATH'])