question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component testing - error `Performance.mark: Global object is unavailable`

See original GitHub issue

Current behavior

After modifying cypress config ; When reloading a component test (ie. making a change in a component or in spec file and saving the file) then the error Performance.mark: Global object is unavailable will appear in the spec window:

image

Reloading the page will fix the issue.

Desired behavior

No error

Test code to reproduce

  • Clone repo https://gitlab.com/souf/react-webpack-playground/-/tree/cypress-reload-error using branch cypress-reload-error
  • run yarn install and yarn cypress:open.
  • open component testing for App.
  • change something in the cypress config in /cypress.config.js for example the value of defaultCommandTimeout.
  • open file /src/components/App.jsx change the “Hello” string and save to trigger a reload.

Error message should occur.

Cypress Version

10.4.0

Other

Using react+webpack setup. Only tested on firefox linux

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rachelrudermancommented, Aug 22, 2022

Hi @gsouf, thank you for the detailed steps to reproduce and especially for the clonable repo. I was able to confirm the behavior you reported on both Firefox 101 and Chrome 104. We will now route this to the appropriate team to fix 🎉 🙏

0reactions
gsoufcommented, Aug 16, 2022

@AtofStryker yes I confirm it happens everytime.

  • Modify the config
  • save the config file
  • it works
  • (after you have modified and saved the config) modify the component file
  • save the component file
  • it breaks

I was also able to setup chrome today and I confirm the issue also exists in chrome (google chrome stable downloaded today). But the issue is slightly different. There is no error message but no success message either (see screenshot bellow), nothing in the dev tools console either and at this point the chrome is frozen. You can see the “run all specs button” is still in the “square icon” status. Reloading the page or trying to close browser does not work.

That’s a behavior I have noticed on chrome linux many times when javascript code hangs.

All I can do at this point is to close the cypress process to get chrome to close.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest test fails : TypeError: window.matchMedia is not a ...
In this project, I'm using Jest snapshot testing and got an error TypeError: window.matchMedia is not a function inside my component. I go ......
Read more >
Testing and error handling patterns in Next.js
Check out these different ways to run tests and handle errors in Next.js apps using Cypress, a JavaScript-based testing framework.
Read more >
Component testing scenarios
Error : This test module uses the component BannerComponent which is using a "templateUrl" or "styleUrls", but they were never compiled.
Read more >
Global variables not working in runtime - NI Community
I have written a testing app for integration with a Solartron 1260 and 1287. The problem is that I used some global variables...
Read more >
The 10 Most Common JavaScript Issues Developers Face
That's why JavaScript issues, and finding the mistakes that cause them, are at the ... and all the variables in the closure scope);...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found