--- name: Set a code coverage threshold with the Bun test runner --- Bun's test runner supports built-in code coverage reporting via the `--coverage` flag. ```sh $ 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 | 66.67 | 77.78 | math.ts | 50.00 | 66.67 | random.ts | 50.00 | 66.67 | -------------|---------|---------|------------------- 3 pass 0 fail 3 expect() calls ``` --- To set a minimum coverage threshold, add the following line to your `bunfig.toml`. This requires that 90% of your codebase is covered by tests. ```toml [test] # to require 90% line-level and function-level coverage coverageThreshold = 0.9 ``` --- If your test suite does not meet this threshold, `bun test` will exit with a non-zero exit code to signal a failure. ```sh $ bun test --coverage $ echo $? 1 # this is the exit code of the previous command ``` --- Different thresholds can be set for line-level and function-level coverage. ```toml [test] # to set different thresholds for lines and functions coverageThreshold = { line = 0.5, function = 0.7 } ``` --- See [Docs > Test runner > Coverage](/docs/test/coverage) for complete documentation on code coverage reporting in Bun. -user-defined-entryfile'>cf-user-defined-entryfile Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/.github (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-07-12Refactor config loading (#7622)Gravatar Bjorn Lu 6-151/+90
2023-07-12[ci] formatGravatar bluwy 1-1/+1
2023-07-12feat: bumped typescript-eslint to v6 stable 🥳 (#7626)Gravatar Josh Goldberg ✨ 4-43/+49
2023-07-12fix(@astrojs/vercel): improve file detection (#7621)Gravatar Emanuele Stoppa 16-25/+113
2023-07-11[ci] formatGravatar matthewp 1-1/+1
2023-07-11Fixes Response not being cloneable by middleware (#7623)Gravatar Matthew Phillips 5-0/+37
2023-07-11[ci] release (#7594)astro@2.8.1@astrojs/prefetch@0.3.0@astrojs/markdoc@0.4.2Gravatar Houston (Bot) 50-104/+100
2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7
2023-07-11[ci] formatGravatar bluwy 1-1/+1
2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123
2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7
2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95
2023-07-10[ci] formatGravatar bluwy 1-1/+1