deno test: Run Tests in CI
deno test finds *_test.ts and *.test.ts files and runs the Deno.test cases inside them.
The test runner ships with Deno, so CI needs no extra dependency. Tests run under the same sandbox as deno run, so they need explicit permissions too.
What it does
deno test discovers test files by naming convention, runs each Deno.test step, and reports pass/fail. It applies the permission flags you pass to the tests, and can emit coverage data with --coverage.
Common usage
deno test --allow-read --allow-net
deno test --coverage=cov_profile
deno test --filter "parses config" tests/
# fail fast and run serially
deno test --fail-fast --jobs 1Options
| Flag | What it does |
|---|---|
| --coverage=<dir> | Collect coverage into a directory |
| --filter <pattern> | Run only tests whose name matches |
| --fail-fast[=N] | Stop after the first (or N) failures |
| --allow-net / --allow-read | Grant permissions to the tests |
| --no-check | Skip type-checking before running |
| --parallel | Run test files in parallel (Deno 2; was --jobs in Deno 1) |
In CI
Restore DENO_DIR before deno test so dependency downloads are cached. Pass --frozen so tests run against the locked dependency set. Use --coverage in CI then feed it to deno coverage to gate on a threshold.
Common errors in CI
"error: Requires read access to ..., run again with the --allow-read flag" means a test touched the filesystem without permission. "Test failed because leaks were detected" (op leak / resource leak) means an async resource was not closed; await it or close the handle. "No test modules found" means the file naming did not match the *_test.ts convention.