cypress: ELECTRON_RUN_AS_NODE fails with --browser chrome

Current behavior

currently when combining ELECTRON_RUN_AS_NODE with --browser chrome in ubuntu with chrome 91 via github actions fails. with the error

We found an invalid configuration value:

Found an error while validating the `browsers` list. Expected `version` to be a non-empty string. Instead the value was: 

`{"name":"electron","channel":"stable","family":"chromium","displayName":"Electron","version":"","path":"","info":"Electron is the default browser that comes with Cypress. This is the default browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses."}`

Running --browser chrome works fine and runs headless in chrome 91

Desired behavior

the should work as described in the docs and version 8 release notes

Test code to reproduce

ELECTRON_RUN_AS_NODE=1 ENVIRONMENT=test cypress run --config-file cypress-listings.json --spec cypress/integration/listings.spec.ts --browser chrome

cypress-listings.json

{
    "baseUrl": "http://localhost:3000",
    "componentFolder": "src/",
    "nodeVersion": "system",
    "reporter": "cypress/reporters/github-actions.js",
    "testFiles": ["**/listing*.spec.ts"],
    "video": false,
    "watchForFileChanges": true
}

Cypress Version

8.0.0

Other

Trying this locally on macos any use of ELECTRON_RUN_AS_NODE produces this seemingly unrelated error

internal/modules/cjs/loader.js:890
  throw err;
  ^

Error: Cannot find module '/Users/username/Library/Caches/Cypress/8.0.0/Cypress.app/Contents/MacOS/Contents/Resources/app/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:887:15)
    at Module._load (internal/modules/cjs/loader.js:732:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 9
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I’ll fix this when I have time. In my repo I’m currently patching cypress to remove the browser validation step. But a PR is definitely in order

I’ve ran into this myself, is there anything I can do to help troubleshooting or point me to the source code for detecting electron version? Shouldn’t electron be pruned from the browser list if ELECTRON_RUN_AS_NODE is used?

EDIT: I’m using cypress 8.3.0

If it impacts priority at all, just an FYI that this is the only blocker preventing Cypress tests from being run on Heroku CI