Which browser does `cypress run` launch in Cypress 16 without --browser?
answer
- Something ships inside Cypress itself
- It runs when nothing else is chosen
- Cypress 16 now warns about it every run
- One config key removes the fallback
- defaultBrowser or --browser, pick either
basics
~20 sThe bundled Electron browser, unless the project sets defaultBrowser. Electron is deprecated as a test browser in Cypress 16 and will be removed in a future major, so set defaultBrowser or pass --browser to point runs at an installed browser.
solid answer
~40 sWith no `--browser` flag and no `defaultBrowser` in the config, Cypress falls back to the **bundled Electron browser** - a Chromium build shipped inside Cypress itself. Because `cypress run` needs no browser argument, this is the browser most CI jobs have quietly been using. As of Cypress 16 Electron is **deprecated as a test browser**: runs that target it print a deprecation warning, and after removal they will fail outright, whether they named it with `--browser electron`, set `defaultBrowser: 'electron'`, or simply fell back to it. The fix is to install a real browser in the image and make the choice explicit with `defaultBrowser: 'chrome'` and/or `--browser chrome`. Electron is going because its Chromium is tied to the Electron release Cypress bundles, so it trails stable Chrome and behaves differently from what users run.
code
javascript · 11 lines// cypress.config.js
import { defineConfig } from 'cypress'
export default defineConfig({
// without this, a `cypress run` with no --browser falls back to Electron
defaultBrowser: 'chrome',
e2e: {
baseUrl: 'http://localhost:4300',
specPattern: 'cypress/e2e/statements/**/*.cy.js',
},
})go deeper
Know that a Cypress run without a browser flag still picks something, and that the something is the Electron browser bundled inside Cypress rather than a browser on your machine.
Explain the flag-then-config-then-Electron fallback order, why Cypress 16 deprecates Electron, and which single configuration option removes the implicit fallback.
Walk through migrating a pipeline off Electron end to end, including the Docker image that ships no browser and the new failures the engine switch is expected to reveal.
Decide where the browser choice is recorded so it is uniform across repos and local runs, and how you sequence a deprecation like this before the removal forces it.
`cypress run` requires no browser argument, which is convenient and is exactly why so many suites do not know which engine they are testing. In **Cypress 16** the answer is usually Electron, and Cypress 16 is the release that starts telling you to change that. ## The fallback chain 1. `--browser` on the command line, if present. 2. Otherwise the `defaultBrowser` configuration option, if the project sets one. 3. Otherwise the **bundled Electron browser** - a Chromium build shipped inside the Cypress binary itself. Electron is also what makes `cypress run` work in a bare image with no browser installed, which is why the entry-level `cypress/base` Docker image works at all without extra setup. ## How to tell you are on it - The run output names the browser at the top, and in Cypress 16 an Electron run also prints a **deprecation warning**. - From inside a spec, `Cypress.browser.name` is `'electron'`, `family` is `'chromium'`, and `path` is blank because there is no separate binary on disk. - Electron runs headless by default and, unlike the detected browsers, has no release channel of its own to select. - `cypress info` lists the browsers Cypress detected on the machine, which is the quickest way to see whether an agent even has an alternative to fall back from. The dangerous case is not the job that says `--browser electron`; it is the job that says nothing. Grep the repository for Electron and it comes back clean, while every run has been exercising an embedded Chromium nobody chose. ## Why Electron is being removed | | Bundled Electron | An installed Chrome | | --- | --- | --- | | Chromium version | Tied to the Electron release Cypress bundles | Whatever your users' Chrome is | | Update cadence | Moves only when Cypress upgrades Electron | Evergreen, or pinned deliberately | | Behavioural fidelity | An embedded Chromium, diverges in detail | The browser your users actually run | | Install cost | None; it is inside Cypress | Must exist in the image | Cypress 16.0.0 bundles Electron 41.7.0 with Chromium 146.0.7680.216, but that number is a snapshot of one Cypress release, not of the browser your customers use. Standardising on installed browsers means a green run means something about the engines your users have. ## What breaks after removal Until Electron is removed, targeting it keeps working and only warns. After removal, **any** of these fails: - `--browser electron` on the command line. - `defaultBrowser: 'electron'` in the config. - A `{ browser: 'electron' }` override on a `describe` or `it` block. - A job that passes no browser at all and relied on the implicit fallback - the one with nothing in the repo to grep for. ## Migrating a CI job off it 1. **Install a browser** in the local and CI environments. If you use the `cypress/base` Docker image and never installed one, switch to `cypress/browsers` or install a browser yourself; `cypress/base` deliberately ships none. 2. **Set `defaultBrowser`** in `cypress.config.js` so no run can fall back, and/or pass `--browser chrome` wherever Cypress is launched. 3. **Update the CI configuration** for jobs that previously ran with no browser argument. 4. **Remove explicit Electron usage** - flags, `defaultBrowser: 'electron'`, and any per-test `browser` overrides. 5. **Verify** the runs no longer emit the deprecation warning, and that the browser named at the top of the run output is the one you intended. Do the install step first and the config step second. A `defaultBrowser: 'chrome'` in a job whose image has no Chrome turns a warning into a hard launch failure, which is a worse place to discover the missing browser than a local run. Expect the switch to surface new failures on its first run. Tests that quietly depended on the older embedded Chromium - a CSS feature, a timing difference, how an embedded third-party PDF viewer sizes itself - can fail against current Chrome. Those are usually real gaps in coverage you were not getting, not a regression the migration caused, and they are worth fixing rather than pinning around. ## The habit to keep afterwards Name the browser explicitly, in the config rather than in each job. `defaultBrowser` lives with the project and applies everywhere; a `--browser` flag in one pipeline file does not stop a developer's local `cypress run` from using something else. Once the browser is written down, the question of which engine a statement-app suite actually covers has an answer you can read rather than infer.
- How do you find every place a repo still targets Electron in Cypress?Look in four places: `--browser electron` in CI commands and npm scripts, `defaultBrowser: 'electron'` in `cypress.config.js`, `{ browser: 'electron' }` overrides on `describe` or `it` blocks, and any job that runs `cypress run` with no browser argument at all. The last is the easy miss, because nothing in the repository mentions Electron.
- Why does switching a Cypress suite from Electron to Chrome surface new failures?Electron's Chromium is tied to the Electron build Cypress bundles, so it trails stable Chrome and diverges in detail. Specs that quietly depended on that older engine - a CSS feature, a timing difference, how an embedded viewer lays itself out - can fail the first time they meet current Chrome. Those failures are usually coverage you were not getting, not damage the migration did.
The bundled Electron browser is the spare wheel in the boot: it gets a run moving when nothing else is installed, it is not the wheel you drive on, and Cypress 16 has started warning you to fit a real one.
saying these in an interview costs you the question
- Thinks Cypress refuses to run without a --browser flag
- Says Electron is Cypress's recommended CI browser
- Believes Electron matches the Chrome users actually run
- Assumes deleting --browser electron completes the migration
- Thinks the cypress/base image already contains a browser