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 with Vite is failing due to the outdated bundled `graceful-fs` version

See original GitHub issue

Current behavior

Component testing with Vite in new projects doesn’t work. There will be errors like:

[vite] Internal server error: Cannot read properties of undefined (reading 'uid') Failed to fetch dynamically imported module: http://localhost:3001/src/components/__tests__/HelloWorld.spec.js?import

The direct cause is the latest version of resolve. It exposes a bug in older versions of graceful-fs. Because Cypress bundles graceful-fs by itself, there seems no way for users to fix it by themselves.

More technical details is explained at https://github.com/browserify/resolve/issues/264#issuecomment-1006948040

Desired behavior

Update the bundled graceful-fs version to >= 4.2.9

Test code to reproduce

https://github.com/robyedlin/vue3-starter

Cypress Version

9.2.0

Other

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bhvngtcommented, Jan 11, 2022

@ljharb the issue has nothing to do with svelte.

In my case it is getting thrown from the Cypress app bundle. Cypress app bundles graceful-fs from where this error is thrown. Here’s the error snippet that shows the source of the error.

Opening Cypress...
 > ../../../../../Library/Caches/Cypress/9.2.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:16: error: [plugin: vite:dep-scan] Cannot read properties of undefined (reading 'uid')
    303 │       if (stats.uid < 0) stats.uid += 0x100000000
0reactions
cypress-bot[bot]commented, Jan 18, 2022

Released in 9.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v9.3.0, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Component testing with Vite is failing due to the outdated ...
The direct cause is the latest version of resolve . It exposes a bug in older versions of graceful-fs . Because Cypress bundles...
Read more >
cypress failed to fetch dynamically imported module - You.com
During component testing, if I run cypress open-ct , chrome opens fine, ... with Vite is failing due to the outdated bundled `graceful-fs`...
Read more >
Frontend testing standards and style guidelines - GitLab Docs
Frontend testing standards and style guidelines. There are two types of test suites encountered while developing frontend code at GitLab.
Read more >
Testing Vite with minimal config using Vitest - LogRocket Blog
Edit a React component only used on your homepage, for example? Instead of re-bundling your entire site as webpack might, Vite will send...
Read more >
Changelog - Cypress Documentation
Users working in React Component Testing projects can now generate a basic spec ... wizard would fail to run in global mode on...
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