material-ui: makeStyles() crashes in cypress test suite with sheetManager is undefined
When running multiple Cypress tests for several components, makeStyles() crashes when multiple components tests are run in sequence, but passes when only a single component test is run.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Running multiple component tests in Cypress triggers the following error in the test runner’s console, causing tests to fail.
TypeError: The following error originated from your application code, not from Cypress.
> sheetManager is undefined
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
detach makeStyles.js:156
useStyles/</< makeStyles.js:240
useSynchronousEffect/</< makeStyles.js:194
React 2
react-dom.development.js:19504
React 11
unstable_runWithPriority scheduler.development.js:653
React 5
unstable_runWithPriority scheduler.development.js:653
React 3
workLoop scheduler.development.js:597
flushWork scheduler.development.js:552
performWorkUntilDeadline scheduler.development.js:164
(Async: EventHandlerNonNull)
js scheduler.development.js:187
js scheduler.development.js:857
Webpack 74
Expected Behavior 🤔
No console errors, multiple unit tests pass in the same way as running only a single unit test passes.
Steps to Reproduce 🕹
Public Github repository and branch: https://github.com/TheDiveO/lxkns/tree/wip/test-webui
Steps:
- clone branch wip/test-webui
- cd web/lxkns
- yarn run cypress
- click on “Run # component specs”
Context 🔦
It’s not possible to run an automated full test suite.
Your Environment 🌎
Browsers are Firefox 84 and Electron 87
`npx @material-ui/envinfo`
System:
OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
Binaries:
Node: 10.19.0 - /usr/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.6 - /usr/local/bin/npm
Browsers:
Chrome: Not Found
Firefox: 84.0.2
npmPackages:
@material-ui/core: ^4.11.3 => 4.11.3
@material-ui/icons: ^4.9.1 => 4.11.2
@material-ui/lab: ^4.0.0-alpha.56 => 4.0.0-alpha.57
@material-ui/styles: 4.11.3
@material-ui/system: 4.11.3
@material-ui/types: 5.1.0
@material-ui/utils: 4.11.2
@types/react: 17.0.0
react: ^16.13.1 => 16.14.0
react-dom: ^16.13.1 => 16.14.0
typescript: ^4.0.3 => 4.1.3
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (5 by maintainers)
It looks like the crush is not reproducing anymore in your branch. All tests are passing except this hook problem. It looks like this is a cypress problem because the “run x specs” feature is really buggy in cypress right now especially for experimental features.
It passes when running standalone
I also noticed a problem that you are not connecting your webpack config at all, this may lead to the problems
My advice – do not use this feature for development, only run specific specs. Anyway, this feature is removed for the next stable major release of component testing. Here is a little sneak peek of UI for you 😃
I’m looking at your issue now I will comment if i google hold of anything
Also, gentle note this same kind of error happened to me I was working for a week to solve it. So please hang in there