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

Fix jest config top level await #3874

Merged
merged 6 commits into from
Dec 12, 2024
Merged

Conversation

busma13
Copy link
Contributor

@busma13 busma13 commented Dec 12, 2024

This PR makes the following changes:

  • Replace top level awaits in all jest.config.ts files with regular imports, as these will throw errors in node 22.12.0.
  • Install patch-package and postinstall-postinstall as root level dev dependencies.
    • patch-package allows for packages within node_modules to be patched.
    • postinstall-postinstall allows for a postinstall hooks to be run after yarn remove, not just yarn or yarn add.
    • Add patch-package as a postinstall hook so any patches will be applied properly.
  • Use patch-package to patch the [email protected] package.json to have a default export compatible with our jest config.
  • Copy patch directory into dockerfile.
  • Remove doc from yarnclean.ci. This line deletes the doc directory in a dependency of patch-package during docker build.

ref: #3871

@busma13 busma13 marked this pull request as ready for review December 12, 2024 19:43
@busma13 busma13 requested review from godber and sotojn December 12, 2024 19:43
.yarnclean.ci Show resolved Hide resolved
Copy link
Contributor

@sotojn sotojn left a comment

Choose a reason for hiding this comment

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

LGTM

@busma13 busma13 requested a review from jsnoble December 12, 2024 21:24
@busma13 busma13 force-pushed the fix-jest-config-top-level-await branch from 2f854ee to 6a07c87 Compare December 12, 2024 22:05
@sotojn sotojn merged commit e4086c1 into master Dec 12, 2024
92 checks passed
@sotojn sotojn deleted the fix-jest-config-top-level-await branch December 12, 2024 22:39
godber pushed a commit that referenced this pull request Dec 16, 2024
This PR makes the following changes:
- In `jest.config.base.js` explicitly set `transformIgnorePatterns` to
the default (`['/node_modules/', '\\.pnp\\.[^\\/]+$']`), which will skip
running transforms on node-modules or pnp files. We were overriding the
default with an empty array. Standard practice is to only transform
specific dependencies if there is a need.
- Remove patch for `unicorn-magic` dependency, as it is no longer being
broken by the jest transform.
- Add README to `./patches` explaining how to make a patch using
`patch-package`. This also prevents the `patches` directory from being
removed if there are no patches, breaking the docker build.

Ref: #3871, #3874
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.

2 participants