From 873ac7a6ebb41b5ff1e0907f57c5b7e73cc16f0c Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 21 Apr 2022 07:38:08 -0700 Subject: chore(publish): add test for _auth with configured registry --- test/lib/commands/publish.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/lib/commands/publish.js b/test/lib/commands/publish.js index 885e82042..3cbe96238 100644 --- a/test/lib/commands/publish.js +++ b/test/lib/commands/publish.js @@ -626,6 +626,33 @@ t.test('_auth config default registry', async t => { t.matchSnapshot(joinedOutput(), 'new package version') }) +t.test('bare _auth and registry config', async t => { + const spec = npa('@npm/test-package') + const { npm, joinedOutput } = await loadMockNpm(t, { + config: { + registry: alternateRegistry, + _auth: basic, + }, + prefixDir: { + 'package.json': JSON.stringify({ + name: '@npm/test-package', + version: '1.0.0', + }, null, 2), + }, + globals: ({ prefix }) => ({ + 'process.cwd': () => prefix, + }), + }) + const registry = new MockRegistry({ + tap: t, + registry: alternateRegistry, + basic, + }) + registry.nock.put(`/${spec.escapedName}`).reply(200, {}) + await npm.exec('publish', []) + t.matchSnapshot(joinedOutput(), 'new package version') +}) + t.test('bare _auth config scoped registry', async t => { const { npm } = await loadMockNpm(t, { config: { -- cgit v1.2.3