Skip to content

Conversation

@xseman
Copy link

@xseman xseman commented Sep 18, 2025

What does this PR do?

Adds --coverage-ignore CLI option for bun test that excludes files matching glob patterns from coverage reports. Supports multiple patterns and overrides bunfig.toml configuration.

How did you verify your code works?

Added comprehensive tests covering:

  • Single pattern exclusion (--coverage-ignore ignore-me.ts)
  • Multiple patterns (--coverage-ignore utils/** --coverage-ignore *.config.ts)
  • CLI override of bunfig.toml settings
  • Verified excluded files are absent from coverage reports

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Adds a test-only CLI option --coverage-ignore to collect glob patterns excluded from coverage and wires it into test parsing. Adds tests verifying single/multiple ignore patterns and precedence over bunfig.toml when running bun test --coverage.

Changes

Cohort / File(s) Summary of changes
CLI argument parsing
src/cli/Arguments.zig
Introduces a new test-only parameter --coverage-ignore <STR>... and, when present, assigns the provided patterns to ctx.test_options.coverage.ignore_patterns during test command parsing.
Coverage tests
test/cli/test/coverage.test.ts
Adds three tests exercising --coverage-ignore: single-pattern, multi-pattern, and precedence with bunfig.toml; each runs bun test --coverage with snapshots and exit-code assertions.

Suggested reviewers

  • Jarred-Sumner
  • nektro
  • pfgithub

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat(coverage): add --coverage-ignore option for excluding files" is directly and fully related to the main change in the changeset. The title accurately summarizes the primary objective of introducing a new CLI option for the coverage feature, which aligns with both the implementation changes in src/cli/Arguments.zig and the test additions in test/cli/test/coverage.test.ts. The title is concise, specific, and uses a conventional commit format without vague or misleading language.
Description Check ✅ Passed The PR description fully follows the required template structure with both mandatory sections present and adequately filled. The "What does this PR do?" section clearly explains the new --coverage-ignore option and its key features (multiple patterns support, override behavior). The "How did you verify your code works?" section provides specific test cases and verification approaches that align with the actual changes shown in the raw summary. The description is complete, not vague, and provides sufficient context for understanding the change.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a4cb093 and 46f4811.

📒 Files selected for processing (1)
  • src/cli/Arguments.zig (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)

**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue

Files:

  • src/cli/Arguments.zig
src/**/*.zig

📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)

When adding debug logs in Zig, create a scoped logger and log via Bun APIs: const log = bun.Output.scoped(.${SCOPE}, .hidden); then log("...", .{})

src/**/*.zig: Use private fields in Zig with the # prefix (e.g., struct { #foo: u32 };)
Prefer decl literals in Zig (e.g., const decl: Decl = .{ .binding = 0, .value = 0 };)
Prefer placing @import statements at the bottom of the Zig file (formatter may reorder automatically)
Prefer @import("bun") rather than @import("root").bun or @import("../bun.zig")

In Zig code, be careful with allocators and use defer for cleanup

Files:

  • src/cli/Arguments.zig
🔇 Additional comments (2)
src/cli/Arguments.zig (2)

207-207: LGTM! Well-defined CLI parameter.

The parameter definition follows the established pattern for multi-value options and is appropriately placed in the test_only_params array alongside other coverage-related options.


477-479: LGTM! Correct implementation with proper CLI precedence.

The implementation correctly assigns the CLI-provided patterns to ctx.test_options.coverage.ignore_patterns. The empty check before assignment is good practice, and the unconditional override behavior aligns with the PR objectives that CLI options should take precedence over bunfig.toml configuration.

The pattern is consistent with other similar options in the codebase (--filter, --main-fields, --env-file).


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant