Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not load root babel.config.js in tests #13087

Merged
merged 2 commits into from Apr 2, 2021

Conversation

nicolo-ribaudo
Copy link
Member

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

While working on the native ESM Babel build (wip implementation: https://github.com/nicolo-ribaudo/babel/tree/native-esm), I had to add some configFile: false to our tests (you can see them for babel-core at nicolo-ribaudo@5d15dc7) because they were accidentally loading the top-level babel.config.js file.

This didn't cause problems so far because our babel.config.js has an ignore entry for packages/*/test/fixtures, but it caused problems for the ESM tests because even if a file is ignored all the plugins/presets are still resolved and require'd.

Also, tests should be isolated so it's better to make sure that they don't accidentally load an unrelated config anyway.

cc @jridgewell If I recall correctly, AMP uses our test runner plugins. I would consider this PR a bugfix, but would it cause problems to AMP?

@nicolo-ribaudo nicolo-ribaudo added area: tests PR: Internal 🏠 A type of pull request used for our changelog categories labels Apr 1, 2021
@babel-bot
Copy link
Collaborator

babel-bot commented Apr 1, 2021

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 1, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c752cbd:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

yeah I'd think we'd only want to apply the config/options from options.json? Do we need to include babelrc: false as well?

Copy link
Member

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

@nicolo-ribaudo
Copy link
Member Author

nicolo-ribaudo commented Apr 2, 2021

Oh well, good to know that this solves a real problem!

@nicolo-ribaudo nicolo-ribaudo merged commit 61e866f into babel:main Apr 2, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the no-configfile-tests branch April 2, 2021 19:57
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: tests outdated A closed issue/PR that is archived due to age. Recommended to make a new issue 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.

None yet

4 participants