fix: installation with custom dist-tag

This commit is contained in:
zkochan
2017-04-15 21:59:52 +03:00
parent 7f426d0cc7
commit 646eafef15
2 changed files with 11 additions and 2 deletions

View File

@@ -101,9 +101,8 @@ function argsToSpecs (args: string[], defaultTag: string, where: string): Packag
return args
.map(arg => npa(arg, where))
.map(spec => {
if (spec.type === 'tag' && !spec.raw.endsWith('@latest')) {
if (spec.type === 'tag' && !spec.rawSpec) {
spec.fetchSpec = defaultTag
spec.saveSpec = defaultTag
}
return spec
})

View File

@@ -70,6 +70,16 @@ test('modules without version spec, with custom tag config', async function (t)
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
})
test('installing a package by specifying a specific dist-tag', async function (t) {
const project = prepare(t)
await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'beta')
await installPkgs(['dep-of-pkg-with-1-dep@beta'], testDefaults())
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
})
test('scoped modules with versions (@rstacruz/tap-spec@4.1.1)', async function (t) {
const project = prepare(t)
await installPkgs(['@rstacruz/tap-spec@4.1.1'], testDefaults())