+23
-1
lines changedFilter options
+23
-1
lines changed Original file line number Diff line number Diff line change
@@ -96,6 +96,10 @@ class Publish extends BaseCommand {
96
96
}
97
97
98
98
const resolved = npa.resolve(manifest.name, manifest.version)
99
+
100
+
// make sure tag is valid, this will throw if invalid
101
+
npa(`${manifest.name}@${defaultTag}`)
102
+
99
103
const registry = npmFetch.pickRegistry(resolved, opts)
100
104
const creds = this.npm.config.getCredentialsByURI(registry)
101
105
const noCreds = !(creds.token || creds.username || creds.certfile && creds.keyfile)
Original file line number Diff line number Diff line change
@@ -291,7 +291,7 @@ t.test('shows usage with wrong set of arguments', async t => {
291
291
await t.rejects(publish.exec(['a', 'b', 'c']), publish.usage)
292
292
})
293
293
294
-
t.test('throws when invalid tag', async t => {
294
+
t.test('throws when invalid tag is semver', async t => {
295
295
const { npm } = await loadMockNpm(t, {
296
296
config: {
297
297
tag: '0.0.13',
@@ -306,6 +306,24 @@ t.test('throws when invalid tag', async t => {
306
306
)
307
307
})
308
308
309
+
t.test('throws when invalid tag when not url encodable', async t => {
310
+
const { npm } = await loadMockNpm(t, {
311
+
config: {
312
+
tag: '@test',
313
+
},
314
+
prefixDir: {
315
+
'package.json': JSON.stringify(pkgJson, null, 2),
316
+
},
317
+
})
318
+
await t.rejects(
319
+
npm.exec('publish', []),
320
+
{
321
+
/* eslint-disable-next-line max-len */
322
+
message: 'Invalid tag name "@test" of package "test-package@@test": Tags may not have any characters that encodeURIComponent encodes.',
323
+
}
324
+
)
325
+
})
326
+
309
327
t.test('tarball', async t => {
310
328
const { npm, joinedOutput, logs, home } = await loadMockNpm(t, {
311
329
config: {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4