Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.3.1 requires MessageChannel implementation #521

Closed
eps1lon opened this issue Nov 4, 2019 · 10 comments · Fixed by #522
Closed

9.3.1 requires MessageChannel implementation #521

eps1lon opened this issue Nov 4, 2019 · 10 comments · Fixed by #522
Labels

Comments

@eps1lon
Copy link
Member

eps1lon commented Nov 4, 2019

I just upgraded to 9.3.1 and this is causing my test suite to log the following error:

ERROR: true, '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.'

Is this something I need to worry about? I'm running my tests in Chrome using Karma.

Originally posted by @evoyy in #514 (comment)

@eps1lon
Copy link
Member Author

eps1lon commented Nov 4, 2019

Creating a separate issue to better keep track of it.

This causes errors in Firefox 52 and Safari 10: https://circleci.com/gh/mui-org/material-ui/124896 was built from mui/material-ui#18183

I think the warn logic wasn't properly migrated from warning to console.error.

@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 9.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@whodoeshua
Copy link

Hi, @kentcdodds @eps1lon
I'm testing for react compont by mocha & testing-library. Every thing is working well until I requried esm for mocha. The warning is re-appear and async cleanup will break down testing. Even the testing-library was upgrade to 9.5.0.

Is there any problem or error setting in my project?

ps: the problem will disappear if I stop auto-clean-up.

Here is my demo https://github.com/whodoeshua/mocha-react-testing-library

My environment as follows:

    "jsdom": "^15.2.1",
    "jsdom-global": "^3.0.2",
    "mocha": "^6.2.2",
    "mochawesome": "^4.1.0",

@kentcdodds
Copy link
Member

Hi @whodoeshua.

If you could dig in a little deeper that would be great. Once you have more information, please open a new issue on the subject so we can get it fixed.

@whodoeshua
Copy link

Hi kent.

This issue look like from nodeRequire in flush-microtasks.js.

  // read require off the module object to get around the bundlers.
  // we don't want them to detect a require and bundle a Node polyfill.
  const requireString = `require${Math.random()}`.slice(0, 7)
  const nodeRequire = module && module[requireString]
  // assuming we're in node, let's try to get node's
  // version of setImmediate, bypassing fake timers if any.
  enqueueTask = nodeRequire('timers').setImmediate

nodeRequire will throw a error once esm has been use as follows, then resolve func will not be called and testing will break down by timeout error:

TypeError: Cannot read property 'filename' of undefined
    at C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:252056
    at Object.<anonymous> (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\@testing-library\react\dist

\flush-microtasks.js:27:17)
    at Object.<anonymous> (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:251206)
    at Object.<anonymous> (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:287446)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Object.Ph (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:286187)
    at p (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:287490)
    at kl (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:247562)
    at Object.<anonymous> (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:288137)
    at Object.<anonymous> (C:\Users\egonhui\Desktop\learn\mocha-react-testing-library\node_modules\esm\esm.js:1:228903)

@kentcdodds
Copy link
Member

Cc @threepointone, do you have any ideas here?

@kentcdodds kentcdodds reopened this Mar 14, 2020
@threepointone
Copy link
Contributor

Oh hmm I dunno what the esm implications are. I’ll think about it.

@threepointone
Copy link
Contributor

Should probably file a new issue since it’s not the same thing

@kentcdodds
Copy link
Member

True. @whodoeshua, could you open a new issue about this?

@whodoeshua
Copy link

Sorry for my last response.
#614 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants