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
Jeremiah Senkpiel 8 years ago
parent
commit
4affb8929f
  1. 8
      doc/guides/writing_tests.md

8
doc/guides/writing_tests.md

@ -3,11 +3,13 @@
## What is a test? ## What is a test?
A test must be a node script that exercises a specific functionality provided 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: otherwise it will fail. A test will fail if:
- It exits by calling `process.exit(code)` where `code != 0` - It exits by setting `process.exitCode` to a non-zero number.
- It exits due to an uncaught exception. - 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 never exits. In this case, the test runner will terminate the test because
it sets a maximum time limit. it sets a maximum time limit.

Loading…
Cancel
Save