-
Notifications
You must be signed in to change notification settings - Fork 365
Cypress unable to load config file when using cypress-io/github-action@v6 #1408
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
Comments
This issue is unlikely to be caused by Would you like to post your GitHub Actions workflow here? In the logs I can see
which is not the same as "Cypress version: 14.2.0" in the text. |
@MikeMcC399 In that version they turned some features on by default. If we disable them using I can close the issue here and open one on their side. As for the cache log, it was of an earlier run where we were still running with Cypress |
You can subscribe to Cypress releases by selecting the Watch option on https://github.com/cypress-io/cypress. They also get announced in |
This comment has been minimized.
This comment has been minimized.
Pinning the Node version with actions/setup-node doesn't appear to work; the cypress-io/github-action README says:
And upon reviewing some of the previous CI runs with Cypress, the Node version from action/setup-node is not always the same as what cypress says it is using. for example, a run from yesterday:
Found in cache @ /opt/hostedtoolcache/node/20.19.0/x64
Environment details
node: v20.19.0
npm: 10.8.2
yarn: 1.22.22
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 13.15.0 │
│ Browser: Electron 118 (headless) │
│ Node Version: v20.18.0 (/home/runner/runners/2.322.0/externals/node20/bin/node) │
│ Specs: 6 found (********************************************************************) │
│ Searched: cypress/tests/api/**/*.ts │
│ Experiments: experimentalRunAllSpecs=true,experimentalWebKitSupport=true │
└────────────────────────────────────────────────────────────────────────────────────────────────┘ |
"We" are not running anything, merely using whatever Node 20 version the GitHub runner provides. As explained by @achristmascarl, this action runs Cypress using Node 20 with no possibility to override, which would have been handy in this case. As GitHub gradually rolls out the v2.323.0 of their runners, expect more users to have this issue. |
@ThomasTrepanier / @achristmascarl / @AdrienPoupa My apologies for the incorrect assessment of this issue! @achristmascarl / @AdrienPoupa You are entirely correct.
Those repos / organizations where According to https://nodejs.org/docs/latest/api/cli.html#node_optionsoptions
Maybe @ThomasTrepanier could describe exactly how he applied his workaround? |
Warning I found a workaround! Edit: You can fix it by setting the - name: Cypress e2e tests
uses: cypress-io/github-action@v6
with:
browser: chrome
tag: ${{ matrix.app }}
env:
# Add the option below
NODE_OPTIONS: "--no-experimental-require-module --no-experimental-detect-module" We're having a similar issue that just started today - nothing has changed in our repo:
Can someone confirm a workaround with details? Thanks! |
This comment has been minimized.
This comment has been minimized.
For anyone looking for a temporary solution, see my comment above |
Thanks for publishing the workaround! That was what I meant. ❤ |
I can confirm |
The original issue reported here does not have enough information in order to reproduce it exactly, however it is possible to reproduce a similar issue with a TypeScript project:
There is no example like this in this repo and so the issue would not be shown in CI even if GitHub Actions had already rolled out [email protected] to this repo. I set up a test for this in my own fork and I will check when the runner updates (edit: done) and when the next Cypress version is released (edit: still waiting). The breaking change occurs because Node.js backported
|
|
Current statusThe GitHub runner version '2.323.0' is now fully rolled out to GitHub-hosted runners. The following workaround can be applied if the runner image is set to run in Node.js env:
NODE_OPTIONS: "--no-experimental-detect-module --no-experimental-require-module" These are the defaults:
Planned Cypress fix
|
This comment has been minimized.
This comment has been minimized.
I'm seeing [email protected] now available from the npm registry. You may like to try this out and check that your issue is resolved if you remove your previous workaround. No change to |
Closing, as this was an issue with Cypress compatibility with Node.js |
This issue is fixed and worked around - but the cause of this happening again is not. Which is that the node js version of the github runners are used, which is just updated suddenly when github rolls out their new runners. Would it not be better to at least offer the option of setting the node version of the cypress runner to a specific node version itself as well? Tests suddenly failing due to github runner updates are quite nasty to debug, and are disrupting many processes. |
Thank you for your suggestion! Please open a new enhancement request for your suggestion and we can pick it up there. |
If you run Cypress using the command option, you can by-pass using the Cypress Module API and Cypress will run in the chosen Node.js version. Alternatives each have their advantages and disadvantages, which is why I suggested opening a new issue to avoid overloading this closed issue. |
Thanks, will open new issue later today! Command option is an alternative Indeed, with some drawbacks. |
@MikeMcC399 Thank you very much for your time. We will update to [email protected] and let you know if that helped. |
You're very welcome!
It's good to hear what your plans are. Thank you for sharing! |
Problem
Starting around 2pm UTC, our GH Action workflow that runs our Cypress test started failing with the following error:
Root cause investigation
We investigated the following leads, but we kept getting the same error:
Locally
1- Reproduce the issue locally
We weren't able to reproduce the issue locally, even from a freshly cloned repository.
In CI
1- Verify that the
cypress.config.ts
file is validWe couldn't find any unexpected
:
character in the config file itself (config provided below)2- Confirm we didn't change anything related to cypress or CI or the E2E framework on our side
We last changed the config file 2 weeks ago and the workflow had succeeded multiple times since. We haven't change our workflow files or even the E2E tests since the error started.
3- Look into changes to Cypress, this action or plugins we use
There doesn't seem to have been changes to the plugins we use nor this action. Cypress did merge some new drivers this morning but it is unclear if that could be the issue since those drivers are probably not released yet.
4- Updating Cypress to the latest version (
14.2.0
)This led to the same error.
5- Change the extension of the config to
.mts
We tried forcing the file to be loaded as ESM, but the cypress code to load the config always tries to load the config file as a CJS module first (see the implementation here )
6- Change which runners are used by the workflow
We used new runners to try to have a fresh environment for Cypress, but this led to the same error.
Solution
We tried to use the cypress cli to run the tests instead of this action.
We set up the same services, same config file and same spec list to be run with the cypress cli
cypress run
. This worked, the config was parsed properly, and the tests were run successfully.Environment
cypress.config.ts file
Plugins used:
Cypress version: 14.2.0
Package manager: yarn
Node version: 22.14.0
I created the issue in this project since not using this action solved the problem. I wasn't able to find the exact cause for this, but it looks like it's related to this github action.
Thank you for looking into this!
The text was updated successfully, but these errors were encountered: