本页还没有译文
本页 6 段还没译成简体中文,下面显示的是英文原文。Generate code coverage reports with the Bun test runner
还没翻译译自英文(bun.com)本页 6 段都还没译
Bun's test runner has built-in code coverage reporting. Use it to see how much of your codebase your tests cover, and where the gaps are.
Pass the --coverage flag to bun test to print a coverage report after the test run.
The report lists the source files the tests executed, the percentage of functions and lines that ran, and the line ranges that never ran.
bun test --coverage
test.test.ts:
✓ math > add [0.71ms]
✓ math > multiply [0.03ms]
✓ random [0.13ms]
-------------|---------|---------|-------------------
File | % Funcs | % Lines | Uncovered Line #s
-------------|---------|---------|-------------------
All files | 50.00 | 66.67 |
math.ts | 50.00 | 66.67 |
random.ts | 50.00 | 66.67 |
-------------|---------|---------|-------------------
3 pass
0 fail
3 expect() callsTo enable coverage reporting by default, add the following to your bunfig.toml:
[test]
coverage = true # always enable coverageSee Code coverage.
AI 翻译查看英文原文