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

[next/jest] ensure packages in experimental.transpilePackages get transformed #42964

Closed
1 task done
brkalow opened this issue Nov 15, 2022 · 1 comment · Fixed by #42987
Closed
1 task done

[next/jest] ensure packages in experimental.transpilePackages get transformed #42964

brkalow opened this issue Nov 15, 2022 · 1 comment · Fixed by #42987
Labels
Testing Related to testing with Next.js.

Comments

@brkalow
Copy link
Contributor

brkalow commented Nov 15, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 20.6.0: Mon Aug 29 04:31:06 PDT 2022; root:xnu-7195.141.39~2/RELEASE_X86_64
Binaries:
  Node: 16.13.0
  npm: 8.16.0
  Yarn: 1.22.19
  pnpm: 7.14.0
Relevant packages:
  next: 13.0.3
  eslint-config-next: 12.3.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Packages that are specified in experimental.transpilePackages should also be transformed in a jest environment.

Expected Behavior

I would expect that using a jest config created from next/jest, my test code would "just work" the same as my application code without further configuration. In particular, transformIgnorePatterns should be updated to align with the transpilePackages config.

e.g. if I had this in my next config:

{
  experimental: {
    transpilePackages: ['my-transpiled-package']
  }
}

transformIgnorePatterns would be updated to look like this:

transformIgnorePatterns: ['/node_modules/(?!(my-transpiled-package))']

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/BRKalow/next-transpile-packages-jest

To Reproduce

yarn test
@brkalow brkalow added the bug Issue was opened via the bug report template. label Nov 15, 2022
@balazsorban44 balazsorban44 added Testing Related to testing with Next.js. area: app and removed bug Issue was opened via the bug report template. labels Nov 15, 2022
ijjk added a commit that referenced this issue Nov 16, 2022
fixes #42964

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Bryce Kalow <br.kalow@gmail.com>
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Testing Related to testing with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants