Skip to content

fix(test): exclude the cwd-exclusion pair from the Node and Bun runners - #3500

Merged
kojiwakayama merged 2 commits into
mainfrom
fix/isolate-test-env
Aug 9, 2026
Merged

fix(test): exclude the cwd-exclusion pair from the Node and Bun runners#3500
kojiwakayama merged 2 commits into
mainfrom
fix/isolate-test-env

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

deno task test:node fails on main:

✖ src/testing/cwd-exclusion-a.test.ts
  'test failed'

Both alternate runners decide whether a test is Deno-only by reading that file's own source for Deno.. The cwd-exclusion pair added in #3494 keeps its Deno usage in the helper it imports, so the heuristic missed it, the file ran under Node, and Deno.chdir was undefined.

Named explicitly rather than making the files mention Deno. to satisfy the heuristic. The pair asserts a property of deno test --parallel itself — that test files sharing one process do not share a working directory — so it is Deno-only by subject, not merely by which API it happens to call.

Verification

node ./tests/node/run-tests.mjs 'src/testing/*.test.ts' — fails on main, passes here.

Unrelated pre-existing Node failures remain (src/config/define-config.test.ts fails on main too, without these changes); this PR does not address them.

CI runs neither test:node nor test:bun, which is why the regression survived review — worth considering separately.

Summary by CodeRabbit

  • Tests
    • Updated test selection so current runtime-incompatible working-directory exclusion tests are skipped during Bun and Node test runs.
    • Added explanatory comments documenting the test exclusion rationale.

Both runners decide whether a test is Deno-only by reading that file's own
source for `Deno.`. The cwd-exclusion pair keeps its Deno usage in the helper
it imports, so the heuristic missed it and `deno task test:node` began failing
on `Deno.chdir` being undefined.

Named explicitly rather than by making the files mention `Deno.` to satisfy the
heuristic: the pair asserts a property of `deno test --parallel` itself -- that
test files sharing one process do not share a working directory -- so it is
Deno-only by subject and not merely by which API it happens to call.

CI runs neither task, which is why this survived review.
@kojiwakayama
kojiwakayama requested a review from kwakayama as a code owner August 9, 2026 11:36
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c2f592c3-2761-4778-a7ad-a24f5c13bc66

📥 Commits

Reviewing files that changed from the base of the PR and between c55b93d and 62efdc2.

📒 Files selected for processing (5)
  • extensions/ext-bundler-esbuild/src/es-module-lexer.ts
  • tests/bun/run-tests.mjs
  • tests/deno-only-tests.mjs
  • tests/node/run-tests.mjs
  • tests/runtime-test-filters.test.ts
📝 Walkthrough

Walkthrough

The test runners now exclude cwd-exclusion-*.test.ts from Bun and Node/Deno runs. The Node runner documents the Deno-specific process behavior behind the exclusion.

Changes

Runtime-specific test filters

Layer / File(s) Summary
Update runtime test exclusions
tests/bun/run-tests.mjs, tests/node/run-tests.mjs
The Bun and Node test runners exclude src/testing/cwd-exclusion-*.test.ts. The Node runner documents the Deno-specific rationale.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: kwakayama

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes excluding the cwd-exclusion tests from the Node and Bun runners.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/isolate-test-env

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@tests/node/run-tests.mjs`:
- Around line 47-56: Add focused coverage in both tests/node/run-tests.mjs
(lines 47-56) and tests/bun/run-tests.mjs (lines 48-52) for the runtime filters:
verify src/testing/cwd-exclusion-a.test.ts and
src/testing/cwd-exclusion-b.test.ts are excluded while an unrelated test remains
eligible. Ensure the assertions cover the Deno-only filename filter
independently of the source-based Deno. usage heuristic.
🪄 Autofix

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d5ff3498-8f36-4244-9ff0-83a3e80143a6

📥 Commits

Reviewing files that changed from the base of the PR and between a46ead2 and c55b93d.

📒 Files selected for processing (2)
  • tests/bun/run-tests.mjs
  • tests/node/run-tests.mjs

Comment thread tests/node/run-tests.mjs Outdated
The reviewer asked for coverage on both runners' filters, which the exclusion
had none of: it was a literal in each runner, duplicated, and nothing noticed
if it stopped matching. Renaming the pair or moving it out of `src/testing/`
would leave a pattern matching nothing and `deno task test:node` would fail
again, which is the regression this list was added for.

The patterns move to `tests/deno-only-tests.mjs`, imported by both runners so
they cannot drift, and `tests/runtime-test-filters.test.ts` asserts both
directions: the pair is excluded, and its neighbours -- including
`cwd.test.ts`, which shares a prefix -- stay eligible. Both halves matter; a
filter that excludes too much shrinks the suite silently. Checked against a
list emptied and a pattern widened, and it fails on each.

Also fixes an unrelated Deno-only import that made `deno task test:bun` fail
before it reached any of this: `extensions/ext-bundler-esbuild` wrote
`npm:es-module-lexer@2.3.1` inline while its own deno.json already maps the
bare specifier, as it does for esbuild. Only Deno resolves the inline form.
@kojiwakayama
kojiwakayama enabled auto-merge August 9, 2026 11:55
@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 9317de8 Aug 9, 2026
31 checks passed
@kojiwakayama
kojiwakayama deleted the fix/isolate-test-env branch August 9, 2026 12:09
@kwakayama kwakayama mentioned this pull request Aug 9, 2026
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