denoland/deno · error
No bench modules found
Error message
No bench modules found
What it means
`deno bench` discovered zero bench modules and the run was not started with `--permit-no-files`. Bench discovery matches `*_bench.ts`/`*_bench.tsx` files, `bench/` directories, and `bench.include` globs from deno.json. An empty suite is an error so CI doesn't green-light a suite that silently matched nothing.
Solutions
- Follow the naming convention: `*_bench.ts` files or a `bench/` directory, or pass files explicitly (`deno bench my_file.ts`)
- Add a `"bench"` field with `"include"` globs in deno.json if benches live under non-default names or paths
- In CI where an empty suite is expected, pass `--permit-no-files`
Example fix
# before # file named user.test.ts, `deno bench` finds nothing # after # rename to match the convention mv user.test.ts user_bench.ts deno bench
Defensive patterns
Strategy: validation
Validate before calling
// Fail fast with your own message if no bench files will be discovered
import { expandGlob } from "jsr:@std/fs";
let found = false;
for await (const _ of expandGlob("**/*_bench.ts")) {
found = true;
break;
}
if (!found) {
throw new Error("no *_bench.ts files found — check naming or bench.include in deno.json");
} Prevention
- Follow the *_bench.ts / bench/ naming convention
- Declare bench.include globs in deno.json when benches live in non-default paths
- Use --permit-no-files deliberately in CI where an empty suite is acceptable
When it happens
Trigger: Running `deno bench` where no files match the default patterns, where `bench.include`/`bench.exclude` in deno.json filter everything out, or where explicitly passed file arguments are all excluded.
Common situations: New projects with no benches yet; benches named `user.test.ts` instead of `user_bench.ts`; running from a workspace member that has no benches while the config lives at the workspace root.
Related errors
- Bench failed because the "only" option was used
- Bench failed
- BenchContext::end() has already been invoked
- codesigning requires a macOS build host (uses…
- deno ci requires a lockfile, but none was found. hint…
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/6adc0f0dfc0388df.
Report an issue: GitHub.
Appendix: source
Thrown at cli/tools/bench/mod.rs:491
let specifiers = members_with_bench_options
.iter()
.map(|(_, bench_options)| {
collect_specifiers(
CollectSpecifiersOptions {
file_patterns: bench_options.files.clone(),
vendor_folder: cli_options.vendor_dir_path().map(ToOwned::to_owned),
include_ignored_specified: false,
},
is_supported_bench_path,
)
})
.collect::<Result<Vec<_>, _>>()?
.into_iter()
.flatten()
.collect::<Vec<_>>();
if !workspace_bench_options.permit_no_files && specifiers.is_empty() {
return Err(anyhow!("No bench modules found"));
}
let main_graph_container = factory.main_module_graph_container().await?;
main_graph_container
.check_specifiers(
&specifiers,
CheckSpecifiersOptions {
ext_overwrite: cli_options.ext_flag().as_ref(),
..Default::default()
},
)
.await?;
if workspace_bench_options.no_run {
return Ok(());
}
let preload_modules = cli_options.preload_modules()?;View on GitHub (pinned to 9ad36f7a2c)