-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
data-testid
being stripped in test/local env in latest 12.1.6
#36651
Comments
Maybe related to the issues being experienced in #36647 |
Confirmed it fails in |
data-testid
being stripped in test env in latest 12.1.6data-testid
being stripped in test/local env in latest 12.1.6
This is because |
Hey @timneutkens, can I work on the issue? should I change the |
The issue should be fixed by #36922 In the meantime, you can apply a temporary fix in your // next.config.js
module.exports = {
compiler: {
- reactRemoveProperties: true
+ reactRemoveProperties: process.env.NODE_ENV === 'production'
}
} |
## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes #36651. Always disable `reactRemoveProperties` in `next/jest` transformation.
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. |
Verify canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022
Binaries:
Node: 14.18.1
npm: 6.14.15
Yarn: 1.22.18
pnpm: N/A
Relevant packages:
next: 12.1.6
react: 18.1.0
react-dom: 18.1.0
What browser are you using? (if relevant)
Firefox
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
In the latest 12.1.6, running Jest locally with tests that try to locate elements using the
data-testid
attr fail, this works fine in 12.1.5.In my next config I have:
Expected Behavior
data-testid
should only be removed in production env, not local or preview envs.To Reproduce
Create a projec with latest next, jest, and a test that looks for a
data-testid
.The text was updated successfully, but these errors were encountered: