Skip to content

Skip dist/ and build/ by default during bun test discovery - #30284

Closed
robobun wants to merge 14 commits into
mainfrom
farm/8c11945f/default-test-path-ignore-patterns
Closed

robobun wants to merge 14 commits into
mainfrom
farm/8c11945f/default-test-path-ignore-patterns

Conversation

@robobun

@robobun robobun commented May 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

Closes #30282.

bun test walked every non-node_modules directory under the project root. If tsc or a bundler mirrored src/ into build/ or dist/ the copied *.test.* files were picked up alongside the originals, so every test ran twice.

Fix

Scanner now falls back to ["**/dist/**", "**/build/**"] when the user hasn't set pathIgnorePatterns (neither via bunfig.toml nor via --path-ignore-patterns). Any explicit configuration -- including an empty array -- opts out of the defaults, matching Vitest's replace semantics.

Explicit file/directory arguments on the CLI bypass the built-in defaults so bun test ./build/foo.test.ts and bun test ./build keep working. Only the defaults that match the explicit path itself are dropped (tracked in a per-scan bitmask), so bun test ./packages/foo still prunes a nested packages/foo/dist/. User-configured patterns always apply to explicit arguments.

Tests

test/cli/test/path-ignore-patterns.test.ts:

  • skips build/dist by default (and nested variants) -- the core fix
  • user-configured pathIgnorePatterns replaces the defaults
  • empty array opts out of built-in defaults
  • explicit file/directory path bypasses the defaults
  • explicit path still honors user-configured pathIgnorePatterns

All 20 tests pass locally on the debug (ASAN) build; the default-pattern tests fail when the fix is removed.


[review] gate passed · iteration 21 · 8 files touched

fails on main (without fix)
ASAN without fix: 6 FAILED
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/cli/test/path-ignore-patterns.test.ts
bun test v1.4.0 (4d5e632f7)

test/cli/test/path-ignore-patterns.test.ts:
(pass) pathIgnorePatterns > bunfig - single pattern string [313.04ms]
(pass) pathIgnorePatterns > bunfig - array of patterns [288.31ms]
(pass) pathIgnorePatterns > bunfig - glob pattern with ** [282.94ms]
(pass) pathIgnorePatterns > CLI flag - single pattern [282.41ms]
(pass) pathIgnorePatterns > CLI flag - multiple patterns [280.68ms]
(pass) pathIgnorePatterns > bunfig - invalid config type [113.74ms]
(pass) pathIgnorePatterns > bunfig - invalid array item [120.27ms]
(pass) pathIgnorePatterns > bunfig - empty array opts out of built-in defaults [297.14ms]
(pass) pathIgnorePatterns > CLI flag overrides bunfig [285.23ms]
(pass) pathIgnorePatterns > bare directory name pattern prunes entire subtree [280.29ms]
367 |         stdio: [null, null, "pipe"],
368 |       });
369 | 
370 |       const stderr = result.stderr.toString("utf-8");
371 |       expect(stderr).toContain("only.test.ts");
372 |       expect(stderr).not.toConta
... (truncated)

release without fix: all passed
bun test v1.4.0-canary.1 (c577f9e8b)

test/cli/test/path-ignore-patterns.test.ts:
(pass) pathIgnorePatterns > bunfig - single pattern string [66.58ms]
(pass) pathIgnorePatterns > bunfig - array of patterns [20.53ms]
(pass) pathIgnorePatterns > bunfig - glob pattern with ** [24.85ms]
(pass) pathIgnorePatterns > CLI flag - single pattern [24.57ms]
(pass) pathIgnorePatterns > CLI flag - multiple patterns [17.87ms]
(pass) pathIgnorePatterns > bunfig - invalid config type [4.73ms]
(pass) pathIgnorePatterns > bunfig - invalid array item [2.04ms]
(pass) pathIgnorePatterns > bunfig - empty array opts out of built-in defaults [15.27ms]
(pass) pathIgnorePatterns > CLI flag overrides bunfig [20.73ms]
(pass) pathIgnorePatterns > bare directory name pattern prunes entire subtree [32.44ms]
(pass) pathIgnorePatterns > default patterns > skips build by default [20.85ms]
(pass) pathIgnorePatterns > default patterns > skips dist by default [11.63ms]
(pass) pathIgnorePatterns > default patterns > skips build nested by default [17.95ms]
(pass) pathIgnorePatterns > default patterns > skips dist nested by default [11.24ms]
(pass) pathIgnorePatterns > default patterns > user-configured pa
... (truncated)
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/cli/test/path-ignore-patterns.test.ts
bun test v1.4.0 (4d5e632f7)

test/cli/test/path-ignore-patterns.test.ts:
(pass) pathIgnorePatterns > bunfig - single pattern string [313.75ms]
(pass) pathIgnorePatterns > bunfig - array of patterns [291.60ms]
(pass) pathIgnorePatterns > bunfig - glob pattern with ** [289.25ms]
(pass) pathIgnorePatterns > CLI flag - single pattern [284.57ms]
(pass) pathIgnorePatterns > CLI flag - multiple patterns [288.80ms]
(pass) pathIgnorePatterns > bunfig - invalid config type [115.08ms]
(pass) pathIgnorePatterns > bunfig - invalid array item [116.26ms]
(pass) pathIgnorePatterns > bunfig - empty array opts out of built-in defaults [306.80ms]
(pass) pathIgnorePatterns > CLI flag overrides bunfig [288.86ms]
(pass) pathIgnorePatterns > bare directory name pattern prunes entire subtree [295.69ms]
(pass) pathIgnorePatterns > default patterns > skips build by default [291.34ms]
(pass) pathIgnorePatterns > default patterns > skips dist by default [339.46ms]
(pass) pathIgnorePatterns > default patterns > skips buil
... (truncated)

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 1169ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/24] gen bake.{client,server,error}.js
-> bake.client.js, bake.server.js, bake.error.js
[2/24] gen generated_host_exports.rs
generated_host_exports.rs: 93 exports (host=3, lazy=10, generic=80, rust=0); 239 extern-C blocks audited
[3/24] gen cpp.rs (cppbind)
[4/24] gen JS modules (bundle-modules)
Preprocess modules (8541ms)
Bundle modules (40ms)
Postprocesss modules (261ms)
Bundle Functions (758ms)
Generate Code (29ms)

[9.66s] Bundled "src/js" for production
  2626 kb
  197 internal modules
  13 native modules
  91 internal functions across 17 files
