diff options
Diffstat (limited to 'deps/npm/test/lib/commands/dist-tag.js')
-rw-r--r-- | deps/npm/test/lib/commands/dist-tag.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/deps/npm/test/lib/commands/dist-tag.js b/deps/npm/test/lib/commands/dist-tag.js index 756a09d7de..b83c30e9c6 100644 --- a/deps/npm/test/lib/commands/dist-tag.js +++ b/deps/npm/test/lib/commands/dist-tag.js @@ -43,6 +43,7 @@ const routeMap = { // XXX overriding this does not appear to do anything, adding t.plan to things // that use it fails the test let npmRegistryFetchMock = (url, opts) => { + npmRegistryFetchLog = opts.log if (url === '/-/package/foo/dist-tags') { throw new Error('no package found') } @@ -50,7 +51,11 @@ let npmRegistryFetchMock = (url, opts) => { return routeMap[url] } -npmRegistryFetchMock.json = async (url, opts) => routeMap[url] +let npmRegistryFetchLog +npmRegistryFetchMock.json = async (url, opts) => { + npmRegistryFetchLog = opts.log + return routeMap[url] +} const logger = (...msgs) => { for (const msg of [...msgs]) { @@ -81,6 +86,10 @@ const npm = mockNpm({ }) const distTag = new DistTag(npm) +t.afterEach(() => { + npmRegistryFetchLog = null +}) + t.test('ls in current package', async t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ @@ -88,6 +97,7 @@ t.test('ls in current package', async t => { }), }) await distTag.exec(['ls']) + t.ok(npmRegistryFetchLog, 'is passed a logger') t.matchSnapshot( result, 'should list available tags for current package' @@ -289,6 +299,7 @@ t.test('add new tag', async t => { }) npmRegistryFetchMock = async (url, opts) => { + t.ok(opts.log, 'is passed a logger') t.equal(opts.method, 'PUT', 'should trigger request to add new tag') t.equal(opts.body, '7.7.7', 'should point to expected version') } @@ -355,6 +366,7 @@ t.test('remove existing tag', async t => { } npm.prefix = t.testdir({}) await distTag.exec(['rm', '@scoped/another', 'c']) + t.ok(npmRegistryFetchLog, 'is passed a logger') t.matchSnapshot(log, 'should log remove info') t.matchSnapshot(result, 'should return success msg') }) |