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

Replace esbuild-jest with @swc/jest #1014

Merged
merged 1 commit into from
May 17, 2024
Merged

Replace esbuild-jest with @swc/jest #1014

merged 1 commit into from
May 17, 2024

Conversation

AshCorr
Copy link
Member

@AshCorr AshCorr commented May 17, 2024

Fun fact, esbuild-jest cannot compile/transform tests that have the characters ock( anywhere in the code! This makes it very hard to mock anything with jest.mock()! See aelbore/esbuild-jest#57

What does this change?

Replace esbuild-jest with @swc/jest

Why?

Fun nightmare JS ecosystem fact of the day:

esbuild-jest cannot compile any tests that include the characters ock( in their code! See this issue . This makes it pretty hard to mock anything using jest.mock() 😅

There are workarounds but nothing very pleasant.

Required for #989

How has it been verified?

Ran npm run test in the workspace root. Also ran npm -w cdk run test -- -u to verify snapshots still work.

@AshCorr AshCorr requested review from a team as code owners May 17, 2024 10:35
@AshCorr AshCorr changed the title Replace esbuild-jext with @swc/jest Replace esbuild-jest with @swc/jest May 17, 2024
@AshCorr
Copy link
Member Author

AshCorr commented May 17, 2024

We may want to consider switching to SWC for regular builds too instead of having both esbuild and swc. Not sure how our grafana scenes project will react though.

@akash1810
Copy link
Member

Fun fact, esbuild-jest cannot compile/transform tests that have the characters ock( anywhere in the code! This makes it very hard to mock anything with jest.mock()!

Oh dear!

@AshCorr AshCorr enabled auto-merge May 17, 2024 10:41
Fun fact, `esbuild-jest`cannot compile/transform tests that have the characters `ock(` anywhere in the code!
This makes it very hard to mock anything with `jest.mock()`! See aelbore/esbuild-jest#57
@AshCorr AshCorr merged commit d4975bf into main May 17, 2024
2 checks passed
@AshCorr AshCorr deleted the ash/swc-jest branch May 17, 2024 10:47
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