-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: #1742 Credit: @ruyadorno Close: #1742 Reviewed-by: @isaacs
- Loading branch information
Showing
3 changed files
with
549 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
` |
Oops, something went wrong.