Skip to content

Commit 873ac7a

Browse files
wraithgarlukekarrys
authored andcommitted
chore(publish): add test for _auth with configured registry
1 parent 6cd6831 commit 873ac7a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tap-snapshots/test/lib/commands/publish.js.test.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ exports[`test/lib/commands/publish.js TAP _auth config default registry > new pa
99
1010
`
1111

12+
exports[`test/lib/commands/publish.js TAP bare _auth and registry config > new package version 1`] = `
13+
14+
`
15+
1216
exports[`test/lib/commands/publish.js TAP dry-run > must match snapshot 1`] = `
1317
Array [
1418
Array [

test/lib/commands/publish.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,33 @@ t.test('_auth config default registry', async t => {
626626
t.matchSnapshot(joinedOutput(), 'new package version')
627627
})
628628

629+
t.test('bare _auth and registry config', async t => {
630+
const spec = npa('@npm/test-package')
631+
const { npm, joinedOutput } = await loadMockNpm(t, {
632+
config: {
633+
registry: alternateRegistry,
634+
_auth: basic,
635+
},
636+
prefixDir: {
637+
'package.json': JSON.stringify({
638+
name: '@npm/test-package',
639+
version: '1.0.0',
640+
}, null, 2),
641+
},
642+
globals: ({ prefix }) => ({
643+
'process.cwd': () => prefix,
644+
}),
645+
})
646+
const registry = new MockRegistry({
647+
tap: t,
648+
registry: alternateRegistry,
649+
basic,
650+
})
651+
registry.nock.put(`/${spec.escapedName}`).reply(200, {})
652+
await npm.exec('publish', [])
653+
t.matchSnapshot(joinedOutput(), 'new package version')
654+
})
655+
629656
t.test('bare _auth config scoped registry', async t => {
630657
const { npm } = await loadMockNpm(t, {
631658
config: {

0 commit comments

Comments
 (0)