Challenge - 5 Problems
Deno Coverage Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateUnderstanding Deno coverage output format
What is the output of the following Deno coverage command snippet when run on a project with 3 files, where only 2 files have coverage data?
Deno
deno coverage --json
// Output example snippet:
{
"files": {
"file1.ts": {"lines": {"total": 10, "covered": 8}},
"file2.ts": {"lines": {"total": 5, "covered": 5}}
},
"total": {"lines": {"total": 15, "covered": 13}}
}Attempts:
2 left
💡 Hint
Deno coverage JSON output only includes files with coverage data.
✗ Incorrect
Deno coverage JSON output lists only files with coverage data. Files without coverage are omitted, so total coverage sums only those files.
❓ component_behavior
intermediateEffect of --lcov flag in Deno coverage
What happens when you run `deno coverage --lcov` on a project?
Attempts:
2 left
💡 Hint
lcov is a common coverage format used by many CI tools.
✗ Incorrect
The --lcov flag tells Deno to output coverage data in lcov format, which is a text format used by many coverage tools.
🔧 Debug
advancedDiagnosing missing coverage data in Deno
You ran `deno coverage` but the report shows zero coverage for all files. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
Coverage data is generated when tests run with coverage enabled.
✗ Incorrect
Deno coverage reads coverage data generated by running tests with coverage enabled. If tests were not run, no data exists.
📝 Syntax
advancedCorrect command to generate coverage report for a specific directory
Which of the following commands correctly generates a coverage report for the 'src' directory using Deno?
Attempts:
2 left
💡 Hint
Deno coverage uses glob patterns like src/** to include all files under a directory.
✗ Incorrect
The --include flag accepts glob patterns to filter which files to include in the report. `src/**` matches all files recursively in the src directory.
❓ lifecycle
expertSequence of steps to generate and view coverage in Deno
What is the correct sequence of commands to generate coverage data and then view a coverage report in Deno?
Attempts:
2 left
💡 Hint
You clear old data, run tests to generate new data, save it, then view report.
✗ Incorrect
First clear old coverage data, then run tests with coverage enabled to generate new data, save it, and finally view the report.
