Skip to content
Latchkey

go test "no tests to run" with a -run filter in CI

go test reports "no tests to run" when the -run pattern matches no test function names. The job often still shows ok, so a typo in the filter can silently skip the whole suite.

What this error means

go test prints "testing: warning: no tests to run" and "ok ... [no tests to run]", and the run completes without executing the intended tests.

go test
testing: warning: no tests to run
PASS
ok  	example.com/app	0.003s [no tests to run]

Common causes

The -run regex does not match any test name

A typo or wrong casing in the -run pattern means no TestXxx name matches, so nothing runs.

Tests excluded by build tags

The test files are gated behind a build tag that the current invocation did not enable, so the package has no tests to run.

How to fix it

Correct the -run pattern

  1. Check the exact test function names against the -run regex.
  2. Use a pattern that matches, or drop -run to run all tests.
  3. Re-run and confirm tests execute.
Terminal
# run all, or match the real name
go test ./...
go test -run '^TestFetch$' ./...

Enable the build tag the tests need

If the tests are tag-gated, pass the matching -tags so they compile and run.

Terminal
go test -tags=integration ./...

How to prevent it

  • Treat "[no tests to run]" as a signal that a filter is wrong.
  • Run the full suite by default; reserve -run for local focus.
  • Pass the right -tags for tag-gated test files.

Frequently asked questions

What causes ""testing: warning: no tests to run""?
A typo or wrong casing in the -run pattern means no TestXxx name matches, so nothing runs.
How do I fix "testing: warning: no tests to run"?
Correct the -run pattern

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card