Skip to content

Commit

Permalink
check that no error is thrown with default handler (status === 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaranville committed Feb 29, 2024
1 parent c4db709 commit f006344
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/nonthrowing_error_handler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ function open_nonexistant_file() {
}

const file = open_nonexistant_file();

4 changes: 3 additions & 1 deletion test/test_throwing_error_handler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ async function test_default_error_handler() {
// verify that the default error handler does not throw,
// and that it prints an error message to stderr
const child_process = spawnSync("/usr/bin/env", ["node", "test/nonthrowing_error_handler.mjs"]);
const { stderr } = child_process;
const { stderr, status } = child_process;
// status should be zero, no error thrown:
assert.strictEqual(status, 0);
const error_message = stderr.toString();
const lines = error_message.split("\n");
assert(lines.length > 2, "error message should have more than 2 lines");
Expand Down

0 comments on commit f006344

Please sign in to comment.