Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2020-08-29 00:13:43 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2020-09-01 22:05:41 +0300
commit2d1af0264b0c233b96cec2bae024b3abcd049b16 (patch)
tree6dd9b6fb8202d003d7972becdb79c9f09c7a9967 /tap-snapshots
parent01d37aee3a77d784530dbe28f4c8ebd940f7e261 (diff)
test: add lib/utils/error-handler.js tests
Add unit tests to `lib/utils/error-handler.js`, these are very special since the module handles some internal state through variables which are not exposed and binds itself to multiple global `process` events. Also two minor tweaks/fixes to the original implementation: - Refactored unused param in `reallyExit()` - Fixed String.prototype.match group capture usage PR-URL: https://github.com/npm/cli/pull/1742 Credit: @ruyadorno Close: #1742 Reviewed-by: @isaacs
Diffstat (limited to 'tap-snapshots')
-rw-r--r--tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js b/tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js
new file mode 100644
index 000000000..909051cda
--- /dev/null
+++ b/tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js
@@ -0,0 +1,23 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/utils/error-handler.js TAP handles unknown error > should have expected log contents for unknown error 1`] = `
+0 verbose code 1
+1 error foo A complete log of this run can be found in:
+1 error foo {CWD}/cachefolder/_logs/expecteddate-debug.log
+2 verbose stack Error: ERROR
+3 verbose cwd {CWD}
+4 verbose Foo 1.0.0
+5 verbose argv "/node" "{CWD}/test/lib/utils/error-handler.js"
+6 verbose node v1.0.0
+7 verbose npm v1.0.0
+8 error foo code ERROR
+9 error foo ERR ERROR
+10 error foo ERR ERROR
+11 verbose exit 1
+
+`