cypress: Cypress Github Action and Vite config import all of a sudden failing in CI/CD runs
Current behavior
Four days ago we had complete support when using the Cypress GH action and everything was working as expected. Then, the next day, a run that changed nothing in relation to any of the aforementioned files, started failing (and every subsequent run after that):
When digging into the error, this is what weβre seeing:
Test run fine and as expected when run locally, only in GHA do they fail in this manner.
Desired behavior
This is the last run that was successful and the logging that was produced in the same spot:
Test code to reproduce
Unfortunately as this is in a CI/CD run, I donβt have a repro.
Cypress Version
14.2.0
Node version
22.13.0
Operating System
ubuntu-latest
Debug Logs
Run cypress-io/github-action@v6
with:
component: true
install: false
record: false
publish-summary: true
Skipping install because install parameter is false
It looks like this is your first time using Cypress: 13.17.0
[STARTED] Task without title.
[SUCCESS] Task without title.
Opening Cypress...
DevTools listening on ws://127.0.0.1:39921/devtools/browser/edb7e2c6-1894-491c-99f3-04b73b473104
(node:2408) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/runner/.cache/Cypress/13.17.0/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
Your configFile is invalid: /home/runner/work/vr-web-ui/vr-web-ui/cypress.config.ts
It threw an error when required, check the stack trace below:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/vr-web-ui/vr-web-ui/vite.config' imported from /home/runner/work/vr-web-ui/vr-web-ui/cypress.config.ts
at finalizeResolution (node:internal/modules/esm/resolve:283:11)
at moduleResolve (node:internal/modules/esm/resolve:952:10)
at defaultResolve (node:internal/modules/esm/resolve:1188:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:347:53)
at new ModuleJobSync (node:internal/modules/esm/module_job:333:34)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:320:11)
at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)
at Module._compile (node:internal/modules/cjs/loader:1511:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1096:12)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
at loadFile (/home/runner/.cache/Cypress/13.17.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:89:14)
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results
Other
This is the code for the quality gate job:
name: Quality Gate
on: push
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install npm dependencies
run: npm ci
- name: Run linters
uses: rkuykendall/lint-action@master
with:
continue_on_error: false
eslint: true
eslint_extensions: 'js,jsx,ts,tsx'
prettier: true
# We can't use this yet as we have too many issues to fix
# tsc: true
# tsc_extensions: 'ts,tsx'
- name: Run component tests
uses: cypress-io/github-action@v6
with:
component: true
install: false
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
@MikeMcC399 Just updated and can confirm that the runs are now passing. Thank you!
@DenisHdz
@MikeMcC399 ah, yep, that is exactly the issue then, iβm seeing
'2.323.0'. Thank you! I will await the fix then as I would rather not make changes that are not long term necessary. our tests failing in CI/CD are not mission critical at the moment as we release every two weeks and I know they work fine locally, so Iβll hold off until the next release of Cypress fixes this. Appreciate the quick response on this from the both of you.For us it works too π thank you!
@DenisHdz
This is the way that all JavaScript GitHub Actions work and it is explained briefly in https://github.com/cypress-io/github-action/blob/master/README.md#usage
The only valid value for runs.using is currently
node20and this forces the use of the Node.js version specified inhttps://github.com/actions/runner/blob/d8b82f44a9ec0258904d5869ae683c31d5aac299/src/Misc/externals.sh#L9
NODE20_VERSION="20.19.0"There is no choice about this version and it is not affected by
actions/setup-nodeIn the case of a Cypress test which does not fail to load the Cypress config file, the Node.js version is shown in the Cypress test summary
I could not find anywhere in the logs (not even if debug is enabled) where the JavaScript Action version of Node.js is shown if the test fails to start because of a config file issue.
@WtfJoke
@reintroducing
Could you please open up your logs and check βCurrent runner versionβ. If you are seeing
2.323.0then you have been bumped to using Node.js20.19.0. The screen shot below shows a repo which has not yet been updated.You can find a workaround in the above issue where other users have successfully applied environment variables