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

Vite and Cypress Component Testing not working with latest deps #19727

Closed
lmiller1990 opened this issue Jan 17, 2022 · 2 comments
Closed

Vite and Cypress Component Testing not working with latest deps #19727

lmiller1990 opened this issue Jan 17, 2022 · 2 comments

Comments

@lmiller1990
Copy link
Contributor

Current behavior

Cannot start basic Cypress and Vite component testing due to errors.

Stack trace:

lachlan-ubuntu% yarn cypress open-ct
yarn run v1.22.11
warning package.json: No license field
$ /home/lachlan/code/dump/cypress-vite/node_modules/.bin/cypress open-ct
[26212:0117/180852.784432:WARNING:vaapi_wrapper.cc(586)] VAAPI video acceleration not available for swiftshader
[26212:0117/180852.784607:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is 
GET /__/ 200 5.657 ms - -
GET /__cypress/runner/cypress_runner.css 200 3.618 ms - -
GET /__cypress/runner/cypress_runner.js 200 1.825 ms - -
GET /__cypress/runner/fonts/mulish-latin-400-normal.woff2 200 2.861 ms - 31176
[26056:0117/180854.683178:INFO:CONSOLE(209081)] "Uncaught TypeError: Cannot read properties of undefined (reading 'emit')", source: http://localhost:3000/__cypress/runner/cypress_runner.js (209081)
GET /__cypress/runner/fonts/fa-solid-900.woff2 200 2.693 ms - 76120
GET /__cypress/runner/fonts/open-sans-latin-400-normal.woff2 200 2.626 ms - 14380
GET /__cypress/runner/fonts/mulish-latin-500-normal.woff2 200 2.977 ms - 31176
[26056:0117/180854.694577:INFO:CONSOLE(209081)] "Uncaught TypeError: Cannot read properties of undefined (reading 'emit')", source: http://localhost:3000/__cypress/runner/cypress_runner.js (209081)
[26056:0117/180854.698133:INFO:CONSOLE(209081)] "Uncaught TypeError: Cannot read properties of undefined (reading 'emit')", source: http://localhost:3000/__cypress/runner/cypress_runner.js (209081)
[26056:0117/180854.698263:INFO:CONSOLE(209081)] "Uncaught TypeError: Cannot read properties of undefined (reading 'emit')", source: http://localhost:3000/__cypress/runner/cypress_runner.js (209081)
[26056:0117/180854.698323:INFO:CONSOLE(209081)] "Uncaught TypeError: Cannot read properties of undefined (reading 'emit')", source: http://localhost:3000/__cypress/runner/cypress_runner.js (209081)
GET /__cypress/iframes//home/lachlan/code/dump/cypress-vite/src/App.cy.ts 200 8.144 ms - 535
GET /__cypress/iframes//home/lachlan/code/dump/cypress-vite/src/App.cy.ts 200 5.069 ms - 535
GET /__cypress/src/@vite/client 200 26.467 ms - -
GET /__cypress/src/node_modules/vite/dist/client/env.mjs 200 2.775 ms - -
[26056:0117/180857.141652:INFO:CONSOLE(184)] "[vite] connecting...", source: http://localhost:3000/__cypress/src/@vite/client (184)
GET /__cypress/src/@fs//home/lachlan/code/dump/cypress-vite/node_modules/@cypress/vite-dev-server/client/initCypressTests.js 200 4.388 ms - -
[26056:0117/180857.185654:INFO:CONSOLE(206)] "[vite] connected.", source: http://localhost:3000/__cypress/src/@vite/client (206)
GET /@fs//home/lachlan/code/dump/cypress-vite/cypress/support/index.js?import 200 20.224 ms - -
GET /__cypress/src/cypress/support/commands.js 200 2.089 ms - 838
6:08:57 pm [vite] Internal server error: Cannot read property 'uid' of undefined
  Plugin: vite:import-analysis
  File: /home/lachlan/code/dump/cypress-vite/src/App.cy.ts
      at Object.statSync (/home/lachlan/.cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:17)
      at isDirectory (/home/lachlan/code/dump/cypress-vite/node_modules/resolve/lib/sync.js:22:23)
      at loadNodeModulesSync (/home/lachlan/code/dump/cypress-vite/node_modules/resolve/lib/sync.js:191:17)
      at Function.resolveSync [as sync] (/home/lachlan/code/dump/cypress-vite/node_modules/resolve/lib/sync.js:98:17)
      at resolveFrom$3 (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:3911:29)
      at resolvePackageData (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:30046:19)
      at /home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:30426:15
      at Array.find (<anonymous>)
      at tryNodeResolve (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:30425:44)
      at Context.resolveId (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:30257:28)
      at Object.resolveId (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:36922:55)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async TransformContext.resolve (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:36721:23)
      at async normalizeUrl (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:73692:34)
      at async TransformContext.transform (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:73834:57)
      at async Object.transform (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:36985:30)
      at async doTransform (/home/lachlan/code/dump/cypress-vite/node_modules/vite/dist/node/chunks/dep-0351185a.js:52057:29)
GET /src/App.cy.ts?import 500 29.009 ms - -
GET /__cypress/runner/fonts/fa-regular-400.woff2 200 1.132 ms - 13600
GET /__cypress/runner/fonts/mulish-latin-700-normal.woff2 200 1.391 ms - 31176
GET /__cypress/iframes//home/lachlan/code/dump/cypress-vite/src/App.cy.ts 200 3.460 ms - 535
GET /__cypress/src/@vite/client 304 2.808 ms - -
GET /__cypress/src/node_modules/vite/dist/client/env.mjs 304 1.905 ms - -
[26056:0117/180906.672474:INFO:CONSOLE(184)] "[vite] connecting...", source: http://localhost:3000/__cypress/src/@vite/client (184)
GET /__cypress/src/@fs//home/lachlan/code/dump/cypress-vite/node_modules/@cypress/vite-dev-server/client/initCypressTests.js 304 3.016 ms - -
[26056:0117/180906.682533:INFO:CONSOLE(206)] "[vite] connected.", source: http://localhost:3000/__cypress/src/@vite/client (206)
GET /@fs//home/lachlan/code/dump/cypress-vite/cypress/support/index.js?import 304 5.620 ms - -

Some projects I can launch Cypress

image

Others I get stuck in the terminal w/ this:

modules/vite/src/node/server/index.ts:579:11)

   cypress/support/index.js:19:44: note: The plugin "vite:dep-scan" was triggered by this import
     19 │ import { setActivePinia, createPinia } from 'pinia'
        ╵                                             ~~~~~~~

Build failed with 1 error:
../../../.cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:16: error: [plugin: vite:dep-scan] Cannot read property 'uid' of undefined
Error: Build failed with 1 error:
../../../.cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:16: error: [plugin: vite:dep-scan] Cannot read property 'uid' of undefined
    at failureErrorWithLog (/home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:1493:15)
    at /home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:1151:28
    at runOnEndCallbacks (/home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:941:63)
    at buildResponseToResult (/home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:1149:7)
    at /home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:1258:14
    at /home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/home/lachlan/code/dump/stepfile-analyzer/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (events.js:375:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at Socket.Readable.push (internal/streams/readable.js:204:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
 > ../../../.cache/Cypress/9.2.1/Cypress/resources/app/packages/server/node_modules/graceful-fs/polyfills.js:303:16: error: [plugin: vite:dep-scan] Cannot read property 'uid' of undefined
    303 │       if (stats.uid < 0) stats.uid += 0x100000000
        ╵                 ^

Desired behavior

Just works

Test code to reproduce

https://github.com/lmiller1990/cypress-vite-problem

Cypress Version

9.2.1

Other

See reproduction, dunno what's going on. It was working in my project last week just fine. Some dependencies changes that broke things, maybe?

@lmiller1990
Copy link
Contributor Author

This is fixed by updating Cypress' graceful-fs to 4.2.9, so this should be fixed by merging https://github.com/cypress-io/cypress/pull/19676/files

@tbiethman
Copy link
Contributor

#19676 has been merged

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

No branches or pull requests

2 participants