Skip to content

Commit

Permalink
doc: clarify the exit code part of writing_tests
Browse files Browse the repository at this point in the history
PR-URL: #9502
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Fishrock123 authored and MylesBorins committed Dec 13, 2016
1 parent 16b5314 commit 6f850f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doc/guides/writing_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
## What is a test?

A test must be a node script that exercises a specific functionality provided
by node and checks that it behaves as expected. It should return 0 on success,
by node and checks that it behaves as expected. It should exit with code `0` on success,
otherwise it will fail. A test will fail if:

- It exits by calling `process.exit(code)` where `code != 0`
- It exits due to an uncaught exception.
- It exits by setting `process.exitCode` to a non-zero number.
- This is most often done by having an assertion throw an uncaught
Error.
- Occasionally, using `process.exit(code)` may be appropriate.
- It never exits. In this case, the test runner will terminate the test because
it sets a maximum time limit.

Expand Down

0 comments on commit 6f850f4

Please sign in to comment.