-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec to dist-tag remove function
PR-URL: npm#235 Credit: @theberbie Close: npm#235 Reviewed-by: @isaacs EDIT(isaacs): Added test
- Loading branch information
Showing
2 changed files
with
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,12 @@ function mocks (server) { | |
server.delete('/-/package/@scoped%2fanother/dist-tags/c') | ||
.reply(200, { c: '7.7.7' }) | ||
|
||
// using a scoped registry | ||
server.get('/-/package/@scoped%2ffoo/dist-tags') | ||
.reply(200, { latest: '2.0.0', a: '0.0.2', b: '0.6.0' }) | ||
server.delete('/-/package/@scoped%2ffoo/dist-tags/b') | ||
.reply(200, { b: '0.6.0' }) | ||
|
||
// rm | ||
server.get('/-/package/@scoped%2fanother/dist-tags') | ||
.reply(200, { latest: '4.0.0' }) | ||
|
@@ -232,6 +238,31 @@ test('npm dist-tags rm @scoped/another nonexistent', function (t) { | |
) | ||
}) | ||
|
||
test('npm dist-tags rm with registry assigned to scope', function (t) { | ||
fs.writeFileSync(path.resolve(pkg, '.npmrc'), ` | ||
@scoped:registry=${common.registry} | ||
${common.registry.replace(/^https?:/, '')}:_authToken=taken | ||
`) | ||
|
||
common.npm( | ||
[ | ||
'dist-tags', | ||
'rm', '@scoped/foo', 'b', | ||
'--loglevel', 'silent', | ||
'--userconfig', path.resolve(pkg, '.npmrc') | ||
], | ||
{ 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, '-b: @scoped/[email protected]\n') | ||
|
||
t.end() | ||
} | ||
) | ||
}) | ||
|
||
test('cleanup', function (t) { | ||
t.pass('cleaned up') | ||
rimraf.sync(pkg) | ||
|