summaryrefslogtreecommitdiff
path: root/docs/testing.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/testing.md')
-rw-r--r--docs/testing.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/testing.md b/docs/testing.md
index 8df183a34..9b53c4c82 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -92,6 +92,31 @@ Deno.test({
});
```
+### Exit sanitizer
+
+There's also the exit sanitizer which ensures that tested code doesn't call
+Deno.exit() signaling a false test success.
+
+This is enabled by default for all tests, but can be disabled by setting the
+`sanitizeExit` boolean to false in thetest definition.
+
+```ts
+Deno.test({
+ name: "false success",
+ fn() {
+ Deno.exit(0);
+ },
+ sanitizeExit: false,
+});
+
+Deno.test({
+ name: "failing test",
+ fn() {
+ throw new Error("this test fails");
+ },
+});
+```
+
## Running tests
To run the test, call `deno test` with the file that contains your test