Skip to content

test: complete example plugins migration to v10+#926

Merged
AtofStryker merged 3 commits intocypress-io:masterfrom
MikeMcC399:migrate/plugins
Jun 1, 2023
Merged

test: complete example plugins migration to v10+#926
AtofStryker merged 3 commits intocypress-io:masterfrom
MikeMcC399:migrate/plugins

Conversation

@MikeMcC399
Copy link
Copy Markdown
Collaborator

Since the Plugins file is deprecated in Cypress 10+, this PR updates:

to move the previously migrated Cypress v9 contents of cypress/plugins/index.js into cypress.config.js instead of requiring it. The deprecated cypress/plugins/index.js file is then deleted. This is done for each of the above examples.

This makes the file usage consistent with a native Cypress (modern) configuration instead of continuing with a hybrid Legacy configuration / modern configuration left behind by the migration wizard.

Background

Cypress Legacy configuration > Folders / Files for versions 9 and below uses a default pluginsFile of cypress/plugins/index.js.

Cypress (modern) configuration does not include a pluginsFile at all. According to the Cypress documentation setupNodeEvents the Plugins file is deprecated.

The Migrations Guide for Cypress 10.0 > Plugins File Removed explains the details for this change. The migration wizard of Cypress 10.x and 12.x however does not automatically remove the cypress/plugins/index.js. It leaves it in place and integrates it into the modern / configuration. It merely leaves a "TODO" note in cypress.config.js:

  e2e: {
    // We've imported your old cypress plugins here.
    // You may want to clean this up later by importing these.
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
  },

Local Verification

Each of the examples should run successfully locally:

browser

cd examples/browser
npm test

env

cd examples/env
export CYPRESS_environmentName='staging'
npx cypress run -s cypress/e2e/without-env.cy.js
export CYPRESS_host='http://api.dev.local'
export CYPRESS_apiPort='4222'
npx cypress run -s cypress/e2e/spec.cy.js

firefox

cd examples/firefox
npm test

quiet

cd examples/quiet
npm test

GitHub verification

All example workflows should run successfully, including:

@cypress-app-bot
Copy link
Copy Markdown

@MikeMcC399 MikeMcC399 marked this pull request as ready for review May 29, 2023 06:05
@AtofStryker AtofStryker merged commit db16930 into cypress-io:master Jun 1, 2023
@AtofStryker AtofStryker removed their assignment Jun 1, 2023
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 1, 2023

🎉 This PR is included in version 5.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MikeMcC399 MikeMcC399 deleted the migrate/plugins branch June 2, 2023 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants