diff options
| author | 2023-08-06 06:30:23 -0700 | |
|---|---|---|
| committer | 2023-08-06 06:30:23 -0700 | |
| commit | 14624454196370e08309d4f0b0463b494e4df9ca (patch) | |
| tree | 538421bfffc3d804807a4ec70a1323fbcbe3416f /src/cli.zig | |
| parent | ecdf2ffa6c615d8a431c2919c0b9bdc4cbe2c4f0 (diff) | |
| download | bun-14624454196370e08309d4f0b0463b494e4df9ca.tar.gz bun-14624454196370e08309d4f0b0463b494e4df9ca.tar.zst bun-14624454196370e08309d4f0b0463b494e4df9ca.zip | |
Code coverage for `bun test` (#3975)
* WIP code coverage initial commit
* almost works
* one approach
* Code Coverage
* Update WebKit
* it works but is not yet accurate
* skip double ascii check
* wrapper
* it works but i'm not sure what to do about blocks
* hide blocks for now
* Update ZigSourceProvider.cpp
* Create coverage.md
* Update nav.ts
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/cli.zig')
| -rw-r--r-- | src/cli.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cli.zig b/src/cli.zig index aa36c63fb..ca0993dbb 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -219,6 +219,7 @@ pub const Arguments = struct { clap.parseParam("--rerun-each <NUMBER> Re-run each test file <NUMBER> times, helps catch certain bugs") catch unreachable, clap.parseParam("--only Only run tests that are marked with \"test.only()\"") catch unreachable, clap.parseParam("--todo Include tests that are marked with \"test.todo()\"") catch unreachable, + clap.parseParam("--coverage Generate a coverage profile") catch unreachable, clap.parseParam("--bail <NUMBER>? Exit the test suite after <NUMBER> failures. If you do not specify a number, it defaults to 1.") catch unreachable, clap.parseParam("-t, --test-name-pattern <STR> Run only tests with a name that matches the given regex.") catch unreachable, }; @@ -387,6 +388,11 @@ pub const Arguments = struct { }; } } + + if (!ctx.test_options.coverage.enabled) { + ctx.test_options.coverage.enabled = args.flag("--coverage"); + } + if (args.option("--bail")) |bail| { if (bail.len > 0) { ctx.test_options.bail = std.fmt.parseInt(u32, bail, 10) catch |e| { @@ -965,6 +971,7 @@ pub const Command = struct { run_todo: bool = false, only: bool = false, bail: u32 = 0, + coverage: TestCommand.CodeCoverageOptions = .{}, test_filter_regex: ?*RegularExpression = null, }; |