[4/10] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m   Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
�[1m�[92m   Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
�[1m�[92m   Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
�[1m�[92m   Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/bori
... (truncated)
diff hotspot
docs/runtime/bunfig.mdx                    |   2 +
 docs/test/configuration.mdx                |  18 +++
 src/bunfig/bunfig.rs                       |   3 +
 src/options_types/context.rs               |   4 +
 src/runtime/cli/Arguments.rs               |   1 +
 src/runtime/cli/test/Scanner.rs            | 101 ++++++++----
 src/runtime/cli/test_command.rs            |  20 ++-
 test/cli/test/path-ignore-patterns.test.ts | 246 ++++++++++++++++++++++++++++-
 8 files changed, 360 insertions(+), 35 deletions(-)

gate history · 3 passed · 0 rejected · iteration 21

evidence per changed file
file                                        reads  edits  tests
docs/runtime/bunfig.mdx                         3      3     45
docs/test/configuration.mdx                     4      4     45
src/bunfig/bunfig.rs                            1      1     46
src/options_types/context.rs                    1      2     46
src/runtime/cli/Arguments.rs                    1      1     46
src/runtime/cli/test/Scanner.rs                30     28     46
src/runtime/cli/test_command.rs                 6      5     46
test/cli/test/path-ignore-patterns.test.ts     10     12     45

@robobun

robobun commented May 5, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 7:49 AM PT - Aug 14th, 2026

✅ Your commit 4d5e632 has passed in Build #95820! 🎉


🧪   To try this PR locally:

bunx bun-pr 30284

That installs a local version of the PR into your bun-30284 executable, so you can run:

bun-30284 --bun

@coderabbitai

coderabbitai Bot commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a TestOptions flag tracking whether pathIgnorePatterns was explicitly configured, propagates that through bunfig and CLI parsing, refactors the scanner to support default vs explicit scanning (bypassing built-in defaults for explicit paths), updates test discovery wiring, updates tests and docs to describe default ignore globs, and tweaks overlay CSS serialization in codegen.

Changes

Test discovery: pathIgnorePatterns behavior

Layer / File(s) Summary
TestOptions flag and CLI parsing
src/options_types/Context.zig, src/options_types/context.rs, src/runtime/cli/Arguments.rs
Adds path_ignore_patterns_configured to TestOptions (Zig + Rust), initializes it to false, and sets it when --path-ignore-patterns is supplied via CLI.
bunfig: mark explicit pathIgnorePatterns
src/bunfig/bunfig.rs
Parser marks path_ignore_patterns_configured = true when pathIgnorePatterns is present in bunfig (string or array, including empty array).
Scanner defaults, modes, and internal scan refactor
src/runtime/cli/test/Scanner.rs
Introduce DEFAULT_PATH_IGNORE_PATTERNS, path_ignore_patterns_are_defaults, ScanMode, scan_internal, and scan_explicit; implement temporary pattern swapping and RAII restoration to conditionally bypass built-in defaults.
TestCommand: apply configured flag and explicit-path scanning
src/runtime/cli/test_command.rs
Use user-provided ignore patterns only when path_ignore_patterns_configured is true (otherwise use scanner defaults) and call scan_explicit for relative/path-like CLI arguments to bypass built-in defaults while preserving user patterns.
Tests and docs
test/cli/test/path-ignore-patterns.test.ts, docs/runtime/bunfig.mdx, docs/test/configuration.mdx
Expanded tests to cover default ignores, opt-out via empty array, user-pattern replacement, and explicit-path scanning; added docs describing default ignore globs (**/dist/**, **/build/**) and override semantics.

Codegen define serialization change

Layer / File(s) Summary
Serialize overlay CSS in define
src/codegen/bake-codegen.ts
Wrap the generated overlay CSS with JSON.stringify(...) when embedding it into Bun.build define values.
  • Suggested reviewers:
    • RiskyMH
    • dylan-conway
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: default exclusion of dist/ and build/ during bun test discovery.
Description check ✅ Passed The description explains the problem, fix, behavior, scope, and verification results, covering the template requirements despite different section headings.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/cli/test/path-ignore-patterns.test.ts`:
- Around line 467-492: Update the test "explicit path still honors
user-configured pathIgnorePatterns" to use a user pattern that does not overlap
built-in defaults: change the bunfig.toml pathIgnorePatterns value to a unique
directory pattern (e.g., ["**/custom_build/**"]) and create the test file under
that directory (e.g., "custom_build/explicit.test.ts"), then call Bun.spawnSync
with that explicit file path ("./custom_build/explicit.test.ts") so the
assertion truly verifies the user-configured pattern is honored; modify the
tempDirWithFiles call, the bunfig.toml content, and the Bun.spawnSync invocation
accordingly while keeping the same assertions checking stderr and exitCode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c3d3c23b-44bb-4b19-a345-5928fdc9c8c3

📥 Commits

Reviewing files that changed from the base of the PR and between b009453 and 54f02a2.

📒 Files selected for processing (8)
  • docs/runtime/bunfig.mdx
  • docs/test/configuration.mdx
  • src/cli/Arguments.zig
  • src/cli/bunfig.zig
  • src/cli/test/Scanner.zig
  • src/cli/test_command.zig
  • src/options_types/Context.zig
  • test/cli/test/path-ignore-patterns.test.ts

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. feat(test): add testPathIgnorePatterns support #25576 - Implements the same testPathIgnorePatterns feature (Scanner ignore_patterns, bunfig parsing, CLI flag) that this PR builds on top of to add default dist//build/ exclusions

🤖 Generated with Claude Code

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/cli/test/path-ignore-patterns.test.ts`:
- Around line 343-375: The current parameterized block uses
test.each([...])("skips %s by default", ...) but must follow the repo guideline
to use describe.each for parameterized suites; change test.each to
describe.each(...) and move the existing assertions into a nested test("skips %s
by default", (_label, duplicatePath) => { ... }) callback so the parameters
drive a describe block while the assertions live in a test; update the
surrounding anonymous function names accordingly and keep the same parameter
tuple and inner logic (references: the existing test.each call and the inner
assertions that check stderr for only.test.ts, duplicate.test.ts, "1 pass", and
exitCode).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c723df2f-e508-493d-baad-149b47230789

📥 Commits

Reviewing files that changed from the base of the PR and between 54f02a2 and c8c6ce4.

📒 Files selected for processing (1)
  • test/cli/test/path-ignore-patterns.test.ts

Comment thread src/runtime/cli/test_command.zig Resolved
robobun pushed a commit that referenced this pull request May 5, 2026
…and #30284 (6-7/8 shards pass, 1-2 fail with exit 2; retries are manual-only per getRetry())
@robobun

robobun commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI red: not this PR

Only failing jobs on build #51785 are the three Windows test-bun shards, all failing on the same file:

test/js/bun/test/parallel/test-http-should-emit-close-when-connection-is-aborted.ts - timeout

All four retries time out on each Windows target. This is the same Windows-only flake that #30217 tried to patch by swapping the client from fetch() + AbortController to a raw net.Socket — closed at @dylan-conway's request in favor of the underlying UV_DISCONNECT root-cause fix.

My changes here are in src/cli/test/Scanner.zig / src/cli/test_command.zig / src/cli/bunfig.zig / src/cli/Arguments.zig / src/options_types/Context.zig (test discovery logic) and test/cli/test/path-ignore-patterns.test.ts. Nothing in this PR touches node:http, fetch, AbortController, Windows sockets, or libuv — the scanner-defaults change is independent of the failing test.

Not pushing a workaround here per the guidance on #30217. Available to rebase once the UV_DISCONNECT fix lands.

@robobun
robobun force-pushed the farm/8c11945f/default-test-path-ignore-patterns branch from c8c6ce4 to 7b67230 Compare May 14, 2026 23:17
Comment thread src/runtime/cli/test/Scanner.zig Resolved
@robobun

robobun commented May 15, 2026

Copy link
Copy Markdown
Collaborator Author

CI red: infra only, diff is green

Build #54499 — only failure is 1/20 shards of debian 13 x64-asan - test-bun (019e292f-9faa-43b5-bc1c-22fbdf47bb6a) with exit_status: -1 and the log ending mid-run at test 50/203 with no test failure output. That is an agent-lost / infra crash, not a test failure.

  • The other 19 debian x64-asan shards all passed (full ASAN matrix green).
  • All other test-bun shards — debian aarch64, debian x64, ubuntu x64/aarch64, alpine (all arches), windows x64/baseline — green.
  • The shards that run test/cli/test/path-ignore-patterns.test.ts all reported 18 pass / 0 fail / 69 expect() calls (confirmed in the previous build #54479 log too).

Already spent my one CI re-roll on the earlier darwin-agents-expired flake. Stopping here so the re-roll isn't abused — needs a maintainer to either merge or kick the agent. Happy to keep iterating if anything concrete surfaces.

@robobun
robobun force-pushed the farm/8c11945f/default-test-path-ignore-patterns branch from 943198f to 473e4f6 Compare May 21, 2026 07:42

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/test/configuration.mdx`:
- Around line 123-130: Update the paragraph that explains the default
pathIgnorePatterns to explicitly state that those defaults only affect test
discovery and do not prevent explicitly supplied CLI file or directory arguments
from running; clarify that providing any explicit pathIgnorePatterns value
(including an empty array) replaces the defaults, but passing files or
directories on the command line (e.g., a file under dist/ or build/) will still
execute the specified tests even when the defaults are in effect. Reference the
symbol pathIgnorePatterns and the CLI/file-or-directory arguments in the note so
readers understand discovery vs explicit invocation behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 13f77f93-6c46-4b59-8da4-87d621492a3a

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3b3ef and 473e4f6.

📒 Files selected for processing (4)
  • docs/runtime/bunfig.mdx
  • docs/test/configuration.mdx
  • src/bunfig/bunfig.rs
  • src/codegen/bake-codegen.ts
💤 Files with no reviewable changes (2)
  • src/codegen/bake-codegen.ts
  • src/bunfig/bunfig.rs

Comment thread docs/test/configuration.mdx Resolved
Comment thread src/runtime/cli/test/Scanner.zig Resolved
Comment thread src/runtime/cli/test/Scanner.zig Resolved
@robobun
robobun force-pushed the farm/8c11945f/default-test-path-ignore-patterns branch from dffb0d7 to 151fc48 Compare June 5, 2026 13:33
@robobun

robobun commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

CI red: infra only, diff is green

Build #60750 at 151fc48b — the one failed job is windows x64-baseline verify-baseline, which aborted while extracting a 0-byte sde.tar.xz (Cannot open the file as archive). That is a corrupted Intel SDE download on the agent, not a test or build failure.

  • Every test-bun shard passed, including debian x64-asan where my test/cli/test/path-ignore-patterns.test.ts runs (19 tests).
  • The bunx.test.ts error annotation was a flaky registry/network retry that passed on re-run — its test-bun job is green.
  • No part of this PR (test-discovery Scanner) touches the baseline-verify path, bunx, or SDE.

Already spent my one CI re-roll earlier in this PR. Leaving this for a maintainer to re-run the baseline job or merge. Ready to rebase again if needed.

@robobun
robobun force-pushed the farm/8c11945f/default-test-path-ignore-patterns branch from 151fc48 to 4af350a Compare June 6, 2026 19:41
@robobun

robobun commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator Author

CI red: unrelated flaky test, diff is green

Build #61170 at 4af350ac (post-rebase) — sole failed job is windows 2019 x64-baseline test-bun, failing on:

test/cli/install/bunx.test.ts > should handle package that requires node 24
expect(exited).toBe(0) — Received: 3

That test runs bunx --bun @angular/cli@latest --help against the live npm registry; exit 3 is Angular CLI's own failure code, so it tracks whatever @angular/cli@latest is today. The same test also flaked on the debian x64-asan shard (passed on retry) and in the previous build #60750, before this rebase. Nothing in this PR (test-discovery Scanner) touches bunx, install, or the registry path.

All other shards green, including the ones running test/cli/test/path-ignore-patterns.test.ts (19 tests). CI re-roll already spent earlier in this PR; leaving for a maintainer to re-run the shard or merge.

@robobun
robobun force-pushed the farm/8c11945f/default-test-path-ignore-patterns branch from 4af350a to 1e56923 Compare June 26, 2026 11:17
@mintlify

mintlify Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
bun 🟢 Ready View Preview Jun 26, 2026, 11:18 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@robobun

robobun commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

CI red: infra only, diff is green

Build #64958 at f993343e — sole failed job is darwin 26 aarch64 test-bun, which never ran a test:

Error: buildkite-agent artifact download timed out after 120s for step 'darwin-aarch64-build-bun'.
Refusing to continue with a partial download (would silently fall back to the wrong binary).

That is the agent failing to download the prebuilt bun binary from the artifact store (S3) within 120s, before any test executes. Pure infra. The only annotation is a flaky warning listing unrelated tests (hot.test.ts, terminal-platform-gaps, fetch-leak, html-rewriter-leak) that passed on retry.

Every other shard is green, including the ones running test/cli/test/path-ignore-patterns.test.ts (now 20 tests). My one CI re-roll was spent earlier in this PR, so I'm not pushing another ci: retrigger. This needs a maintainer to re-run the darwin shard or merge — the diff itself is green.

robobun added 2 commits August 14, 2026 08:41
bun test previously ran any *.test.* file it found — including compiled
copies in dist/ or build/ produced by tsc or a bundler. Every test in
src/ would then execute twice, once from the original and once from the
mirrored output.

Scanner now falls back to `**/dist/**` and `**/build/**` when the
user hasn't set pathIgnorePatterns via bunfig or --path-ignore-patterns.
Any explicit configuration (including an empty array) opts out. Explicit
file/directory arguments on the CLI bypass the defaults — user-supplied
patterns still apply — so `bun test ./build/foo.test.ts` continues to
work.

Closes #30282
Use a unique directory name (user-ignored/) instead of build/ so the
assertion can't pass just because the default **/build/** pattern
happened to match the same path. Addresses coderabbit review.
Comment thread src/bunfig/bunfig.rs Resolved
Comment thread src/options_types/context.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test_command.rs Resolved
Comment thread src/runtime/cli/test_command.rs Resolved
Comment thread src/options_types/context.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
Comment thread src/runtime/cli/test_command.rs Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
The _are_defaults flag guarantees the active slice is the const, so
iterating the const yields &'static [u8] without the unsafe
lifetime-extend; the compiler now enforces what the SAFETY comment
asserted. Also add a positive anchor assertion to the negative-only
user-pattern test so a pre-scanner crash can't satisfy it.
Comment thread src/codegen/bake-codegen.ts Resolved
Comment thread src/runtime/cli/test/Scanner.rs Resolved
The previous narrowing implementation stored a raw pointer to the scanner
in a Drop guard and rebuilt the pattern slice with a lifetime-erasing
from_raw_parts. Later &mut self uses invalidated that pointer under
Stacked Borrows, making the guard's restore write UB under Miri. Track
which default patterns an explicit scan root disables in a u8 mask
recomputed at the start of every scan instead: no unsafe, no restore.

Also drop the bake-codegen OVERLAY_CSS quoting change; main now
auto-quotes raw CSS define values in the build API.
Comment thread src/runtime/cli/test/Scanner.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Closing this PR because it has been inactive for more than 90 days.

@github-actions github-actions Bot closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bun test runs a test twice if it's both present in src and build

1 participant