diff options
author | Gar <gar+gh@danger.computer> | 2021-06-29 22:42:54 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-07-12 19:24:07 +0300 |
commit | efc4313c2062ffad22aa24e5198d575a7eb5f20e (patch) | |
tree | 1d740eb9310ca6681252634c51cd39d54df88145 /tap-snapshots | |
parent | 103c8c3ef3ba7ff0483557f32eebc4c6298285e3 (diff) |
chore(refactor): refactor exit handler and tests
* npm mock logger writes to npm.log.record too now
* No more extra process.exit from within the process `exit` event handle.
* No more `exit()` function. Logic is rolled up into the exit handler.
* Now there is only an exit handler and an exit event listener.
`lib/utils/perf.js` was rolled up into npm.js itself.
Unfortunately the tests were written in such a way that any further
refactoring of the exit handler was going to require also rewriting the
tests. Fortunately NOW the tests are interacting with the exit handler
in a way that shouldn't require them to be rewritten AGAIN if we change
the internals of the exit handler.
PR-URL: https://github.com/npm/cli/pull/3482
Credit: @wraithgar
Close: #3482
Reviewed-by: @nlf
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test/lib/utils/exit-handler.js.test.cjs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs b/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs index 8cea8ee17..eb383c104 100644 --- a/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs +++ b/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs @@ -6,15 +6,15 @@ */ 'use strict' exports[`test/lib/utils/exit-handler.js TAP handles unknown error > should have expected log contents for unknown error 1`] = ` -0 verbose stack Error: ERROR -1 verbose cwd {CWD} -2 verbose Foo 1.0.0 -3 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js" -4 verbose node v1.0.0 -5 verbose npm v1.0.0 -6 error foo code ERROR -7 error foo ERR ERROR -8 error foo ERR ERROR -9 verbose exit 1 +24 verbose stack Error: ERROR +25 verbose cwd {CWD} +26 verbose Foo 1.0.0 +27 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js" +28 verbose node v1.0.0 +29 verbose npm v1.0.0 +30 error code ERROR +31 error ERR ERROR +32 error ERR ERROR +33 verbose exit 1 ` |