Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion lib/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ function makeParseable_ (data, long, dir, depth, parent, d) {

return data.path +
':' + (data._id || '') +
':' + (data.realPath !== data.path ? data.realPath : '') +
(data.link && data.link !== data.path ? ':' + data.link : '') +
(data.extraneous ? ':EXTRANEOUS' : '') +
(data.error && data.path !== path.resolve(npm.globalDir, '..') ? ':ERROR' : '') +
(data.invalid ? ':INVALID' : '') +
Expand Down
34 changes: 34 additions & 0 deletions test/tap/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,40 @@ test('cleanup', function (t) {
t.done()
})

test('ls parseable long', function (t) {
var fixture = new Tacks(
Dir({
'npm-test-ls': Dir({
'package.json': File({
name: 'npm-test-ls',
version: '1.0.0',
dependencies: {
'dep': 'file:../dep'
}
})
}),
'dep': Dir({
'package.json': File({
name: 'dep',
version: '1.0.0'
})
})
})
)
withFixture(t, fixture, function (done) {
common.npm([
'ls', '--parseable', '--long'
], {
cwd: pkgpath
}, function (err, code, stdout, stderr) {
t.ifErr(err, 'ls succeeded')
t.equal(0, code, 'exit 0 on ls')
t.notMatch(stdout, /undefined/, 'must not output undefined for non-symlinked items')
done()
})
})
})

function withFixture (t, fixture, tester) {
fixture.create(fixturepath)
common.npm(['install'], {
Expand Down