Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
cloudflare avatar

Bazel Test Hygiene

  • 38 installs
  • 8.5k repo stars
  • Updated August 5, 2026
  • cloudflare/workerd

bazel-test-hygiene prevents false bazel test confidence in workerd.

About

The bazel-test-hygiene skill enforces three rules before claiming test success in workerd. Always pass --nocache_test_results because stale binaries cause false positives. Never use --test_arg -f filters that silently pass with zero matches. Run the full //... suite before claiming a fix is complete and verify Executed N out of N tests all pass. Regression tests require red-green verification on the full suite: green with fix, red without fix, green again after restore. Anti-patterns table contrasts cached runs, filter misuse, and partial target claims.

  • Always use --nocache_test_results on bazel test.
  • Never rely on -f filters that pass with zero tests.
  • Require full //... suite before claiming done.
  • Red-green regression verification on full suite.
  • Documents common false-confidence anti-patterns.

Bazel Test Hygiene by the numbers

  • 38 all-time installs (skills.sh)
  • Ranked #1,296 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

bazel-test-hygiene capabilities & compatibility

Capabilities
three mandatory bazel test hygiene rules
Use cases
testing
npx skills add https://github.com/cloudflare/workerd --skill bazel-test-hygiene

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs38
repo stars8.5k
Last updatedAugust 5, 2026
Repositorycloudflare/workerd

How should I run bazel tests reliably in workerd?

Mandatory bazel test hygiene rules to avoid false confidence from caches and filters.

Who is it for?

workerd developers validating fixes with bazel tests.

Skip if: Skip when only reading code without running tests.

When should I use this skill?

Before running bazel test or claiming tests pass.

What you get

Fresh full-suite bazel test with verified pass counts.

Files

SKILL.mdMarkdownGitHub ↗

Bazel Test Hygiene

The Three Rules

1. Always disable caching

bazel test //... --nocache_test_results

Why: Bazel's action cache can serve stale test binaries even after you edit source files. Without --nocache_test_results, you may be running the OLD binary and seeing OLD results. This is not hypothetical — it has caused real false-positive/false-negative confusion in this repo.

Always include `--nocache_test_results`. No exceptions.

2. Keep it simple — no filter flags

Do NOT use --test_arg='-f' or similar filter flags to run individual test cases.

Why: KJ test's -f flag silently passes when zero tests match. If you typo the filter or the test name changes, bazel reports "PASSED" with zero tests actually run. This gives completely false confidence.

Run the full test target. If you need to check a specific test, look for its name in the full output. If the full suite is too slow, run the specific test _target_ (e.g., //src/workerd/api:streams/standard-test@), not a filtered subset within a target.

3. Run the full suite before claiming done

A single test target passing does not mean you haven't broken something else. Fixes to shared code (queue.c++, standard.c++, common.h) can break tests in completely different directories.

Before claiming any fix is complete:

bazel test //... --nocache_test_results

Check the final summary line: Executed N out of N tests: N tests pass. All N must match. If any test fails, the fix is not done.

Red-Green Verification for Regression Tests

When writing a regression test for a bug fix, you MUST verify the test actually catches the bug:

1. Green: Run bazel test //... --nocache_test_results — all tests pass (fix in place) 2. Red: Remove the fix, run bazel test //... --nocache_test_results — the new test(s) MUST fail 3. Green: Restore the fix, run bazel test //... --nocache_test_results — all tests pass again

If step 2 passes (test doesn't fail without the fix), the test is not testing what you think. Go back and fix the test.

Do the red-green on the full suite, not just the one target. This catches two problems at once: (a) the regression test actually detects the bug, and (b) the fix doesn't break anything else.

Anti-Patterns

Don'tDo instead
bazel test //target (no cache flag)bazel test //target --nocache_test_results
--test_arg='-f' --test_arg='test name'Run the full target, grep output for test name
Run one target, claim fix is doneRun //..., check all-pass summary
Claim "tests pass" from a previous runRun fresh, read fresh output
Trust filter-based "PASSED" at face valueCheck that the expected test names appear in output

Related skills

FAQ

What does bazel-test-hygiene do?

bazel-test-hygiene prevents false bazel test confidence in workerd.

When should I use bazel-test-hygiene?

Before running bazel test or claiming tests pass.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

Testing & QAtestingdevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.