Skip to content

Add file URL support for test runners#18002

Merged
JLHwung merged 3 commits into
babel:mainfrom
JLHwung:add-file-url-support-test-helpers
May 16, 2026
Merged

Add file URL support for test runners#18002
JLHwung merged 3 commits into
babel:mainfrom
JLHwung:add-file-url-support-test-helpers

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented May 15, 2026

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we add file URL support for test runners and phase out usage of __dirname in the test files.

@JLHwung JLHwung added area: tests PR: Internal 🏠 A type of pull request used for our changelog categories labels May 15, 2026
@JLHwung JLHwung requested a review from Copilot May 15, 2026 19:08
@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61564

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds file URL support to Babel’s fixture/test runners and updates tests to avoid __dirname-based fixture resolution where possible.

Changes:

  • Allows fixture helpers and transform/process test runners to accept URL instances.
  • Updates parser, generator, CLI/node helper, and ESLint parser tests to pass fixture locations as file URLs.
  • Moves the SystemJS exec-specific test into its own Jest test file using URL-based filename handling.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/babel-helper-fixtures/src/index.ts Accepts URL fixture roots by converting them to filesystem paths.
packages/babel-helper-transform-fixture-test-runner/src/index.ts Accepts URL filenames/fixture dirs for transform and process runners.
packages/babel-helper-plugin-test-runner/src/index.ts Passes fixture roots as URLs and derives package names via fileURLToPath.
packages/babel-parser/test/index.js Uses a file URL for parser fixtures.
packages/babel-parser/test/expressions.js Uses a file URL for expression fixtures.
packages/babel-types/test/fields.js Uses a file URL for parser fixture discovery.
packages/babel-generator/test/index.js Uses a file URL for generator fixtures.
packages/babel-cli/test/helpers/runner.js Passes CLI fixtures as a file URL.
packages/babel-node/test/helpers/runner.js Passes node fixtures as a file URL.
packages/babel-build-external-helpers/test/helpers/runner.js Passes external-helper fixtures as a file URL.
packages/babel-plugin-transform-modules-systemjs/test/index.js Leaves the generic fixture runner entrypoint only.
packages/babel-plugin-transform-modules-systemjs/test/systemjs-exec.test.js Adds the extracted SystemJS exec regression test using URL filenames.
eslint/babel-eslint-parser/test/typescript-estree.test.js Uses URL-based parser fixture roots and URL href comparisons for known failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 15, 2026

Open in StackBlitz

commit: e1b74f8

@JLHwung JLHwung merged commit 0b91d35 into babel:main May 16, 2026
60 checks passed
@JLHwung JLHwung deleted the add-file-url-support-test-helpers branch May 16, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests PR: Internal 🏠 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants