Browse Source

doc: clarify the exit code part of writing_tests

PR-URL: https://github.com/nodejs/node/pull/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>
v6.x
Jeremiah Senkpiel 8 years ago
committed by Myles Borins
parent
commit
6f850f4037
  1. 8
      doc/guides/writing_tests.md

8
doc/guides/writing_tests.md

@ -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.

Loading…
Cancel
Save