-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dist-tag: make 'ls' the default action (#106)
I keep typing `npm dist-tags` expecting it to print out a list of dist-tags and instead it yells at me and that feels very un-npm-y. PR-URL: #106 Credit: @isaacs Reviewed-By: @zkat
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -20,10 +20,16 @@ function mocks (server) { | |
server.get('/-/package/@scoped%2fpkg/dist-tags') | ||
.reply(200, { latest: '1.0.0', a: '0.0.1', b: '0.5.0' }) | ||
|
||
server.get('/-/package/@scoped%2fpkg/dist-tags') | ||
.reply(200, { latest: '1.0.0', a: '0.0.1', b: '0.5.0' }) | ||
|
||
// ls named package | ||
server.get('/-/package/@scoped%2fanother/dist-tags') | ||
.reply(200, { latest: '2.0.0', a: '0.0.2', b: '0.6.0' }) | ||
|
||
server.get('/-/package/@scoped%2fanother/dist-tags') | ||
.reply(200, { latest: '2.0.0', a: '0.0.2', b: '0.6.0' }) | ||
|
||
// add c | ||
server.get('/-/package/@scoped%2fanother/dist-tags') | ||
.reply(200, { latest: '2.0.0', a: '0.0.2', b: '0.6.0' }) | ||
|
@@ -83,6 +89,25 @@ test('npm dist-tags ls in current package', function (t) { | |
) | ||
}) | ||
|
||
test('npm dist-tags ls default in current package', function (t) { | ||
common.npm( | ||
[ | ||
'dist-tags', | ||
'--registry', common.registry, | ||
'--loglevel', 'silent' | ||
], | ||
{ cwd: pkg }, | ||
function (er, code, stdout, stderr) { | ||
t.ifError(er, 'npm access') | ||
t.notOk(code, 'exited OK') | ||
t.notOk(stderr, 'no error output') | ||
t.equal(stdout, 'a: 0.0.1\nb: 0.5.0\nlatest: 1.0.0\n') | ||
|
||
t.end() | ||
} | ||
) | ||
}) | ||
|
||
test('npm dist-tags ls on named package', function (t) { | ||
common.npm( | ||
[ | ||
|
@@ -103,6 +128,26 @@ test('npm dist-tags ls on named package', function (t) { | |
) | ||
}) | ||
|
||
test('npm dist-tags ls default, named package', function (t) { | ||
common.npm( | ||
[ | ||
'dist-tags', | ||
'@scoped/another', | ||
'--registry', common.registry, | ||
'--loglevel', 'silent' | ||
], | ||
{ cwd: pkg }, | ||
function (er, code, stdout, stderr) { | ||
t.ifError(er, 'npm access') | ||
t.notOk(code, 'exited OK') | ||
t.notOk(stderr, 'no error output') | ||
t.equal(stdout, 'a: 0.0.2\nb: 0.6.0\nlatest: 2.0.0\n') | ||
|
||
t.end() | ||
} | ||
) | ||
}) | ||
|
||
test('npm dist-tags add @scoped/[email protected] c', function (t) { | ||
common.npm( | ||
[ | ||
|