Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
011ae67
readable-stream@3.3.0
isaacs May 21, 2019
740fd95
tap@12.7.0
isaacs Jun 26, 2019
a4dc342
tests: parallel tests
isaacs May 23, 2019
ce93dab
outdated: fix special 'remote' deps
larsgw Apr 5, 2019
acbbf7e
licensee@7.0.2
kemitchell Mar 29, 2019
d192904
Fix: Return a value for `view` when in silent mode
Mar 22, 2019
39d473a
Allow git to follow global tagsign config
junderw Apr 4, 2019
747fdaf
doc: add --audit-level param
ngraef Feb 13, 2019
8d4effb
chore: replace var with const in lib/adduser.js
jamesgeorge007 Apr 21, 2019
f5857e2
Clarify usage of bundledDependencies
john-osullivan Apr 24, 2019
d2d3017
CLI: Add the arm64 check for legacy-platform-all.js test case.
ossdev07 May 1, 2019
57bef61
update fstream in node-gyp
isaacs Jun 26, 2019
4bec4f1
npm checks only node.exe and not node on local dir
rgoulais Jun 5, 2019
a4475de
enable production flag for npm audit
Jun 18, 2019
2ee405d
fix indentation in test
Jun 18, 2019
f101d44
fix(unpublish): add space after hyphen
ffflorian Jun 25, 2019
ec62362
npm-packlist@1.4.4
isaacs Jun 27, 2019
f75d46a
tar@4.4.10
isaacs Jun 27, 2019
bf61c45
bluebird@3.5.5
isaacs Jun 27, 2019
b57d07e
npm-registry-couchapp@2.7.2
isaacs Jun 28, 2019
e9411c6
test: Don't time out waiting for gpg user input
isaacs Jun 28, 2019
f5e8849
npm-registry-mock@1.2.1
isaacs Jun 28, 2019
d9238af
fix: do not crash when removing nameless packages
isaacs Jun 28, 2019
87fef4e
fix: Always return JSON for outdated --json
Mar 20, 2019
8bd8e90
cacache@11.3.3
isaacs Jun 28, 2019
0421930
pacote@9.5.1
isaacs Jun 28, 2019
39538b4
write-file-atomic@2.4.3
isaacs Jun 28, 2019
33e2d1d
fix flaky debug-logs test
isaacs Jun 29, 2019
6bb935c
read-package-tree@5.3.1
isaacs Jun 29, 2019
a823f30
travis: Update to include new v12 LTS
isaacs Jun 29, 2019
e36b3c3
graceful-fs@4.2.0
isaacs Jun 30, 2019
828c21d
test: use common.pkg basedir in newly added test
isaacs Jul 1, 2019
36ddc3c
doc: update changelog for npm@6.10.0
isaacs Jun 30, 2019
cad4b85
update AUTHORS
isaacs Jul 1, 2019
eee0bcd
6.10.0-next.0
isaacs Jul 1, 2019
162858b
doc: update changelog to set date for 6.10.0
isaacs Jul 2, 2019
c1522be
6.10.0
isaacs Jul 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Always return JSON for outdated --json
Close: #176

EDIT: Added test, do not set exitStatus to 1 if we're just printing an
empty list as JSON. -- @isaacs
  • Loading branch information
Sreeram Jayan authored and isaacs committed Jun 30, 2019
commit 87fef4e356f30941f2ee39f2f774ad2086239a00
7 changes: 5 additions & 2 deletions lib/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ function outdated (args, silent, cb) {
return aa[0].path.localeCompare(bb[0].path) ||
aa[1].localeCompare(bb[1])
})
if (er || silent || list.length === 0) return cb(er, list)
if (er || silent ||
(list.length === 0 && !opts.json)) {
return cb(er, list)
}
if (opts.json) {
output(makeJSON(list, opts))
} else if (opts.parseable) {
Expand Down Expand Up @@ -129,7 +132,7 @@ function outdated (args, silent, cb) {
}
output(table(outTable, tableOpts))
}
process.exitCode = 1
process.exitCode = list.length ? 1 : 0
cb(null, list.map(function (item) { return [item[0].parent.path].concat(item.slice(1, 7)) }))
})
}))
Expand Down
42 changes: 30 additions & 12 deletions test/tap/outdated-json.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
var fs = require('graceful-fs')
var path = require('path')

var mkdirp = require('mkdirp')
var mr = require('npm-registry-mock')
var osenv = require('osenv')
var rimraf = require('rimraf')
var test = require('tap').test

var common = require('../common-tap.js')
Expand Down Expand Up @@ -42,8 +39,6 @@ var expected = {
}

test('setup', function (t) {
cleanup()
mkdirp.sync(pkg)
fs.writeFileSync(
path.join(pkg, 'package.json'),
JSON.stringify(json, null, 2)
Expand Down Expand Up @@ -92,14 +87,37 @@ test('it should log json data', function (t) {
)
})

test('it should log json data even when the list is empty', function (t) {
common.npm(
[
'rm',
'request',
'underscore'
],
EXEC_OPTS,
function (er, code, stdout) {
t.ifError(er, 'run without error')
t.is(code, 0, 'successful exit status')
common.npm(
[
'--registry', common.registry,
'--silent',
'--json',
'outdated'
],
EXEC_OPTS,
function (er, code, stdout) {
t.ifError(er, 'run without error')
t.is(code, 0, 'successful exit status')
t.same(JSON.parse(stdout), {}, 'got an empty object printed')
t.end()
}
)
}
)
})

test('cleanup', function (t) {
server.close()
cleanup()
t.end()
})

function cleanup () {
// windows fix for locked files
process.chdir(osenv.tmpdir())
rimraf.sync(pkg)
}