diff options
Diffstat (limited to 'deps/npm/test/tap/full-warning-messages.js')
-rw-r--r-- | deps/npm/test/tap/full-warning-messages.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/deps/npm/test/tap/full-warning-messages.js b/deps/npm/test/tap/full-warning-messages.js index 6745ee3db2..c986695d67 100644 --- a/deps/npm/test/tap/full-warning-messages.js +++ b/deps/npm/test/tap/full-warning-messages.js @@ -87,15 +87,19 @@ function notExists (t, filepath, msg) { } test('tree-style', function (t) { - common.npm(['install', '--loglevel=warn'], {cwd: base}, function (err, code, stdout, stderr) { + common.npm(['install', '--json', '--loglevel=warn'], {cwd: base}, function (err, code, stdout, stderr) { if (err) throw err t.is(code, 0, 'result code') - t.match(stdout, /modA@1.0.0/, 'modA got installed') - t.notMatch(stdout, /modB/, 'modB not installed') + var result = JSON.parse(stdout) + t.is(result.added.length, 1, 'only added one module') + t.is(result.added[0].name, 'modA', 'modA got installed') + t.is(result.warnings.length, 1, 'one warning') var stderrlines = stderr.trim().split(/\n/) t.is(stderrlines.length, 2, 'two lines of warnings') - t.match(stderr, /SKIPPING OPTIONAL DEPENDENCY/, 'expected optional failure warning') - t.match(stderr, /Unsupported platform/, 'reason for optional failure') + t.match(stderr, /SKIPPING OPTIONAL DEPENDENCY/, 'expected optional failure warning in stderr') + t.match(stderr, /Unsupported platform/, 'reason for optional failure in stderr') + t.match(result.warnings[0], /SKIPPING OPTIONAL DEPENDENCY/, 'expected optional failure warning in JSON') + t.match(result.warnings[0], /Unsupported platform/, 'reason for optional failure in JSON') exists(t, modJoin(base, 'modA'), 'module A') notExists(t, modJoin(base, 'modB'), 'module B') t.done() |