Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-env

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-env - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

5

dist/index.js

@@ -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];

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc