-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(log): pass in logger to external modules
Most of these module use npm-registry-fetch under the hood, which will log things like the `npm-notice` header if seen. Currently we aren't passing in a logger to them, which means that log message is never seen, among any other logged messages those modules may need to make. I added tests where I could. Some tests were in a state where the entire libnpm* module was an empty mocked function, so asserting that it got passed a `log` attribute was onerous.
- Loading branch information
Showing
25 changed files
with
183 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,15 @@ const t = require('tap') | |
|
||
let getIdentityImpl = () => 'someperson' | ||
let npmFetchBody = null | ||
let npmFetchLog = null | ||
|
||
const npmFetch = async (uri, opts) => { | ||
npmFetchBody = opts.body | ||
npmFetchLog = opts.log | ||
} | ||
|
||
npmFetch.json = async (uri, opts) => { | ||
npmFetchLog = opts.log | ||
return { | ||
versions: { | ||
'1.0.0': {}, | ||
|
@@ -82,7 +85,12 @@ t.test('invalid semver range', async t => { | |
}) | ||
|
||
t.test('undeprecate', async t => { | ||
t.teardown(() => { | ||
npmFetchBody = null | ||
npmFetchLog = null | ||
}) | ||
await deprecate.exec(['foo', '']) | ||
t.ok(npmFetchLog, 'was passed a logger') | ||
t.match(npmFetchBody, { | ||
versions: { | ||
'1.0.0': { deprecated: '' }, | ||
|
@@ -95,9 +103,11 @@ t.test('undeprecate', async t => { | |
t.test('deprecates given range', async t => { | ||
t.teardown(() => { | ||
npmFetchBody = null | ||
npmFetchLog = null | ||
}) | ||
|
||
await deprecate.exec(['[email protected]', 'this version is deprecated']) | ||
t.ok(npmFetchLog, 'was passed a logger') | ||
t.match(npmFetchBody, { | ||
versions: { | ||
'1.0.0': { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.