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.
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.
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.
- 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.