auto cleanup will break down testing in mocha
& esm
environment
#375
Labels
bug
Something isn't working
mocha
& esm
environment
#375
react-hooks-testing-library
version: 3.2.1react-test-renderer
version: 16.9.0react
version: 16.13.1node
version: 10.13.0npm
(oryarn
) version: 6.9.0Relevant 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
The text was updated successfully, but these errors were encountered: