From 17639cb364b8cc3a2f7debcdae220fa899559c94 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Wed, 11 Dec 2024 11:03:52 -0500 Subject: [PATCH] misc: Remove 'Alternatively you can use CommonJS syntax' comment from scaffolded component supportFile (#30738) * Remove 'Alternatively you can use CommonJS syntax' comment from scaffolded ct supportFile * changelog entry --- cli/CHANGELOG.md | 4 ++++ packages/driver/cypress/support/e2e.js | 17 --------------- packages/scaffold-config/src/supportFile.ts | 6 ------ .../test/unit/supportFile.spec.ts | 21 ------------------- .../cypress/support/component.ts | 3 --- .../cypress/support/e2e.js | 3 --- .../testing/e2e/cypress/support/index.js | 3 --- .../cypress/support/component.js | 3 --- .../no-specs/cypress/support/component.js | 3 --- .../cypress/support/e2e.js | 2 -- .../cypress/support/e2e.js | 3 --- .../cypress/support/e2e.js | 3 --- .../cypress/support/e2e.js | 3 --- .../support/component.js | 3 --- .../cypress/support/e2e.js | 3 --- .../cypress/support/component.js | 3 --- .../cypress/support/e2e.js | 3 --- .../cypress/support/e2e.js | 3 --- .../cypress/support/component.ts | 3 --- .../cypress/support/component.ts | 3 --- .../cypress/support/e2e.ts | 3 --- .../ts-proj-4-5/cypress/support/e2e.ts | 3 --- .../projects/ts-proj-5/cypress/support/e2e.ts | 3 --- .../projects/ts-proj/cypress/support/e2e.ts | 3 --- 24 files changed, 4 insertions(+), 103 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index d3bff4f49f5c..499d4661db1f 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -9,6 +9,10 @@ _Released 12/17/2024 (PENDING)_ - Updated Firefox `userChrome.css` to correctly hide the toolbox during headless mode. Addresses [#30721](https://github.com/cypress-io/cypress/issues/30721). - Fixed an issue loading the `cypress.config.ts` file with Node.js version `22.12.0`. Addresses [#30715](https://github.com/cypress-io/cypress/issues/30715). +**Misc:** + +- Removed a comment from the scaffolded `supportFile` for component tests around CommonJS syntax. Addresses [#23287](https://github.com/cypress-io/cypress/issues/23287). + **Dependency Updates:** - Updated `chai` from `4.2.0` to `4.5.0`. Addressed in [#30737](https://github.com/cypress-io/cypress/pull/30737). diff --git a/packages/driver/cypress/support/e2e.js b/packages/driver/cypress/support/e2e.js index c818f04f6a99..a34ebd818478 100644 --- a/packages/driver/cypress/support/e2e.js +++ b/packages/driver/cypress/support/e2e.js @@ -1,18 +1 @@ -// *********************************************************** -// This example support/e2e.js is processed and -// loaded automatically before your other test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/guides/configuration#section-global -// *********************************************************** - -// Alternatively you can use CommonJS syntax: -// require("./commands") require('./defaults') diff --git a/packages/scaffold-config/src/supportFile.ts b/packages/scaffold-config/src/supportFile.ts index 19f5f7871d8d..c4f2aee9fc52 100644 --- a/packages/scaffold-config/src/supportFile.ts +++ b/packages/scaffold-config/src/supportFile.ts @@ -20,9 +20,6 @@ export function supportFileE2E (language: CodeLanguage['type']) { // Import commands.js using ES2015 syntax: import './commands' - - // Alternatively you can use CommonJS syntax: - // require('./commands') ` } @@ -45,9 +42,6 @@ export function supportFileComponent (language: CodeLanguage['type'], mountModul // Import commands.js using ES2015 syntax: import './commands' - - // Alternatively you can use CommonJS syntax: - // require('./commands') ` const exampleUse = dedent` diff --git a/packages/scaffold-config/test/unit/supportFile.spec.ts b/packages/scaffold-config/test/unit/supportFile.spec.ts index 37bfce49e9d3..e4a73747f5d3 100644 --- a/packages/scaffold-config/test/unit/supportFile.spec.ts +++ b/packages/scaffold-config/test/unit/supportFile.spec.ts @@ -27,9 +27,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from '${mountModule}' Cypress.Commands.add('mount', mount) @@ -61,9 +58,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from '${mountModule}' // Augment the Cypress namespace to include type definitions for @@ -111,9 +105,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from '${mountModule}' Cypress.Commands.add('mount', mount) @@ -145,9 +136,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from '${mountModule}' // Augment the Cypress namespace to include type definitions for @@ -195,9 +183,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from '${mountModule}' // Augment the Cypress namespace to include type definitions for @@ -244,9 +229,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from 'cypress/svelte' Cypress.Commands.add('mount', mount) @@ -278,9 +260,6 @@ describe('supportFileComponent', () => { // Import commands.js using ES2015 syntax: import './commands' - // Alternatively you can use CommonJS syntax: - // require('./commands') - import { mount } from 'cypress/svelte' // Augment the Cypress namespace to include type definitions for diff --git a/system-tests/projects/angular-cli-configured/cypress/support/component.ts b/system-tests/projects/angular-cli-configured/cypress/support/component.ts index 96e1d279839c..496890f98562 100644 --- a/system-tests/projects/angular-cli-configured/cypress/support/component.ts +++ b/system-tests/projects/angular-cli-configured/cypress/support/component.ts @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/angular' // Augment the Cypress namespace to include type definitions for diff --git a/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js b/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js +++ b/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/migration-e2e-custom-supportFile/src/platform/testing/e2e/cypress/support/index.js b/system-tests/projects/migration-e2e-custom-supportFile/src/platform/testing/e2e/cypress/support/index.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/migration-e2e-custom-supportFile/src/platform/testing/e2e/cypress/support/index.js +++ b/system-tests/projects/migration-e2e-custom-supportFile/src/platform/testing/e2e/cypress/support/index.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/no-specs-vue-2/cypress/support/component.js b/system-tests/projects/no-specs-vue-2/cypress/support/component.js index 3d1a3d225bb1..2d7d3ce55001 100644 --- a/system-tests/projects/no-specs-vue-2/cypress/support/component.js +++ b/system-tests/projects/no-specs-vue-2/cypress/support/component.js @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/vue2' Cypress.Commands.add('mount', mount) diff --git a/system-tests/projects/no-specs/cypress/support/component.js b/system-tests/projects/no-specs/cypress/support/component.js index be20eaa89ea2..6501bab5dc25 100644 --- a/system-tests/projects/no-specs/cypress/support/component.js +++ b/system-tests/projects/no-specs/cypress/support/component.js @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/react' Cypress.Commands.add('mount', mount) diff --git a/system-tests/projects/plugin-code-coverage/cypress/support/e2e.js b/system-tests/projects/plugin-code-coverage/cypress/support/e2e.js index cfb691980e17..4db62f4dd27b 100644 --- a/system-tests/projects/plugin-code-coverage/cypress/support/e2e.js +++ b/system-tests/projects/plugin-code-coverage/cypress/support/e2e.js @@ -15,5 +15,3 @@ // Import commands.js using ES2015 syntax: import '@cypress/code-coverage/support' -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js b/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js +++ b/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js b/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js +++ b/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/plugin-returns-invalid-browser/cypress/support/e2e.js b/system-tests/projects/plugin-returns-invalid-browser/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/plugin-returns-invalid-browser/cypress/support/e2e.js +++ b/system-tests/projects/plugin-returns-invalid-browser/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/pristine-cjs-project/expected-cypress-js-component-vue.js-3-webpack/support/component.js b/system-tests/projects/pristine-cjs-project/expected-cypress-js-component-vue.js-3-webpack/support/component.js index b234fad4473b..07bc139bbacb 100644 --- a/system-tests/projects/pristine-cjs-project/expected-cypress-js-component-vue.js-3-webpack/support/component.js +++ b/system-tests/projects/pristine-cjs-project/expected-cypress-js-component-vue.js-3-webpack/support/component.js @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/vue' Cypress.Commands.add('mount', mount) diff --git a/system-tests/projects/pristine-module/expected-cypress-js-e2e/cypress/support/e2e.js b/system-tests/projects/pristine-module/expected-cypress-js-e2e/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/pristine-module/expected-cypress-js-e2e/cypress/support/e2e.js +++ b/system-tests/projects/pristine-module/expected-cypress-js-e2e/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/pristine/expected-cypress-js-component-create-react-app-v5/cypress/support/component.js b/system-tests/projects/pristine/expected-cypress-js-component-create-react-app-v5/cypress/support/component.js index 0740174745b6..c837ed536576 100644 --- a/system-tests/projects/pristine/expected-cypress-js-component-create-react-app-v5/cypress/support/component.js +++ b/system-tests/projects/pristine/expected-cypress-js-component-create-react-app-v5/cypress/support/component.js @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/react' Cypress.Commands.add('mount', mount) diff --git a/system-tests/projects/pristine/expected-cypress-js-e2e-without-fixtures/cypress/support/e2e.js b/system-tests/projects/pristine/expected-cypress-js-e2e-without-fixtures/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/pristine/expected-cypress-js-e2e-without-fixtures/cypress/support/e2e.js +++ b/system-tests/projects/pristine/expected-cypress-js-e2e-without-fixtures/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/pristine/expected-cypress-js-e2e/cypress/support/e2e.js b/system-tests/projects/pristine/expected-cypress-js-e2e/cypress/support/e2e.js index d1dd1353e812..92e5881f4078 100644 --- a/system-tests/projects/pristine/expected-cypress-js-e2e/cypress/support/e2e.js +++ b/system-tests/projects/pristine/expected-cypress-js-e2e/cypress/support/e2e.js @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5-without-fixtures/cypress/support/component.ts b/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5-without-fixtures/cypress/support/component.ts index d7870eef01f3..ffc13665d98c 100644 --- a/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5-without-fixtures/cypress/support/component.ts +++ b/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5-without-fixtures/cypress/support/component.ts @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5/cypress/support/component.ts b/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5/cypress/support/component.ts index 697e105d1a3c..e1621ac97076 100644 --- a/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5/cypress/support/component.ts +++ b/system-tests/projects/pristine/expected-cypress-ts-component-create-react-app-v5/cypress/support/component.ts @@ -16,9 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' -// Alternatively you can use CommonJS syntax: -// require('./commands') - import { mount } from 'cypress/react' // Augment the Cypress namespace to include type definitions for diff --git a/system-tests/projects/pristine/expected-cypress-ts-e2e/cypress/support/e2e.ts b/system-tests/projects/pristine/expected-cypress-ts-e2e/cypress/support/e2e.ts index ed5730de1148..c90b6b6d3e07 100644 --- a/system-tests/projects/pristine/expected-cypress-ts-e2e/cypress/support/e2e.ts +++ b/system-tests/projects/pristine/expected-cypress-ts-e2e/cypress/support/e2e.ts @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/ts-proj-4-5/cypress/support/e2e.ts b/system-tests/projects/ts-proj-4-5/cypress/support/e2e.ts index 503f34fc155a..d96d8bd77cda 100644 --- a/system-tests/projects/ts-proj-4-5/cypress/support/e2e.ts +++ b/system-tests/projects/ts-proj-4-5/cypress/support/e2e.ts @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: // import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/ts-proj-5/cypress/support/e2e.ts b/system-tests/projects/ts-proj-5/cypress/support/e2e.ts index 503f34fc155a..d96d8bd77cda 100644 --- a/system-tests/projects/ts-proj-5/cypress/support/e2e.ts +++ b/system-tests/projects/ts-proj-5/cypress/support/e2e.ts @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: // import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/ts-proj/cypress/support/e2e.ts b/system-tests/projects/ts-proj/cypress/support/e2e.ts index ed5730de1148..c90b6b6d3e07 100644 --- a/system-tests/projects/ts-proj/cypress/support/e2e.ts +++ b/system-tests/projects/ts-proj/cypress/support/e2e.ts @@ -15,6 +15,3 @@ // Import commands.js using ES2015 syntax: import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands')