원클릭으로
debug-node-coverage
// Debug node test coverage failures. Use when ./tools/test-js-with-node --coverage reports lines missing coverage.
// Debug node test coverage failures. Use when ./tools/test-js-with-node --coverage reports lines missing coverage.
Visually verify UI changes using Puppeteer screenshots. Use when you need to check layout, colors, positioning, or other visual aspects of a UI change.
Fetch messages from a Zulip narrow URL (chat.zulip.org). Use when the user shares a Zulip conversation link, when you encounter a Zulip link in a GitHub issue or PR, or when a Zulip conversation references another Zulip thread that may be relevant.
Fix backend test coverage gaps. Use when CI output or test-backend --coverage reports missing lines, like "ERROR: path/to/file.py no longer has complete backend test coverage".
| name | debug-node-coverage |
| description | Debug node test coverage failures. Use when ./tools/test-js-with-node --coverage reports lines missing coverage. |
When ./tools/test-js-with-node --coverage fails with lines missing
coverage, follow this process.
The error looks like:
ERROR: web/src/filter.ts no longer has complete node test coverage
Lines missing coverage: 90, 225, 1780
This 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.
Read the source file at the reported line numbers. Classify each uncovered line:
assert(false, ...)
that exists only as a safety net. These are automatically excluded
by COVERAGE_EXCLUDE_LINES in tools/test-js-with-node.// istanbul ignore next comments. Use sparingly.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...}));
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.
Use // istanbul ignore next where appropriate, being sure that
you think the codebase is better without test coverage for this case.
./tools/test-js-with-node --coverage
This 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.
tools/test-js-with-node — Test runner, coverage enforcement,
EXEMPT_FILES list, COVERAGE_EXCLUDE_LINES patternstools/coveragerc — Python equivalent (for reference on pattern
style)web/tests/*.test.cjs — All JS test filesvar/node-coverage/ — Generated coverage reports (HTML viewable
at http://zulipdev.com:9991/node-coverage/index.html), but
you can also access in var/node-coverage/.