diff options
author | Gar <gar+gh@danger.computer> | 2022-03-24 19:07:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 19:07:44 +0300 |
commit | 81afa5a8838c71a3a5037e2c8b4ae196e19fe0d7 (patch) | |
tree | d8d65a60bde6f6b913babe6f19f9b79099857b78 /test/fixtures | |
parent | 98bfd9a8cc23930e6becd15fffabadd1c269b0a2 (diff) |
fix(unpublish): properly apply publishConfig (#4601)
The tests for unpublish were mocked so heavily they weren't actually
asserting anything. In rewriting them several bugs were found.
- `write=true` was not being consistenly used when fetching packument
data, it is now.
- The decision on when to load the local package.json file was not
working at all, that has been fixed. If the cwd contains a
package.json whose name matches the package you are uninstalling, the
local package.json will be read and its publishConfig applied to your
request.
- dead code inside the `npm unpublish` path was removed. There is no
need to check if you are unpublishing the last version here, you're
already unpublishing the entire project.
- publishConfig is now being applied through the config flatten method,
not a raw object assignment.
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/tnock.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/fixtures/tnock.js b/test/fixtures/tnock.js index c5acec510..8e236733f 100644 --- a/test/fixtures/tnock.js +++ b/test/fixtures/tnock.js @@ -2,13 +2,15 @@ const nock = require('nock') -// TODO (other tests actually make network calls today, which is bad) -// nock.disableNetConnect() +// Uncomment this to find requests that aren't matching +// nock.emitter.on('no match', req => console.log(req.options)) module.exports = tnock -function tnock (t, host) { - const server = nock(host) +function tnock (t, host, opts) { + nock.disableNetConnect() + const server = nock(host, opts) t.teardown(function () { + nock.enableNetConnect() server.done() }) return server |