Comparing version 2.0.0 to 2.0.1
@@ -47,2 +47,3 @@ 'use strict'; | ||
function getCommandArgsAndEnvVars(args) { | ||
// eslint-disable-line | ||
var command = undefined; | ||
@@ -60,3 +61,5 @@ var envVars = (0, _lodashAssign2['default'])({}, process.env); | ||
} | ||
envVars.APPDATA = process.env.APPDATA; | ||
if (process.env.APPDATA) { | ||
envVars.APPDATA = process.env.APPDATA; | ||
} | ||
} | ||
@@ -63,0 +66,0 @@ return [command, commandArgs, envVars]; |
{ | ||
"name": "cross-env", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Run commands that set environment variables across platforms", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -56,2 +56,6 @@ # cross-env | ||
## Related Projects | ||
[`env-cmd`](https://github.com/toddbluhm/env-cmd) - Reads environment variables from a file instead | ||
## LICENSE | ||
@@ -58,0 +62,0 @@ |
@@ -17,3 +17,3 @@ import {spawn} from 'cross-spawn'; | ||
function getCommandArgsAndEnvVars(args) { | ||
function getCommandArgsAndEnvVars(args) { // eslint-disable-line | ||
let command; | ||
@@ -31,5 +31,7 @@ const envVars = assign({}, process.env); | ||
} | ||
envVars.APPDATA = process.env.APPDATA; | ||
if (process.env.APPDATA) { | ||
envVars.APPDATA = process.env.APPDATA; | ||
} | ||
} | ||
return [command, commandArgs, envVars]; | ||
} |
@@ -31,7 +31,15 @@ import chai from 'chai'; | ||
it(`should APPDATA be undefined and not string`, () => { | ||
testEnvSetting({ | ||
FOO_ENV: 'production', | ||
APPDATA: 2 | ||
}, 'FOO_ENV=production'); | ||
}); | ||
it(`should handle multiple env variables`, () => { | ||
testEnvSetting({ | ||
FOO_ENV: 'production', | ||
BAR_ENV: 'dev' | ||
}, 'FOO_ENV=production', 'BAR_ENV=dev'); | ||
BAR_ENV: 'dev', | ||
APPDATA: '0' | ||
}, 'FOO_ENV=production', 'BAR_ENV=dev', 'APPDATA=0'); | ||
}); | ||
@@ -78,7 +86,14 @@ | ||
function testEnvSetting(expected, ...envSettings) { | ||
if (expected.APPDATA === 2) { // kill the APPDATA to test both is undefined | ||
delete process.env.APPDATA; | ||
delete expected.APPDATA; | ||
} else if (!process.env.APPDATA && expected.APPDATA === '0') { // set APPDATA and test it | ||
process.env.APPDATA = '0'; | ||
} | ||
const ret = crossEnv([...envSettings, 'echo', 'hello world']); | ||
const env = {}; | ||
env.APPDATA = process.env.APPDATA; | ||
if (process.env.APPDATA) { | ||
env.APPDATA = process.env.APPDATA; | ||
} | ||
assign(env, expected); | ||
expect(ret, 'returns what spawn returns').to.equal(spawned); | ||
@@ -85,0 +100,0 @@ expect(proxied['cross-spawn'].spawn).to.have.been.calledOnce; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14261
180
68
12