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, 24 insertions, 1 deletions
diff --git a/docs/testing.md b/docs/testing.md
index f44483125..174123cce 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -129,10 +129,33 @@ There are a number of options to filter the tests you are running.
Tests can be run individually or in groups using the command line `--filter`
option.
+The filter flags accept a string or a pattern as value.
+
+Assuming the following tests:
+
+```ts
+Deno.test({ name: "my-test", fn: myTest });
+Deno.test({ name: "test-1", fn: test1 });
+Deno.test({ name: "test2", fn: test2 });
+```
+
+This command will run all of these tests because they all contain the word
+"test".
+
```shell
-deno test --filter "hello world" tests/
+deno test --filter "test" tests/
```
+On the flip side, the following command uses a pattern and will run the second
+and third tests.
+
+```shell
+deno test --filter "/test-*\d/" tests/
+```
+
+_To let Deno know that you want to use a pattern, wrap your filter with
+forward-slashes like the JavaScript syntactic sugar for a REGEX._
+
This command will run any test which contains the string "hello world" in its
test name for tests found within files in the `tests/` directory.