-
Notifications
You must be signed in to change notification settings - Fork 231
Description
react-hooks-testing-libraryversion: 3.2.1react-test-rendererversion: 16.9.0reactversion: 16.13.1nodeversion: 10.13.0npm(oryarn) version: 6.9.0
Relevant code or config:
The problem is exactly this:
testing-library/react-testing-library#614
but with this package instead of the react-testing-library
And the solution is the exactly the same (I tested it by hacking the node_modules).
Go into the flush-microtasks.js file and literally change this:
enqueueTask = nodeRequire('timers').setImmediate;
to this:
enqueueTask = nodeRequire.call(module, 'timers').setImmediate
What you did:
Run any mocha test using the react-hooks-testing-library and using esm.
What happened:
The library hangs the mocha tester if you are using esm.
Reproduction:
Run any test at all with this library, mocha and esm.
Problem description:
You get this error message (from flush-microtasks.js):
This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'
It hangs the cleanup (for instance mocha afterEach will never finish).
Suggested solution:
Go into the flush-microtasks.js file and literally change this:
enqueueTask = nodeRequire('timers').setImmediate;
to this:
enqueueTask = nodeRequire.call(module, 'timers').setImmediate