@nx/cypress - Migrations
The @nx/cypress plugin provides various migrations to help you migrate to newer versions of cypress projects within your Nx workspace. Below is a complete reference for all available migrations.
23.0.x
Section titled “23.0.x”remove-experimental-prompt-command
Section titled “remove-experimental-prompt-command”Version: 23.0.0-beta.10
Removes the experimentalPromptCommand flag from cypress.config.{ts,js,mjs,cjs}. The flag was removed in Cypress 15.13.0; cy.prompt is now in beta without configuration.
Requires
Section titled “Requires”| Name | Version |
|---|---|
cypress | >=15.13.0 |
Remove the experimentalPromptCommand Flag from Cypress Config
Section titled “Remove the experimentalPromptCommand Flag from Cypress Config”Removes the experimentalPromptCommand flag from cypress.config.{ts,js,mjs,cjs} files. The flag was removed in Cypress 15.13.0; cy.prompt is now in beta without configuration. Leaving the flag in place causes Cypress to error at startup.
Sample Code Changes
Section titled “Sample Code Changes”Remove experimentalPromptCommand from the top level of defineConfig.
Before
Section titled “Before”import { defineConfig } from 'cypress';
export default defineConfig({ e2e: { baseUrl: 'http://localhost:4200' }, experimentalPromptCommand: true,});import { defineConfig } from 'cypress';
export default defineConfig({ e2e: { baseUrl: 'http://localhost:4200' },});The flag is also removed when nested inside e2e or component.
Before
Section titled “Before”import { defineConfig } from 'cypress';
export default defineConfig({ e2e: { experimentalPromptCommand: true, baseUrl: 'http://localhost:4200', },});import { defineConfig } from 'cypress';
export default defineConfig({ e2e: { baseUrl: 'http://localhost:4200', },});rewrite-internal-subpath-imports
Section titled “rewrite-internal-subpath-imports”Version: 23.0.0-beta.19
Rewrites imports from @nx/cypress/src/* to either the public @nx/cypress entry (for re-exported symbols) or @nx/cypress/internal (for everything else). The ./src/* wildcard was removed from the package’s exports map.
update-23-0-0-migrate-create-nodes-v2-import
Section titled “update-23-0-0-migrate-create-nodes-v2-import”Version: 23.0.0-beta.24
Rename imports of createNodesV2 from @nx/cypress/plugin to the canonical createNodes export.
Rename createNodesV2 imports to createNodes
Section titled “Rename createNodesV2 imports to createNodes”@nx/cypress renamed its primary inferred-plugin export from createNodesV2 to createNodes. The createNodesV2 name is preserved as a deprecated alias for now, but new code should use createNodes.
This migration scans every .ts, .tsx, .cts, and .mts file in your workspace and rewrites named imports and re-exports of createNodesV2 from @nx/cypress/plugin to createNodes.
Sample Code Changes
Section titled “Sample Code Changes”Before
Section titled “Before”import { createNodesV2 } from '@nx/cypress/plugin';import { createNodes } from '@nx/cypress/plugin';Aliases are preserved (createNodesV2 as cn becomes createNodes as cn), and if a file already imports both names ({ createNodes, createNodesV2 }) the redundant binding is dropped.
What is not rewritten
Section titled “What is not rewritten”Only static import/export named bindings from @nx/cypress/plugin are rewritten. Namespace imports, dynamic import(...), require(...) destructuring, and property access such as plugin.createNodesV2 are left untouched — they keep working through the createNodesV2 runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
23.0.0-package-updates
Section titled “23.0.0-package-updates”Version: 23.0.0-beta.10
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
cypress | ^15.14.2 | Updated only |
23.0.0-vite-dev-server-package-updates
Section titled “23.0.0-vite-dev-server-package-updates”Version: 23.0.0-beta.10
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@cypress/vite-dev-server | ^7.3.1 | Updated only |
22.3.x
Section titled “22.3.x”22.3.2-package-updates
Section titled “22.3.2-package-updates”Version: 22.3.2-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
cypress | ^15.8.0 | Updated only |
@cypress/webpack-dev-server | ^5.4.1 | Updated only |
22.1.x
Section titled “22.1.x”rename-cy-exec-code-property
Section titled “rename-cy-exec-code-property”Version: 22.1.0-beta.6
Renames cy.exec().its('code') usages to the new exitCode property introduced in Cypress v15.
Requires
Section titled “Requires”| Name | Version |
|---|---|
cypress | >=15.0.0 |
Rename cy.exec().its('code') to cy.exec().its('exitCode')
Section titled “Rename cy.exec().its('code') to cy.exec().its('exitCode')”Cypress v15 renamed the result property exposed by cy.exec() from code to exitCode. This migration updates Cypress spec files managed by Nx so that assertions such as cy.exec(...).its('code') use the new exitCode property.
Read more in the migration guide.
Examples
Section titled “Examples”Before
Section titled “Before”cy.exec('echo 0').its('code').should('eq', 0);cy.exec('echo 0').its('exitCode').should('eq', 0);update-selector-playground-api
Section titled “update-selector-playground-api”Version: 22.1.0-beta.6
Updates the deprecated Cypress.SelectorPlayground API to Cypress.ElementSelector and removes the unsupported onElement option.
Requires
Section titled “Requires”| Name | Version |
|---|---|
cypress | >=15.0.0 |
Update the Selector Playground API
Section titled “Update the Selector Playground API”Cypress v15 renamed Cypress.SelectorPlayground to Cypress.ElementSelector and removed the deprecated onElement option when calling Cypress.ElementSelector.defaults(). This migration updates existing Cypress support files to use the new API.
Read more in the migration guide.
Examples
Section titled “Examples”Before
Section titled “Before”Cypress.SelectorPlayground.defaults({ selectorPriority: ['data-cy'], onElement: (el) => el,});Cypress.ElementSelector.defaults({ selectorPriority: ['data-cy'],});update-angular-component-testing-support
Section titled “update-angular-component-testing-support”Version: 22.1.0-beta.6
For Angular component testing projects below v18, switches to the fallback @cypress/angular harness required by Cypress v15.
Requires
Section titled “Requires”| Name | Version |
|---|---|
cypress | >=15.0.0 |
Use the fallback Angular component testing harness for Cypress v15
Section titled “Use the fallback Angular component testing harness for Cypress v15”Cypress v15 requires Angular component testing projects running Angular versions below 18 to migrate from the built-in cypress/angular helper to the @cypress/angular harness (v3). This migration updates component testing imports and ensures the correct dependency is installed.
Read more in the migration guide.
Examples
Section titled “Examples”Before
Section titled “Before”import { mount } from 'cypress/angular';import { mount } from '@cypress/angular';22.1.0-package-updates
Section titled “22.1.0-package-updates”Version: 22.1.0-beta.6
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
cypress | ^15.6.0 | Updated only |
@cypress/vite-dev-server | ^7.0.1 | Updated only |
@cypress/webpack-dev-server | ^5.1.4 | Updated only |
21.0.x
Section titled “21.0.x”remove-tsconfig-and-copy-files-options-from-cypress-executor
Section titled “remove-tsconfig-and-copy-files-options-from-cypress-executor”Version: 21.0.0-beta.10
Removes the tsConfig and copyFiles options from the @nx/cypress:cypress executor.
Remove tsConfig and copyFiles Options from Cypress Executor
Section titled “Remove tsConfig and copyFiles Options from Cypress Executor”Removes the previously deprecated and unused tsConfig and copyFiles options from the @nx/cypress:cypress executor configuration in all projects.
Examples
Section titled “Examples”Remove the options from the project configuration:
Before
Section titled “Before”{ "targets": { "e2e": { "executor": "@nx/cypress:cypress", "options": { "cypressConfig": "apps/app1-e2e/cypress.config.ts", "tsConfig": "apps/app1-e2e/tsconfig.json", "copyFiles": "**/*.spec.ts", "devServerTarget": "app1:serve" } } }}{ "targets": { "e2e": { "executor": "@nx/cypress:cypress", "options": { "cypressConfig": "apps/app1-e2e/cypress.config.ts", "devServerTarget": "app1:serve" } } }}Remove the options from a target default using the @nx/cypress:cypress executor:
Before
Section titled “Before”{ "targetDefaults": { "e2e": { "cache": true, "executor": "@nx/cypress:cypress", "options": { "tsConfig": "{projectRoot}/tsconfig.json", "copyFiles": "**/*.spec.ts" } } }}{ "targetDefaults": { "e2e": { "cache": true, "executor": "@nx/cypress:cypress" } }}Remove the options from a target default using the @nx/cypress:cypress executor as the key:
Before
Section titled “Before”{ "targetDefaults": { "@nx/cypress:cypress": { "cache": true, "options": { "tsConfig": "{projectRoot}/tsconfig.json", "copyFiles": "**/*.spec.ts" } } }}{ "targetDefaults": { "@nx/cypress:cypress": { "cache": true } }}