Skip to content

Commit

Permalink
fix: cover empty versions
Browse files Browse the repository at this point in the history
  • Loading branch information
reggi committed Dec 2, 2024
1 parent 0fdcab6 commit 6d4605a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,3 +1185,37 @@ t.test('ALLOWS publish when not published yet', async t => {
}).reply(200, {})
await npm.exec('publish', [])
})

t.test('ALLOWS publish when not published yet (no versions)', async t => {
const version = '100.0.0'

const { npm } = await loadMockNpm(t, {
config: {
loglevel: 'silent',
[`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token',
},
prefixDir: {
'package.json': JSON.stringify({
...pkgJson,
version,
publishConfig: { registry: alternateRegistry },
}, null, 2),
},
mocks: {
...mockNpmRegistryFetch({
[`/${pkg}`]: { versions: {} },
}).mocks,
},
})
const registry = new MockRegistry({
tap: t,
registry: alternateRegistry,
authorization: 'test-other-token',
})
registry.nock.put(`/${pkg}`, body => {
return t.match(body, putPackagePayload({
pkg, alternateRegistry, version,
}))
}).reply(200, {})
await npm.exec('publish', [])
})

0 comments on commit 6d4605a

Please sign in to comment.