Skip to content

test: keep two tsconfig paths tests off the npm registry - #46033

Open
robobun wants to merge 1 commit into
mainfrom
robobun/cfd560ff/keep-paths-alias-tests-off-registry
Open

robobun wants to merge 1 commit into
mainfrom
robobun/cfd560ff/keep-paths-alias-tests-off-registry

Conversation

@robobun

@robobun robobun commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

  • Two tests ask the configured npm registry for a package on each run. They are "a .d.ts-only alias with no real module still reports the original specifier" in test/js/bun/resolve/resolve.test.ts and "should use custom tsconfig for path resolution" in test/cli/run/tsconfig-override.test.ts.
  • Both fixtures have no node_modules folder, so auto-install is on. The import that the test expects to fail goes to the registry first. The result of the test then depends on the answer of the registry.

Fix

  • Pass --no-install to the two spawns that must fail. runWildcardScript takes optional flags for that.
  • The assertions do not change. Each test expects the same Cannot find package or Cannot find module error as before.
  • Verified: both files pass with bun bd test while a loopback registry logs the requests. On main the log has one request for each file. On this branch it has none.

Background

  • Auto-install: with no node_modules folder up the tree, bun asks the registry for a bare import that it cannot resolve. --no-install turns that off.
  • test/regression/issue/25622.test.ts has the same pattern. test: stop ten regression tests from contacting npm #37401 already changes that file.
  • REVIEW.md says that a test must not contact a live registry.

Behaviour change: none

Both fixtures have no node_modules folder, so auto-install is on. The
import that each test expects to fail was asked of the configured npm
registry first. Pass --no-install to those two spawns.
@robobun

robobun commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 4:15 AM PT - Oct 19th, 2026

✅ @robobun, your commit dd327e570a5e00cf9705c75560a0edb8e7a1020e passed in Build #128783! 🎉


🧪   To try this PR locally:

bunx bun-pr 46033

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

bun-46033 --bun

@robobun

robobun commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

Status of #46033: how the problem was reproduced.

  • Ran each test file with a debug build of main (6bb5dc1) and BUN_CONFIG_REGISTRY set to a loopback server that logs each request and answers 404.
  • test/js/bun/resolve/resolve.test.ts: one request on main, none on this branch. 100 pass, 0 fail both ways.
  • test/cli/run/tsconfig-override.test.ts: one request on main, none on this branch. 8 pass, 0 fail both ways.

@claude claude 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.

LGTM, a two-line hermeticity fix for two negative-case spawns.

What was reviewed:

  • --no-install is a runtime param parsed in src/runtime/cli/Arguments.rs for both bun run <file> and bun <file>; it sets GlobalCache::disable, so resolution falls through to the normal "Cannot find module" / "Cannot find package" error the assertions already check.
  • The ...flags splice in runWildcardScript matches the existing [bunExe(), ...flags, "index.js"] pattern in test/cli/run/run-autoinstall.test.ts; the other callers pass no flags and are unchanged.
  • The sibling negative test at test/js/bun/resolve/resolve.test.ts:1757 imports #feature (a package.json subpath import), which is not an npm package name and never reaches auto-install, so it does not need the flag.
Extended reasoning...

The diff touches only two test files: it adds --no-install to one Bun.spawn command in test/cli/run/tsconfig-override.test.ts and adds a variadic flags parameter to the runWildcardScript helper in test/js/bun/resolve/resolve.test.ts, used by a single call site. No production code, security-sensitive surface, or assertion text changes. Both affected imports (@ helpers/math, types-only) are valid npm package names in fixtures without node_modules, so auto-install would otherwise contact the registry; with the flag the resolver's global_cache.can_use gate is false and the same resolution error is produced. The change is small, follows an existing in-tree pattern, and the one undrained-stdout pipe in the tsconfig-override test is pre-existing and not touched here.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: oven-sh/bun/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ce0187ca-0afe-4cbf-aaa8-bb4b9de7a041
📥 Commits

Reviewing files that changed from the base of the PR and between 91e7e3b and dd327e5.

📒 Files selected for processing: 2
  • test/cli/run/tsconfig-override.test.ts
  • test/js/bun/resolve/resolve.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Two test fixtures now use --no-install to avoid auto-install prompts. The wildcard-script helper accepts optional CLI flags and places them before the entry path.

Changes

Fixture command behavior

Layer / File(s) Summary
Test command flags
test/js/bun/resolve/resolve.test.ts, test/cli/run/tsconfig-override.test.ts
runWildcardScript accepts optional flags and places them before the entry path. The affected fixtures pass --no-install; comments note that the fixtures lack node_modules and otherwise prompt an npm registry request.

Suggested reviewers: jarred-sumner

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to dd327

The test-only change prevents these expected-failure fixtures from triggering registry installs while preserving their assertions; no actionable merge risk remains.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing two tsconfig paths tests from contacting the npm registry.
Description check Passed The description explains the problem, the fix, verification results, background, and behavior impact. It does not use the template headings exactly, but it provides the required information and is com…
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.
Full details: Description check

Explanation

The description explains the problem, the fix, verification results, background, and behavior impact. It does not use the template headings exactly, but it provides the required information and is complete.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

This branch has not been deployed

No deployments
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.

1 participant