Skip to content

8.0.6 release breaks test in browser  #414

Closed
@jeetiss

Description

@jeetiss

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

travis logs

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'

Снимок экрана 2019-07-26 в 9 40 41

  • 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:

karma config
test

Environment

  • react-testing-library version: 8.0.6
  • react version: 16.8.6
  • node version: 10
  • npm (or yarn) version: 1.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions