Deno test nonzero exit (failing tests) in CI
deno test exits nonzero when any test fails, throws, or a step errors. CI treats the nonzero exit as a failed job and prints the failing test names and assertions.
What this error means
The step ends with "test result: FAILED. N passed; M failed" and "error: Test failed" and the job exits with code 1.
deno
running 2 tests from ./main_test.ts
adds numbers ... FAILED
error: AssertionError: Values are not equal.
[Diff] Actual / Expected
- 3
+ 4
test result: FAILED. 1 passed; 1 failedCommon causes
A real assertion or thrown error in a test
The test logic failed an assertion or threw, which deno test reports as a failure and a nonzero exit.
Environment differences between local and CI
Missing permissions, env vars, or a different Deno version make a test that passes locally fail on the runner.
How to fix it
Reproduce and fix the failing test
- Read the failing test name and assertion diff.
- Run that test locally with the same permissions CI uses.
- Fix the code or test and re-run.
Terminal
deno test -A --filter "adds numbers"Grant the permissions tests need in CI
Ensure the test command grants the same read/write/net/env access the tests require so they behave as they do locally.
.github/workflows/ci.yml
- run: deno test --allow-read --allow-envHow to prevent it
- Run the full test suite with CI permissions locally before pushing.
- Pin the Deno version so behavior matches CI.
- Provide required env and permissions in the test step.
Related guides
Deno "error: No test modules found" in CIFix Deno "error: No test modules found" in CI - deno test matched no files, so the step exits nonzero without…
Deno top-level await hang or unresolved promise in CIFix Deno CI jobs that hang or fail on a top-level await that never resolves - the module waits forever on a p…
Deno "PermissionDenied: Requires env access" in CIFix Deno "PermissionDenied: Requires env access to ... run again with the --allow-env flag" in CI - the progr…