Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(publish): introduce figgy-pudding to share fetch opts
- Loading branch information
Showing
8 changed files
with
43 additions
and
40 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
18 changes: 1 addition & 17 deletions
18
commands/publish/lib/__mocks__/verify-npm-package-access.js
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 |
---|---|---|
@@ -1,22 +1,6 @@ | ||
"use strict"; | ||
|
||
const registry = new Map(); | ||
|
||
// to mock user modules, you _must_ call `jest.mock('./path/to/module')` | ||
const mockVerifyNpmPackageAccess = jest.fn((packages, opts) => { | ||
const result = new Set(packages.map(pkg => pkg.name)); | ||
|
||
result.add(`username: ${opts.get("username")}`); | ||
|
||
registry.set(opts.prefix, result); | ||
|
||
return Promise.resolve(); | ||
}); | ||
|
||
// keep test data isolated | ||
afterEach(() => { | ||
registry.clear(); | ||
}); | ||
const mockVerifyNpmPackageAccess = jest.fn(() => Promise.resolve()); | ||
|
||
module.exports = mockVerifyNpmPackageAccess; | ||
module.exports.registry = registry; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"use strict"; | ||
|
||
const log = require("libnpm/log"); | ||
const figgyPudding = require("figgy-pudding"); | ||
|
||
module.exports = figgyPudding( | ||
{ | ||
"fetch-retries": {}, | ||
fetchRetries: "fetch-retries", | ||
log: { default: log }, | ||
registry: {}, | ||
username: {}, | ||
}, | ||
{ | ||
other() { | ||
// open it up for the sake of tests | ||
return true; | ||
}, | ||
} | ||
); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.