Closed
Description
What you did:
I'm run test react components with @testing-library/react in puppeteer with karma
What happened:
after update to 8.0.6
test fails with:
HeadlessChrome 77.0.3844 (Mac OS X 10.14.6) ERROR
Uncaught ReferenceError: require is not defined
at test/index.js:18318:17
ReferenceError: require is not defined
at test/index.js:18318:17
at test/index.js:40482:2
with 8.0.5
tests works
Problem description:
- before run test in browser i'm bundle them with rollup
- rollup don't support mixed imports and require and don't bundle 'react-dom/test-utils'
- test fails because require not defined in browser
Suggested solution:
don't use mixed imports and require
https://github.com/testing-library/react-testing-library/blob/master/src/act-compat.js#L3-L5
or
put back try catch
block
https://github.com/testing-library/react-testing-library/pull/407/files#diff-eed96c92b94e7db3aebd8867fb75ce2fL8
Relevant code or config:
Environment
react-testing-library
version: 8.0.6react
version: 16.8.6node
version: 10npm
(oryarn
) version: 1.17