debug-node-coverage
Skill2 starsChanged 6 months agoApache-2.0View on GitHub
Debug node test coverage failures. Use when ./tools/test-js-with-node --coverage reports lines missing coverage.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zulip/zulipword for word, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 1
- zulip/zulip★ 26k100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- fetch-zulip-messagesSkill
- fix-backend-coverageSkill
- visual-testSkill
- write-changelogSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
When ./tools/test-js-with-node --coverage fails with lines missing coverage, follow this process.
- Distinctive: line 26
Read the source file at the reported line numbers.
- Distinctive: line 52
Add tests near related existing tests.
- Very specific: line 59
Use // istanbul ignore next where appropriate, being sure that you think the codebase is better without test coverage for this case.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debugging Node Test Coverage Failures
When ./tools/test-js-with-node --coverage fails with lines missing
coverage, follow this process.
Understanding the error
The error looks like:
ERROR: web/src/filter.ts no longer has complete node test coverage
Lines missing coverage: 90, 225, 1780This means the listed lines in the source file were never executed by
any test. Zulip enforces 100% line coverage for all files not listed
in EXEMPT_FILES in tools/test-js-with-node.
Step 1: Read the uncovered lines
Read the source file at the reported line numbers. Classify each uncovered line:
- Testable code: A branch or path that can be reached with the right test input. Fix by adding tests.
- Defensive/unreachable assertion: Code like
assert(false, ...)that exists only as a safety net. These are automatically excluded byCOVERAGE_EXCLUDE_LINESintools/test-js-with-node. - Code that is unreachable or otherwise not worth testing:
Mark with
// istanbul ignore nextcomments. Use sparingly.
Step 2: Find the test file
Tests for web/src/foo.ts live in web/tests/foo.test.cjs. Read the
test file to understand existing patterns before adding new tests.
The common predicate test pattern:
const predicate = get_predicate([["operator", operand]]);
assert.ok(predicate({...message that should match...}));
assert.ok(!predicate({...message that should not match...}));Step 3: Add tests for testable code
Add tests near related existing tests. Follow the existing style exactly. Tests should exercise the behavior, not the implementation detail — name and locate tests based on what they verify, not which internal code path they hit.
Step 4: Handle unreachable assertions
Use // istanbul ignore next where appropriate, being sure that
you think the codebase is better without test coverage for this case.
Step 5: Verify
./tools/test-js-with-node --coverageThis runs all JS tests in serial mode with istanbul/nyc instrumentation and checks that non-exempt files have 100% line coverage.
For faster iteration, you can run an individual test and analyze the coverage output files to see whether it covered a target line.
Key files
tools/test-js-with-node— Test runner, coverage enforcement,EXEMPT_FILESlist,COVERAGE_EXCLUDE_LINESpatternstools/coveragerc— Python equivalent (for reference on pattern style)web/tests/*.test.cjs— All JS test filesvar/node-coverage/— Generated coverage reports (HTML viewable athttp://zulipdev.com:9991/node-coverage/index.html), but you can also access in var/node-coverage/.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

