Performance: Code coverage reporting
Code coverage reporting affects the test run time and resource usage during development, impacting how quickly developers get feedback.
deno test (without --coverage) for quick feedback, then run deno coverage separately when neededdeno test --coverage=coverage
| Pattern | Test Run Time | Resource Usage | Feedback Speed | Verdict |
|---|---|---|---|---|
| Run tests with coverage enabled | High (collects coverage data) | Higher CPU and memory | Slower feedback | [X] Bad |
| Run tests without coverage, generate coverage separately | Low (normal test speed) | Normal CPU and memory | Faster feedback | [OK] Good |
deno test --coverage command do?deno test --coveragedeno coverage.deno coverage command is used to view or export coverage reports after running tests with coverage.--reporter=text tells Deno to show the coverage report in the terminal.deno test --coverage=./cov_data deno coverage ./cov_data --reporter=lcov
./cov_data../cov_data and outputs a report in lcov format to a file (stdout is the report content, but typically redirected to a file).deno test --coverage but deno coverage shows no data. What is the likely cause?deno coverage is run before tests, no coverage data exists yet, so it shows no data.deno test --coverage=./cov_data to run tests and save coverage data in ./cov_data.deno coverage ./cov_data --reporter=html to create HTML files inside coverage/ directory.open coverage/index.html (macOS) or equivalent to view the report.Pass the test and this pattern moves unknown