summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/config-list.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/tap/config-list.js')
-rw-r--r--deps/npm/test/tap/config-list.js34
1 files changed, 30 insertions, 4 deletions
diff --git a/deps/npm/test/tap/config-list.js b/deps/npm/test/tap/config-list.js
index 1c42b64c2e..b06dc154b2 100644
--- a/deps/npm/test/tap/config-list.js
+++ b/deps/npm/test/tap/config-list.js
@@ -8,28 +8,54 @@ var common = require('../common-tap.js')
var pkg = path.resolve(__dirname, 'config-list')
var opts = { cwd: pkg }
var npmrc = path.resolve(pkg, '.npmrc')
+var npmrcContents = `
+_private=private;
+registry/:_pwd=pwd;
+foo=1234
+`
test('setup', function (t) {
rimraf.sync(pkg)
mkdirp.sync(pkg)
- t.end()
-})
-test('config list includes project config', function (t) {
// Write per-project conf file
- fs.writeFileSync(npmrc, 'foo=1234', 'utf8')
+ fs.writeFileSync(npmrc, npmrcContents, 'utf8')
// Create empty package.json to indicate project root
fs.writeFileSync(path.resolve(pkg, 'package.json'), '{}', 'utf8')
+ t.end()
+})
+test('config list includes project config', function (t) {
common.npm(
['config', 'list'],
opts,
function (err, code, stdout, stderr) {
t.ifError(err)
t.equal(stderr, '', 'stderr is empty')
+
var expected = '; project config ' + npmrc + '\nfoo = "1234"'
t.match(stdout, expected, 'contains project config')
+ t.notMatch(stdout, '_private', 'excludes private config')
+ t.notMatch(stdout, '_pwd', 'excludes private segmented config')
+ t.end()
+ }
+ )
+})
+
+test('config list --json outputs json', function (t) {
+ common.npm(
+ ['config', 'list', '--json'],
+ opts,
+ function (err, code, stdout, stderr) {
+ t.ifError(err)
+ t.equal(stderr, '', 'stderr is empty')
+
+ var json = JSON.parse(stdout)
+ t.equal(json.foo, '1234', 'contains project config')
+ t.equal(json.argv, undefined, 'excludes argv')
+ t.equal(json._private, undefined, 'excludes private config')
+ t.equal(json['registry/:_pwd'], undefined, 'excludes private config')
t.end()
}
)