Getting an error on CI when running jest --coverage
act(...) is not supported in production builds of React.
80 | describe('sample test', () => {
81 | it('sample', () => {
> 82 | component = render(<SampleComponent />);
| ^
Using:
"@testing-library/react": "^13.3.0",
"jest": "26.6.3",
"jest-environment-jsdom": "26.6.2",
"jest-environment-jsdom-global": "2.0.4",
I don't understand why react-testing-library does not support testing on production. I can't seem to find anything on this.
You can prefix the script that runs jest with NODE_ENV, for example:
env NODE_ENV=test jest --ci
Your CICD process is just triggering the error because the environment variable is set to production. Not actually because the files themselves were compiled in production mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With