cypress-loves-vite icon indicating copy to clipboard operation
cypress-loves-vite copied to clipboard

No component specs found

Open chartinger opened this issue 3 years ago • 5 comments

Context

When following the readme instructions cypress starts, but no component specs are found

Process

yarn yarn cy

Expected result

All spec files are shown in the cypress window to start the tests

Current result

List is empty

Other Results

I tried npm install in a newly cloned project, thus using the current versions instead of a lock file. Now the spec files are found but executing them results in an error

HelloWorld.cy.js:13 Not allowed to load local resource: file:///<localpath>/node_modules/@cypress/vite-dev-server/client/initCypressTests.js
(anonymous) @ HelloWorld.cy.js:13
HelloWorld.cy.js:1 Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: file:///<localpath>/node_modules/@cypress/vite-dev-server/client/initCypressTests.js

Edit: Windows 10, yarn 1.22.10, node 12.13.1, npm 6.12.1

chartinger avatar Apr 14 '21 22:04 chartinger

I'm getting the same error. I'm also on windows. Maybe it's a windows path thing?

Seems like I just need to explicitly set a path somewhere to make the Vite generated source files reference the dev server path rather then a file:// system path.

bjimdar avatar Apr 15 '21 17:04 bjimdar

Sorry guys, yes it was a windows thing. I hope you updated and saw it work on windows too ;)

elevatebart avatar Jul 16 '21 14:07 elevatebart

I'm having this problem for only one test, cypress, vite and react, the rest of the tests are working, what did you update? it is happening randomly.

antoniormrzz avatar Nov 30 '21 21:11 antoniormrzz

@antoniormrzz what message do you see?

  • No component specs found or
  • Not allowed to load local resource:

elevatebart avatar Nov 30 '21 21:11 elevatebart

@elevatebart I see Failed to fetch dynamically imported module: http://localhost:3000/src/FilterMenu/__tests__/FilterMenu.test.tsx?import randomly, for example, right now it's fine on my machine, but throws this on github actions.

antoniormrzz avatar Nov 30 '21 21:11 antoniormrzz