Skip to content

Conversation

@cacieprins
Copy link
Contributor

@cacieprins cacieprins commented Feb 10, 2026

BREAKING CHANGE: @cypress/code-coverage configuration must now be placed under expose instead of env in your Cypress configuration.

Migrate from Cypress.env() to Cypress.expose()

This PR migrates @cypress/code-coverage's configuration from Cypress.env() to Cypress.expose() in response to the deprecation of Cypress.env() in Cypress v15.10.0. Cypress.env() will be removed in Cypress 16, necessitating this breaking change. For more details about why Cypress has deprecated Cypress.env(), see the official documentation on migrating from Cypress.env() to Cypress.expose().

What Changed

Configuration location: This plugin is now configured via the expose key in your Cypress configuration, rather than the env key.
API access: All internal references to Cypress.env() replaced with Cypress.expose()

Migration

Before:

// cypress.config.js
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  env: {
    codeCoverage: {
      url: 'http://localhost:3000/__coverage__',
      exclude: ['cypress/**/*.*'],
      expectBackendCoverageOnly: true
    },
    sendCoverageBatchSize: 1000,
    coverage: false
  }
})

After:

// cypress.config.js
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  expose: {
    codeCoverage: {
      url: 'http://localhost:3000/__coverage__',
      exclude: ['cypress/**/*.*'],
      expectBackendCoverageOnly: true
    },
    sendCoverageBatchSize: 1000,
    coverage: false
  }
})

CLI usage:

Before

cypress run --env coverage=false

After

cypress run --expose coverage=false

Additional Changes

TypeScript migration: Codebase migrated from JavaScript to TypeScript (see #975)
Test infrastructure: Unit tests migrated from Cypress e2e tests to Vitest (see #974)
Documentation: Updated README with migration guide and all configuration examples
Test apps: All test applications updated to use new configuration format
Dependencies: Updated to require Cypress >=15.10.0 and Node >=20

Impact

Breaking: Existing configurations using env.codeCoverage will no longer work
Compatibility: Requires Cypress >=15.10.0. Requires Node >=20.
Migration path: Clear migration guide provided in README

See the migration guide in the README for detailed migration instructions.


Note

High Risk
Breaking change to how users configure and how the plugin reads runtime configuration, plus significant refactors in support/task code and CI that could impact coverage collection/reporting if any expose/env assumptions are missed.

Overview
BREAKING: Migrates @cypress/code-coverage configuration from env/Cypress.env() to expose/Cypress.expose() (including CLI usage via --expose), and updates docs/examples accordingly with a new 3.x→4.x migration section.

Refactors the plugin implementation to TypeScript/ESM-style imports and updates the runtime hooks/tasks to read config and flags from expose (e.g., codeCoverage, sendCoverageBatchSize, coverage, and task-registration flag). Adds new distributable entrypoints (lib/plugins.ts, lib/use-babelrc.ts) and converts middleware (express, hapi, nextjs) to typed TS while preserving the __coverage__ endpoint behavior.

CI is modernized to Node 22/Cypress orb v6, introduces a build-dist workspace step, restructures test-app verification into a matrix job (plus Windows build+test changes), and ignores per-test-app package-lock.json files.

Written by Cursor Bugbot for commit 2455c9b. This will update automatically on new commits. Configure here.

@cacieprins cacieprins closed this Feb 10, 2026
@cacieprins cacieprins deleted the breaking/cy-expose-config branch February 10, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants