denoland/deno · error
Test failed
Error message
Test failed
What it means
Generic terminal error returned by the Deno LSP test runner when the run summary has at least one failure (summary.failed > 0). failed is incremented by failed tests, failed steps, cancelled tests, and uncaught errors emitted from test workers. The specific failure details were already reported per-test through the event stream before this error is returned, so the message itself carries no location information.
Source
Thrown at cli/lsp/testing/execution.rs:509
test::TestEvent::SnapshotSummary(_) => {}
test::TestEvent::ForceEndReport => {}
test::TestEvent::Sigint => {}
test::TestEvent::Exit(_) => {}
test::TestEvent::IsolateExit(_, _) => {}
}
}
let elapsed = Instant::now().duration_since(earlier);
reporter.report_summary(&summary, &elapsed);
if used_only {
return Err(anyhow!(
"Test failed because the \"only\" option was used"
));
}
if summary.failed > 0 {
return Err(anyhow!("Test failed"));
}
Ok(())
})
};
let (join_results, result) = future::join(join_stream, handler).await;
// propagate any errors
for join_result in join_results {
join_result??;
}
result??;
Ok(())
}
View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Read the failure details reported before the summary — Test Explorer failure nodes or the Deno Language Server output panel name the failing tests and their errors.
- Reproduce outside the LSP with `deno test <file>` (or `deno test --filter <name>`) for full stack traces.
- Fix the failing tests, or address the uncaught error / cancellation source, then re-run the suite.
Defensive patterns
Strategy: try-catch
Try / catch
// Failures arrive as this terminal error AFTER per-test results streamed in.
try {
await session.testRun(modules);
} catch (err) {
if (err?.message === 'Test failed') {
// details are in the Deno.testEvent notifications already received:
// surface them (Test Explorer failures / report), never swallow silently
reportFailuresFromTestEvents();
} else {
throw err;
}
} Prevention
- Consume the per-test results from the test event stream — the terminal error carries no failure details
- Reproduce persistent failures with 'deno test <file>' outside the IDE for full stack traces
- Remember cancelled (timed-out) tests and uncaught worker errors also increment the failure count
When it happens
Trigger: Any LSP-driven test run (VS Code Test Explorer) in which at least one test or step fails, a test is cancelled, or TestEvent::UncaughtError fires from a worker. The handler returns this after reporter.report_summary once summary.failed is non-zero.
Common situations: Red suites run from the IDE; flaky tests cancelled on timeout; uncaught promise rejections inside a test module that fail the run even when all test bodies pass.
Related errors
- Test failed because the "only" option was used
- Snapshot does not match:\n\n ${green("[Diff]")} ${green("
- Expected the second argument to assertSnapshot() to be an op
- Snapshot serializer must return a string
- Missing snapshot file.
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/9732c3c420c9809f.
Report an issue: GitHub.