Skip to content

Fix: The test randomly throws exceptions related to module imports#14575

Closed
liuxingbaoyu wants to merge 2 commits intobabel:mainfrom
liuxingbaoyu:fix-register-test
Closed

Fix: The test randomly throws exceptions related to module imports#14575
liuxingbaoyu wants to merge 2 commits intobabel:mainfrom
liuxingbaoyu:fix-register-test

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu commented May 23, 2022

Q                       A
Fixed Issues? The test randomly throws exceptions related to module imports
Patch: Bug Fix?
Major: Breaking Change? ×
Minor: New Feature? ×
Tests Added + Pass?
Documentation PR Link
Any Dependency Changes? ?
License MIT

This is a Proof Of Concept and needs more discussion.
As I mentioned in #14541 (comment), this issue is best fixed by adding new features in jest-light-runner.

jest-light-runner does not isolate tests, and packages\babel-register\test breaks the node built-in environment.
Causes the remaining tests to randomly throw exceptions related to importing the module.

Maybe there are other issues in babel-register that are contributing to this result, but that doesn't matter.

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented May 23, 2022

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

@liuxingbaoyu liuxingbaoyu changed the title Fix: Tests randomly appear undefined Fix: The test randomly throws exceptions related to module imports May 23, 2022
@nicolo-ribaudo
Copy link
Copy Markdown
Member

What breaks the environment?

Module._cache = oldModuleCache;
should restore everything to the state it was before running the tests.

@liuxingbaoyu
Copy link
Copy Markdown
Member Author

I do not know.
It's so hard to reproduce that I can't debug it.

It's worth mentioning that after applying the patch, I ran the CI 2*50 times without exception!💐

@liuxingbaoyu
Copy link
Copy Markdown
Member Author

Well I still don't understand why the exception appears and why it disappears, but now this PR is no longer needed.

@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 Feb 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
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: Fixes failing main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants