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

Add Jest transformer using next-swc #30811

Closed
timneutkens opened this issue Nov 2, 2021 · 3 comments · Fixed by #30993
Closed

Add Jest transformer using next-swc #30811

timneutkens opened this issue Nov 2, 2021 · 3 comments · Fixed by #30993
Assignees
Labels
SWC Related to minification/transpilation in Next.js.
Milestone

Comments

@timneutkens
Copy link
Member

timneutkens commented Nov 2, 2021

We have to add a Jest transformer that leverages next-swc so that people don't have to opt-out of using next-swc just to transform tests as it generally requires a .babelrc with next/babel in order to compile components correctly.

@timneutkens timneutkens added kind: story SWC Related to minification/transpilation in Next.js. labels Nov 2, 2021
@timneutkens timneutkens added this to the 12.0.x milestone Nov 2, 2021
@adikari
Copy link

adikari commented Nov 5, 2021

Is there ETA on this? Since upgrading to Next12 I am having to disable all my tests.

@styfle styfle modified the milestones: 12.0.x, 12.0.4 Nov 5, 2021
@Thisen
Copy link
Contributor

Thisen commented Nov 8, 2021

Is there ETA on this? Since upgrading to Next12 I am having to disable all my tests.

You can do the following to your jest.config.js:

// ...
transform: {
    "^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
  },
// ...

This will use the next/babel preset, without needing a .babelrc file.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants