-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lifecycle: keep private values out of child procs
[email protected] didn't include configuration values prefixed with an underscore in the environment passed to chiled processes. [email protected] includes the notion of scoped configuration, where a nerfed URL can be used to prefix configuration, some of which might be underscore-prefixed without the scope. Add that behavior to npm@2 and close this regression. PR-URL: npm/npm#9348
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var fs = require('graceful-fs') | ||
var path = require('path') | ||
|
||
var mkdirp = require('mkdirp') | ||
var rimraf = require('rimraf') | ||
var test = require('tap').test | ||
|
||
var common = require('../common-tap') | ||
|
||
var pkg = path.resolve(__dirname, 'run-script-filter-private') | ||
|
||
var opts = { cwd: pkg } | ||
|
||
var json = { | ||
name: 'run-script-filter-private', | ||
version: '1.2.3' | ||
} | ||
|
||
var npmrc = '//blah.com:_harsh=realms\n' | ||
|
||
test('setup', function (t) { | ||
cleanup() | ||
mkdirp.sync(pkg) | ||
fs.writeFileSync( | ||
path.resolve(pkg, 'package.json'), | ||
JSON.stringify(json, null, 2) + '\n' | ||
) | ||
fs.writeFileSync( | ||
path.resolve(pkg, '.npmrc'), | ||
npmrc | ||
) | ||
t.end() | ||
}) | ||
|
||
test('npm run-script env', function (t) { | ||
common.npm(['run-script', 'env'], opts, function (er, code, stdout, stderr) { | ||
t.ifError(er, 'using default env script') | ||
t.notOk(stderr, 'should not generate errors') | ||
t.ok(stdout.indexOf('npm_config_init_version') > 0, 'expected values in var list') | ||
t.notMatch(stdout, /harsh/, 'unexpected config not there') | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('cleanup', function (t) { | ||
cleanup() | ||
t.end() | ||
}) | ||
|
||
function cleanup () { | ||
rimraf.sync(pkg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters