diff --git a/.eslintignore b/.eslintignore index 18224f7f50..c2513c0fc6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -22,7 +22,8 @@ system-tests/projects/**/static/* system-tests/projects/**/*.jsx system-tests/projects/**/fail.js system-tests/lib/scaffold/plugins/index.js -system-tests/lib/scaffold/support/index.js +system-tests/lib/scaffold/support/e2e.js +system-tests/lib/scaffold/support/component.js system-tests/lib/scaffold/support/commands.js system-tests/test/support/projects/e2e/cypress/ system-tests/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js diff --git a/circle.yml b/circle.yml index f682311c8e..1ad8313e8b 100644 --- a/circle.yml +++ b/circle.yml @@ -813,6 +813,13 @@ commands: rm -rf cypress.json echo 'module.exports = {}' > cypress.config.js fi + - run: + name: Rename support file + working_directory: /tmp/<> + command: | + if [[ -f cypress/support/index.js ]]; then + mv cypress/support/index.js cypress/support/e2e.js + fi - run: name: Print Cypress version working_directory: /tmp/<> @@ -1681,7 +1688,7 @@ jobs: steps: - clone-repo-and-checkout-branch: repo: cypress-example-kitchensink - pull_request_id: 510 + pull_request_id: 523 - install-required-node - run: name: Remove cypress.json @@ -1933,6 +1940,10 @@ jobs: }, }, }" > cypress.config.ts + - run: + name: Rename support file + working_directory: <> + command: mv cypress/support/index.ts cypress/support/e2e.js - run: name: Run project tests 🗳 working_directory: <> @@ -2003,7 +2014,7 @@ jobs: - test-binary-against-repo: repo: cypress-example-kitchensink browser: "electron" - pull_request_id: 510 + pull_request_id: 523 test-binary-against-awesome-typescript-loader: <<: *defaults @@ -2011,6 +2022,7 @@ jobs: - test-binary-against-repo: repo: cypress-test-awesome-typescript-loader browser: "electron" + pull_request_id: 7 test-binary-against-kitchensink-firefox: <<: *defaults @@ -2019,7 +2031,7 @@ jobs: - test-binary-against-repo: repo: cypress-example-kitchensink browser: firefox - pull_request_id: 510 + pull_request_id: 523 test-binary-against-kitchensink-chrome: <<: *defaults @@ -2028,7 +2040,7 @@ jobs: - test-binary-against-repo: repo: cypress-example-kitchensink browser: chrome - pull_request_id: 510 + pull_request_id: 523 test-binary-against-todomvc-firefox: <<: *defaults @@ -2120,6 +2132,10 @@ jobs: command: | rm -rf cypress.json echo 'module.exports = {}' > cypress.config.js + - run: + name: Rename support file + working_directory: test-binary + command: mv cypress/support/index.js cypress/support/e2e.js - run: name: Verify Cypress binary working_directory: test-binary diff --git a/cli/schema/cypress.schema.json b/cli/schema/cypress.schema.json index d89a90d338..1eb9c7afa7 100644 --- a/cli/schema/cypress.schema.json +++ b/cli/schema/cypress.schema.json @@ -147,7 +147,7 @@ "string", "boolean" ], - "default": "cypress/support/index.js", + "default": "cypress/support/e2e.js", "description": "Path to file to load before test files load. This file is compiled and bundled. (Pass false to disable)" }, "videosFolder": { diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 723c7a33c1..95d410b184 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -2742,7 +2742,7 @@ declare namespace Cypress { screenshotsFolder: string | false /** * Path to file to load before test files load. This file is compiled and bundled. (Pass false to disable) - * @default "cypress/support/index.js" + * @default "cypress/support/{e2e|component}.js" */ supportFile: string | false /** @@ -5476,7 +5476,7 @@ declare namespace Cypress { ``` // likely want to do this in a support file // so it's applied to all spec files - // cypress/support/index.js + // cypress/support/{e2e|component}.js Cypress.on('uncaught:exception', (err, runnable) => { // returning false here prevents Cypress from diff --git a/npm/angular/README.md b/npm/angular/README.md index 82358a40ca..a7bc501f41 100644 --- a/npm/angular/README.md +++ b/npm/angular/README.md @@ -14,7 +14,7 @@ Ensure you have a version of Cypress > 7. Add the following to your support file: ```js -// cypress/support/index.js +// cypress/support/component.js // core-js 3.* require('core-js/es/reflect'); // core-js 2.* @@ -159,7 +159,7 @@ module.exports = { - Then add the code below to your supportFile and pluginsFile ```javascript -// cypress/support/index.js +// cypress/support/component.js import '@cypress/code-coverage/support'; // cypress/plugins/index.js module.exports = (on, config) => { diff --git a/npm/angular/cypress.config.ts b/npm/angular/cypress.config.ts index fb594754dd..6629b27dba 100644 --- a/npm/angular/cypress.config.ts +++ b/npm/angular/cypress.config.ts @@ -8,6 +8,7 @@ export default defineConfig({ 'projectId': 'nf7zag', 'component': { 'specPattern': 'src/app/**/*cy-spec.ts', + 'supportFile': 'cypress/support/component.ts', setupNodeEvents (on, config) { return require('./cypress/plugins')(on, config) }, diff --git a/npm/angular/cypress/support/index.ts b/npm/angular/cypress/support/component.ts similarity index 100% rename from npm/angular/cypress/support/index.ts rename to npm/angular/cypress/support/component.ts diff --git a/npm/create-cypress-tests/__snapshots__/init-component-testing.test.ts.js b/npm/create-cypress-tests/__snapshots__/init-component-testing.test.ts.js index da624fe495..7abdf0a7d7 100644 --- a/npm/create-cypress-tests/__snapshots__/init-component-testing.test.ts.js +++ b/npm/create-cypress-tests/__snapshots__/init-component-testing.test.ts.js @@ -40,6 +40,6 @@ module.exports = (on, config) => { ` -exports['Injected overridden webpack template support/index.js'] = ` +exports['Injected overridden webpack template support/component.js'] = ` import "./commands.js"; ` diff --git a/npm/create-cypress-tests/src/component-testing/init-component-testing.test.ts b/npm/create-cypress-tests/src/component-testing/init-component-testing.test.ts index 0d4182a858..e6c7d58f91 100644 --- a/npm/create-cypress-tests/src/component-testing/init-component-testing.test.ts +++ b/npm/create-cypress-tests/src/component-testing/init-component-testing.test.ts @@ -71,7 +71,7 @@ describe('init component tests script', () => { ) const supportFile = fs.readFileSync( - path.join(e2eTestOutputPath, 'cypress', 'support', 'index.js'), + path.join(e2eTestOutputPath, 'cypress', 'support', 'component.js'), { encoding: 'utf-8' }, ) @@ -81,9 +81,9 @@ describe('init component tests script', () => { } snapshot( - `${name} support/index.js`, + `${name} support/component.js`, fs.readFileSync( - path.join(e2eTestOutputPath, 'cypress', 'support', 'index.js'), + path.join(e2eTestOutputPath, 'cypress', 'support', 'component.js'), { encoding: 'utf-8' }, ), ) @@ -92,7 +92,7 @@ describe('init component tests script', () => { it('determines more presumable configuration to suggest', async () => { createTempFiles({ '/cypress.config.ts': 'export default {}', - '/cypress/support/index.js': '', + '/cypress/support/component.js': '', '/cypress/plugins/index.js': 'module.exports = (on, config) => {}', // For next.js user will have babel config, but we want to suggest to use the closest config for the application code '/babel.config.js': 'module.exports = { }', @@ -115,7 +115,7 @@ describe('init component tests script', () => { it('automatically suggests to the user which config to use', async () => { createTempFiles({ '/cypress.config.ts': 'export default {}', - '/cypress/support/index.js': 'import "./commands.js";', + '/cypress/support/component.js': 'import "./commands.js";', '/cypress/plugins/index.js': 'module.exports = () => {}', '/package.json': JSON.stringify({ dependencies: { diff --git a/npm/cypress-schematic/src/schematics/ng-add/files/cypress.config.ts b/npm/cypress-schematic/src/schematics/ng-add/files/cypress.config.ts index c3dffeeb75..554fb84d7a 100644 --- a/npm/cypress-schematic/src/schematics/ng-add/files/cypress.config.ts +++ b/npm/cypress-schematic/src/schematics/ng-add/files/cypress.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress' export default defineConfig({ 'integrationFolder': '<%= root%>cypress/integration', - 'supportFile': '<%= root%>cypress/support/index.ts', + 'supportFile': '<%= root%>cypress/support/component.ts', 'videosFolder': '<%= root%>cypress/videos', 'screenshotsFolder': '<%= root%>cypress/screenshots', 'pluginsFile': '<%= root%>cypress/plugins/index.ts', diff --git a/npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/index.ts b/npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/component.ts similarity index 91% rename from npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/index.ts rename to npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/component.ts index ac293b6165..80a6b856d9 100644 --- a/npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/index.ts +++ b/npm/cypress-schematic/src/schematics/ng-add/files/cypress/support/component.ts @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/component.ts is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts index 01f26fcc47..7159782802 100644 --- a/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts +++ b/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts @@ -32,7 +32,7 @@ describe('@cypress/schematic: ng-add', () => { }) it('should create cypress files', async () => { - const files = ['cypress/integration/spec.ts', 'cypress/plugins/index.ts', 'cypress/support/commands.ts', 'cypress/support/index.ts', 'cypress/tsconfig.json', 'cypress.config.ts'] + const files = ['cypress/integration/spec.ts', 'cypress/plugins/index.ts', 'cypress/support/commands.ts', 'cypress/tsconfig.json', 'cypress.config.ts'] const homePath = '/projects/sandbox/' return schematicRunner.runSchematicAsync('ng-add', {}, appTree).toPromise().then((tree) => { diff --git a/npm/design-system/cypress/support/index.js b/npm/design-system/cypress/support/component.js similarity index 100% rename from npm/design-system/cypress/support/index.js rename to npm/design-system/cypress/support/component.js diff --git a/npm/react/cypress/support/index.js b/npm/react/cypress/support/component.js similarity index 89% rename from npm/react/cypress/support/index.js rename to npm/react/cypress/support/component.js index 71550f1819..6d11786826 100644 --- a/npm/react/cypress/support/index.js +++ b/npm/react/cypress/support/component.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/component.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/npm/react/examples/a11y/cypress/support/index.js b/npm/react/examples/a11y/cypress/support/component.js similarity index 100% rename from npm/react/examples/a11y/cypress/support/index.js rename to npm/react/examples/a11y/cypress/support/component.js diff --git a/npm/react/examples/craco/cypress/support/component.js b/npm/react/examples/craco/cypress/support/component.js new file mode 100644 index 0000000000..5e450a7b1a --- /dev/null +++ b/npm/react/examples/craco/cypress/support/component.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/component.js is processed and +// loaded automatically before your 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/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/npm/react/examples/find-webpack/cypress.config.ts b/npm/react/examples/find-webpack/cypress.config.ts index 364deb29dd..6d0c371e99 100644 --- a/npm/react/examples/find-webpack/cypress.config.ts +++ b/npm/react/examples/find-webpack/cypress.config.ts @@ -5,6 +5,7 @@ export default defineConfig({ 'projectId': 'jq5xpp', 'component': { 'specPattern': 'src/**/*.spec.{js,ts,jsx,tsx}', + 'supportFile': 'cypress/support/component.ts', devServer (cypressConfig) { const findReactScriptsWebpackConfig = require('@cypress/react/plugins/react-scripts/findReactScriptsWebpackConfig') const { startDevServer } = require('@cypress/webpack-dev-server') diff --git a/npm/react/examples/find-webpack/cypress/support/index.ts b/npm/react/examples/find-webpack/cypress/support/component.ts similarity index 100% rename from npm/react/examples/find-webpack/cypress/support/index.ts rename to npm/react/examples/find-webpack/cypress/support/component.ts diff --git a/npm/react/examples/nextjs/cypress/support/index.js b/npm/react/examples/nextjs/cypress/support/component.js similarity index 100% rename from npm/react/examples/nextjs/cypress/support/index.js rename to npm/react/examples/nextjs/cypress/support/component.js diff --git a/npm/react/examples/react-scripts-folder/cypress/support/index.js b/npm/react/examples/react-scripts-folder/cypress/support/component.js similarity index 100% rename from npm/react/examples/react-scripts-folder/cypress/support/index.js rename to npm/react/examples/react-scripts-folder/cypress/support/component.js diff --git a/npm/react/examples/react-scripts-typescript/cypress.config.js b/npm/react/examples/react-scripts-typescript/cypress.config.js index a76010ef8e..20e44e3886 100644 --- a/npm/react/examples/react-scripts-typescript/cypress.config.js +++ b/npm/react/examples/react-scripts-typescript/cypress.config.js @@ -3,6 +3,7 @@ module.exports = { 'viewportWidth': 500, 'viewportHeight': 800, 'component': { + 'supportFile': 'cypress/support/component.ts', 'specPattern': 'src/**/*cy-spec.tsx', setupNodeEvents (on, config) { const devServer = require('@cypress/react/plugins/react-scripts') diff --git a/npm/react/examples/react-scripts-typescript/cypress/support/index.ts b/npm/react/examples/react-scripts-typescript/cypress/support/component.ts similarity index 100% rename from npm/react/examples/react-scripts-typescript/cypress/support/index.ts rename to npm/react/examples/react-scripts-typescript/cypress/support/component.ts diff --git a/npm/react/examples/react-scripts/cypress/support/index.js b/npm/react/examples/react-scripts/cypress/support/component.js similarity index 100% rename from npm/react/examples/react-scripts/cypress/support/index.js rename to npm/react/examples/react-scripts/cypress/support/component.js diff --git a/npm/react/examples/sass-and-ts/cypress/support/index.js b/npm/react/examples/sass-and-ts/cypress/support/component.js similarity index 100% rename from npm/react/examples/sass-and-ts/cypress/support/index.js rename to npm/react/examples/sass-and-ts/cypress/support/component.js diff --git a/npm/react/examples/snapshots/cypress/support/index.js b/npm/react/examples/snapshots/cypress/support/component.js similarity index 100% rename from npm/react/examples/snapshots/cypress/support/index.js rename to npm/react/examples/snapshots/cypress/support/component.js diff --git a/npm/react/examples/tailwind/cypress.config.js b/npm/react/examples/tailwind/cypress.config.js index ac1aaab391..ffa4425e53 100644 --- a/npm/react/examples/tailwind/cypress.config.js +++ b/npm/react/examples/tailwind/cypress.config.js @@ -6,7 +6,7 @@ module.exports = { 'env': { 'coverage': true, }, - config: { + component: { 'specPattern': 'src/**/*cy-spec.js', setupNodeEvents (on, config) { // load file devServer that comes with this plugin diff --git a/npm/react/examples/tailwind/cypress/support/index.js b/npm/react/examples/tailwind/cypress/support/component.js similarity index 100% rename from npm/react/examples/tailwind/cypress/support/index.js rename to npm/react/examples/tailwind/cypress/support/component.js diff --git a/npm/react/examples/using-babel-typescript/cypress/support/index.js b/npm/react/examples/using-babel-typescript/cypress/support/component.js similarity index 100% rename from npm/react/examples/using-babel-typescript/cypress/support/index.js rename to npm/react/examples/using-babel-typescript/cypress/support/component.js diff --git a/npm/react/examples/using-babel/cypress/support/index.js b/npm/react/examples/using-babel/cypress/support/component.js similarity index 100% rename from npm/react/examples/using-babel/cypress/support/index.js rename to npm/react/examples/using-babel/cypress/support/component.js diff --git a/npm/react/examples/visual-sudoku/cypress/support/index.js b/npm/react/examples/visual-sudoku/cypress/support/component.js similarity index 100% rename from npm/react/examples/visual-sudoku/cypress/support/index.js rename to npm/react/examples/visual-sudoku/cypress/support/component.js diff --git a/npm/react/examples/visual-testing-with-applitools/cypress/support/index.js b/npm/react/examples/visual-testing-with-applitools/cypress/support/component.js similarity index 100% rename from npm/react/examples/visual-testing-with-applitools/cypress/support/index.js rename to npm/react/examples/visual-testing-with-applitools/cypress/support/component.js diff --git a/npm/react/examples/visual-testing-with-happo/cypress/support/index.js b/npm/react/examples/visual-testing-with-happo/cypress/support/component.js similarity index 100% rename from npm/react/examples/visual-testing-with-happo/cypress/support/index.js rename to npm/react/examples/visual-testing-with-happo/cypress/support/component.js diff --git a/npm/react/examples/visual-testing-with-percy/cypress/support/index.js b/npm/react/examples/visual-testing-with-percy/cypress/support/component.js similarity index 100% rename from npm/react/examples/visual-testing-with-percy/cypress/support/index.js rename to npm/react/examples/visual-testing-with-percy/cypress/support/component.js diff --git a/npm/react/examples/webpack-file/cypress/support/index.js b/npm/react/examples/webpack-file/cypress/support/component.js similarity index 100% rename from npm/react/examples/webpack-file/cypress/support/index.js rename to npm/react/examples/webpack-file/cypress/support/component.js diff --git a/npm/react/examples/webpack-options/cypress/support/index.js b/npm/react/examples/webpack-options/cypress/support/component.js similarity index 100% rename from npm/react/examples/webpack-options/cypress/support/index.js rename to npm/react/examples/webpack-options/cypress/support/component.js diff --git a/npm/vite-dev-server/cypress.config.ts b/npm/vite-dev-server/cypress.config.ts index 471a8f37b1..8eed74ea9b 100644 --- a/npm/vite-dev-server/cypress.config.ts +++ b/npm/vite-dev-server/cypress.config.ts @@ -5,6 +5,7 @@ export default defineConfig({ 'video': false, 'fixturesFolder': false, 'component': { + 'supportFile': 'cypress/support.js', 'specPattern': 'cypress/components/**/*.spec.*', devServer (cypressConfig) { const path = require('path') diff --git a/npm/vue/cypress.config.ts b/npm/vue/cypress.config.ts index 025414355d..26f869ab04 100644 --- a/npm/vue/cypress.config.ts +++ b/npm/vue/cypress.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ 'experimentalFetchPolyfill': true, 'e2e': { 'specPattern': 'cypress/integration/**/*', + 'supportFile': false, }, 'component': { 'specPattern': 'cypress/component/**/*spec.{js,ts,tsx}', diff --git a/npm/vue/cypress/support/index.js b/npm/vue/cypress/support/component.js similarity index 100% rename from npm/vue/cypress/support/index.js rename to npm/vue/cypress/support/component.js diff --git a/npm/vue/docs/manual-install.md b/npm/vue/docs/manual-install.md index 9a90df753c..7d6db22ce0 100644 --- a/npm/vue/docs/manual-install.md +++ b/npm/vue/docs/manual-install.md @@ -19,7 +19,7 @@ module.exports = (on, config) => { } ``` -3. Include the support file from your project's `cypress/support/index.js` file +3. Include the support file from your project's `cypress/support/component.js` file ```js import '@cypress/vue/dist/support' diff --git a/npm/vue/examples/code-coverage/README.md b/npm/vue/examples/code-coverage/README.md index dd9812e0ce..8e70d3a6bb 100644 --- a/npm/vue/examples/code-coverage/README.md +++ b/npm/vue/examples/code-coverage/README.md @@ -33,7 +33,7 @@ You should obtain `yarn add -D babel-plugin-istanbul @cypress/code-coverage` - Add the istanbul plugin to your `babel.config.js` - Install `@cypress/code-coverage/task` in `cypress/plugins/index.js` -- Install `@cypress/code-coverage/support` in `cypress/support/index.js` +- Install `@cypress/code-coverage/support` in `cypress/support/component.js` - Enjoy **NOTE** Code coverage has been added to the vue-cli example. If you are using `vue-cli`, use the same steps described above to install coverage. diff --git a/npm/vue/examples/code-coverage/cypress/support/index.js b/npm/vue/examples/code-coverage/cypress/support/component.js similarity index 100% rename from npm/vue/examples/code-coverage/cypress/support/index.js rename to npm/vue/examples/code-coverage/cypress/support/component.js diff --git a/npm/vue/examples/vue-cli/cypress/support/index.js b/npm/vue/examples/vue-cli/cypress/support/component.js similarity index 100% rename from npm/vue/examples/vue-cli/cypress/support/index.js rename to npm/vue/examples/vue-cli/cypress/support/component.js diff --git a/system-tests/projects/config-with-invalid-browser/cypress/support/index.js b/npm/webpack-preprocessor/cypress/support/e2e.js similarity index 92% rename from system-tests/projects/config-with-invalid-browser/cypress/support/index.js rename to npm/webpack-preprocessor/cypress/support/e2e.js index d68db96df2..d1dd1353e8 100644 --- a/system-tests/projects/config-with-invalid-browser/cypress/support/index.js +++ b/npm/webpack-preprocessor/cypress/support/e2e.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/e2e.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/npm/webpack-preprocessor/examples/react-app/cypress.config.js b/npm/webpack-preprocessor/examples/react-app/cypress.config.js index 0cf1222180..b97dacd310 100644 --- a/npm/webpack-preprocessor/examples/react-app/cypress.config.js +++ b/npm/webpack-preprocessor/examples/react-app/cypress.config.js @@ -1,6 +1,8 @@ module.exports = { 'baseUrl': 'http://localhost:3000', 'fixturesFolder': false, - 'supportFile': false, 'viewportWidth': 600, + 'e2e': { + 'supportFile': false, + }, } diff --git a/npm/webpack-preprocessor/examples/use-babelrc/cypress.config.js b/npm/webpack-preprocessor/examples/use-babelrc/cypress.config.js index 21f367cccb..2728977788 100644 --- a/npm/webpack-preprocessor/examples/use-babelrc/cypress.config.js +++ b/npm/webpack-preprocessor/examples/use-babelrc/cypress.config.js @@ -1,7 +1,7 @@ module.exports = { 'fixturesFolder': false, - 'supportFile': false, 'e2e': { + 'supportFile': false, 'specPattern': 'cypress/integration/**/*', setupNodeEvents (on, config) { const webpackPreprocessor = require('../..') diff --git a/npm/webpack-preprocessor/examples/use-ts-loader/cypress.config.ts b/npm/webpack-preprocessor/examples/use-ts-loader/cypress.config.ts index 6075f7aa1b..81ecca95d8 100644 --- a/npm/webpack-preprocessor/examples/use-ts-loader/cypress.config.ts +++ b/npm/webpack-preprocessor/examples/use-ts-loader/cypress.config.ts @@ -2,8 +2,8 @@ import { defineConfig } from 'cypress' export default defineConfig({ 'fixturesFolder': false, - 'supportFile': false, 'e2e': { + 'supportFile': false, async setupNodeEvents (on, config) { const webpackPreprocessor = await import('../..') diff --git a/packages/app/cypress/component/support/index.ts b/packages/app/cypress/component/support/index.ts index c8bf40bda0..1ae5645452 100644 --- a/packages/app/cypress/component/support/index.ts +++ b/packages/app/cypress/component/support/index.ts @@ -1,6 +1,6 @@ import { registerMountFn } from '@packages/frontend-shared/cypress/support/common' // *********************************************************** -// This example support/index.js is processed and +// This example support/index.ts is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/packages/config/__snapshots__/index_spec.js b/packages/config/__snapshots__/index_spec.js index b01f7facb6..d7ee1bfedd 100644 --- a/packages/config/__snapshots__/index_spec.js +++ b/packages/config/__snapshots__/index_spec.js @@ -57,7 +57,7 @@ exports['src/index .getDefaultValues returns list of public config keys 1'] = { "screenshotsFolder": "cypress/screenshots", "slowTestThreshold": 10000, "scrollBehavior": "top", - "supportFile": "cypress/support", + "supportFile": "cypress/support/e2e.js", "supportFolder": false, "taskTimeout": 60000, "trashAssetsBeforeRuns": true, diff --git a/packages/config/lib/index.js b/packages/config/lib/index.js index 7e67ae5bc0..7e2c4e5106 100644 --- a/packages/config/lib/index.js +++ b/packages/config/lib/index.js @@ -1,7 +1,7 @@ const _ = require('lodash') const debug = require('debug')('cypress:config:validator') -const { options, breakingOptions } = require('./options') +const { options, breakingOptions, breakingRootOptions } = require('./options') const dashesOrUnderscoresRe = /^(_-)+/ @@ -24,6 +24,40 @@ const testConfigOverrideOptions = createIndex(options, 'name', 'canUpdateDuringT const issuedWarnings = new Set() +const validateNoBreakingOptions = (breakingCfgOptions, cfg, onWarning, onErr) => { + breakingCfgOptions.forEach(({ name, errorKey, newName, isWarning, value }) => { + if (cfg.hasOwnProperty(name)) { + if (value && cfg[name] !== value) { + // Bail if a value is specified but the config does not have that value. + return + } + + if (isWarning) { + if (issuedWarnings.has(errorKey)) { + return + } + + // avoid re-issuing the same warning more than once + issuedWarnings.add(errorKey) + + return onWarning(errorKey, { + name, + newName, + value, + configFile: cfg.configFile, + }) + } + + return onErr(errorKey, { + name, + newName, + value, + configFile: cfg.configFile, + }) + } + }) +} + module.exports = { allowed: (obj = {}) => { const propertyNames = publicConfigKeys.concat(breakingKeys) @@ -78,38 +112,12 @@ module.exports = { }) }, + validateNoBreakingConfigRoot: (cfg, onWarning, onErr) => { + return validateNoBreakingOptions(breakingRootOptions, cfg, onWarning, onErr) + }, + validateNoBreakingConfig: (cfg, onWarning, onErr) => { - breakingOptions.forEach(({ name, errorKey, newName, isWarning, value }) => { - if (cfg.hasOwnProperty(name)) { - if (value && cfg[name] !== value) { - // Bail if a value is specified but the config does not have that value. - return - } - - if (isWarning) { - if (issuedWarnings.has(errorKey)) { - return - } - - // avoid re-issuing the same warning more than once - issuedWarnings.add(errorKey) - - return onWarning(errorKey, { - name, - newName, - value, - configFile: cfg.configFile, - }) - } - - return onErr(errorKey, { - name, - newName, - value, - configFile: cfg.configFile, - }) - } - }) + return validateNoBreakingOptions(breakingOptions, cfg, onWarning, onErr) }, validateNoReadOnlyConfig: (config, onErr) => { diff --git a/packages/config/lib/options.ts b/packages/config/lib/options.ts index 21f1e15dbe..fa23c4328e 100644 --- a/packages/config/lib/options.ts +++ b/packages/config/lib/options.ts @@ -299,7 +299,7 @@ const resolvedOptions: Array = [ canUpdateDuringTestTime: true, }, { name: 'supportFile', - defaultValue: 'cypress/support', + defaultValue: (options: Record = {}) => options.testingType === 'component' ? 'cypress/support/component.js' : 'cypress/support/e2e.js', validation: validate.isStringOrFalse, isFolder: true, canUpdateDuringTestTime: false, @@ -512,3 +512,11 @@ export const breakingOptions: Array = [ isWarning: true, }, ] + +export const breakingRootOptions: Array = [ + { + name: 'supportFile', + errorKey: 'SUPPORT_FILE_ROOT_NOT_SUPPORTED', + isWarning: false, + }, +] diff --git a/packages/data-context/src/DataContext.ts b/packages/data-context/src/DataContext.ts index 61005e325e..2ff398130d 100644 --- a/packages/data-context/src/DataContext.ts +++ b/packages/data-context/src/DataContext.ts @@ -52,6 +52,7 @@ export interface InternalDataContextOptions { export interface ErrorApiShape { error: (type: string, ...args: any) => Error & { type: string, details: string, code?: string, isCypressErr: boolean} message: (type: string, ...args: any) => string + warning: (type: string, ...args: any) => null } export interface DataContextConfig { @@ -449,6 +450,10 @@ export class DataContext { return this._apis.errorApi.error(type, ...args) } + warning (type: string, ...args: any[]) { + return this._apis.errorApi.error(type, ...args) + } + private async initializeOpenMode () { if (IS_DEV_ENV && !process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) { this.actions.dev.watchForRelaunch() diff --git a/packages/data-context/src/actions/ProjectActions.ts b/packages/data-context/src/actions/ProjectActions.ts index 2cc909993e..5c93e268cd 100644 --- a/packages/data-context/src/actions/ProjectActions.ts +++ b/packages/data-context/src/actions/ProjectActions.ts @@ -78,9 +78,10 @@ export class ProjectActions { } // Temporary: remove after other refactor lands - setCurrentProjectForTestSetup (projectRoot: string) { + setCurrentProjectAndTestingTypeForTestSetup (projectRoot: string) { this.ctx.lifecycleManager.clearCurrentProject() this.ctx.lifecycleManager.setCurrentProject(projectRoot) + this.ctx.lifecycleManager.setCurrentTestingType('e2e') // @ts-expect-error - we are setting this as a convenience for our integration tests this.ctx._modeOptions = {} } diff --git a/packages/data-context/src/actions/WizardActions.ts b/packages/data-context/src/actions/WizardActions.ts index c4014ae33f..6e84b62cad 100644 --- a/packages/data-context/src/actions/WizardActions.ts +++ b/packages/data-context/src/actions/WizardActions.ts @@ -123,13 +123,15 @@ export class WizardActions { ]) } - private async scaffoldSupport (directory: 'e2e' | 'component', language: CodeLanguageEnum): Promise { - const supportFile = path.join(this.projectRoot, `cypress/${directory}/support.${language}`) + private async scaffoldSupport (fileName: 'e2e' | 'component', language: CodeLanguageEnum): Promise { + const supportFile = path.join(this.projectRoot, `cypress/support/${fileName}.${language}`) + const supportDir = path.dirname(supportFile) - await this.ensureDir(directory) - await this.ctx.fs.writeFile(supportFile, dedent` + // @ts-ignore + await this.ctx.fs.mkdir(supportDir, { recursive: true }) + await this.scaffoldFile(supportFile, dedent` // TODO: source the example support file - `) + `, 'Scaffold default support file') return { status: 'valid', @@ -192,7 +194,10 @@ export class WizardActions { codeBlocks.push(lang === 'ts' ? 'import { defineConfig } from "cypress"' : `const { defineConfig } = require("cypress")`) codeBlocks.push(lang === 'ts' ? `export default defineConfig({` : `module.exports = defineConfig({`) - codeBlocks.push(E2E_SCAFFOLD_BODY) + codeBlocks.push(E2E_SCAFFOLD_BODY({ + lang, + })) + codeBlocks.push('})\n') return codeBlocks.join('\n') @@ -311,16 +316,23 @@ export class WizardActions { } } -const E2E_SCAFFOLD_BODY = ` - e2e: { - specPattern: 'cypress/e2e/**/*.cy.{js,ts}', - viewportHeight: 660, - viewportWidth: 1000, - setupNodeEvents(on, config) { - // - }, - } -` +interface E2eScaffoldOpts { + lang: CodeLanguageEnum +} + +const E2E_SCAFFOLD_BODY = (opts: E2eScaffoldOpts) => { + return ` + e2e: { + supportFile: 'cypress/support/e2e.${opts.lang}', + specPattern: 'cypress/e2e/**/*.cy.{js,ts}', + viewportHeight: 660, + viewportWidth: 1000, + setupNodeEvents(on, config) { + // + }, + } + ` +} interface ComponentScaffoldOpts { lang: CodeLanguageEnum @@ -332,6 +344,7 @@ interface ComponentScaffoldOpts { const COMPONENT_SCAFFOLD_BODY = (opts: ComponentScaffoldOpts) => { return ` component: { + supportFile: 'cypress/support/component.${opts.lang}', specPattern: 'cypress/**/*.cy.{js,jsx,ts,tsx}', devServer: import('${opts.requirePath}'), devServerConfig: ${opts.configOptionsString} diff --git a/packages/data-context/src/data/ProjectLifecycleManager.ts b/packages/data-context/src/data/ProjectLifecycleManager.ts index 115805438a..badd8ec2a4 100644 --- a/packages/data-context/src/data/ProjectLifecycleManager.ts +++ b/packages/data-context/src/data/ProjectLifecycleManager.ts @@ -49,6 +49,7 @@ export interface InjectedConfigApi { allowedConfig(config: Cypress.ConfigOptions): Cypress.ConfigOptions updateWithPluginValues(config: FullConfig, modifiedConfig: Partial): FullConfig setupFullConfigWithDefaults(config: SetupFullConfigOptions): Promise + validateRootConfigBreakingChanges(config: Partial, onWarning: (warningMsg: string) => void, onErr: (errMsg: string) => never): T } type State = V extends undefined ? {state: S, value?: V} : {state: S, value: V} @@ -407,6 +408,8 @@ export class ProjectLifecycleManager { } private async buildBaseFullConfig (configFileContents: Cypress.ConfigOptions, envFile: Cypress.ConfigOptions, options: Partial, withBrowsers = true) { + this.validateConfigRoot(configFileContents) + if (this._currentTestingType) { const testingTypeOverrides = configFileContents[this._currentTestingType] ?? {} @@ -532,6 +535,18 @@ export class ProjectLifecycleManager { return promise.then((v) => v.initialConfig) } + private validateConfigRoot (config: Cypress.ConfigOptions) { + return this.ctx._apis.configApi.validateRootConfigBreakingChanges( + config, + (warning, ...args) => { + return this.ctx.warning(warning, ...args) + }, + (err, ...args) => { + throw this.ctx.error(err, ...args) + }, + ) + } + private validateConfigFile (file: string | false, config: Cypress.ConfigOptions) { this.ctx._apis.configApi.validateConfig(config, (errMsg) => { if (!file) { @@ -740,15 +755,28 @@ export class ProjectLifecycleManager { } private async setupNodeEvents (): Promise { - const config = await this.getFullInitialConfig() - assert(this._eventsIpc) + const ipc = this._eventsIpc + + let config + + try { + config = await this.getFullInitialConfig() + } catch (err) { + debug(`catch %o`, err) + this._cleanupIpc(ipc) + this._eventsIpcResult = { state: 'errored', value: err } + this._pendingInitialize?.reject(err) + this.ctx.emitter.toLaunchpad() + + return Promise.reject(err) + } + + assert(config) assert(this._currentTestingType) this._registeredEventsTarget = this._currentTestingType - const ipc = this._eventsIpc - for (const handler of this._handlers) { handler(ipc) } diff --git a/packages/driver/cypress/support/index.js b/packages/driver/cypress/support/e2e.js similarity index 92% rename from packages/driver/cypress/support/index.js rename to packages/driver/cypress/support/e2e.js index c089346687..c818f04f6a 100644 --- a/packages/driver/cypress/support/index.js +++ b/packages/driver/cypress/support/e2e.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// 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 diff --git a/packages/example/lib/example.d.ts b/packages/example/lib/example.d.ts index 57bf4e8fd5..368ab4cada 100644 --- a/packages/example/lib/example.d.ts +++ b/packages/example/lib/example.d.ts @@ -2,7 +2,6 @@ declare const example: { getPathToExamples(): Promise; getPathToIntegration(): string; getPathToPlugins(): string; - getPathToSupportFiles(): Promise; getPathToTsConfig(): string; getPathToFixture(): string; } diff --git a/packages/example/lib/example.js b/packages/example/lib/example.js index 02b7d9d31c..752e0c1497 100644 --- a/packages/example/lib/example.js +++ b/packages/example/lib/example.js @@ -28,19 +28,6 @@ module.exports = { return path.resolve(__dirname, '..', 'cypress', 'plugins', 'index.js') }, - getPathToSupportFiles() { - return glob( - path.join( - __dirname, - '..', - 'cypress', - 'support', - '**', - '*' - ) - ) - }, - getPathToTsConfig() { return path.resolve(__dirname, '..', 'cypress', 'tsconfig.json') }, diff --git a/packages/example/package.json b/packages/example/package.json index d6e427a5aa..8d7e6a8521 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -28,7 +28,7 @@ "devDependencies": { "chai": "3.5.0", "cross-env": "6.0.3", - "cypress-example-kitchensink": "cypress-io/cypress-example-kitchensink#feat/use-config-file", + "cypress-example-kitchensink": "cypress-io/cypress-example-kitchensink#feat/use-supportFiles", "gulp": "4.0.2", "gulp-clean": "0.4.0", "gulp-gh-pages": "0.6.0-6", diff --git a/packages/frontend-shared/cypress.config.ts b/packages/frontend-shared/cypress.config.ts index 390be6baa2..d73a3251f8 100644 --- a/packages/frontend-shared/cypress.config.ts +++ b/packages/frontend-shared/cypress.config.ts @@ -18,6 +18,7 @@ export default defineConfig({ }, 'component': { 'specPattern': 'src/**/*.spec.{js,ts,tsx,jsx}', + 'supportFile': 'cypress/support/component.ts', devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/vite-dev-server') diff --git a/packages/frontend-shared/cypress/support/index.ts b/packages/frontend-shared/cypress/support/component.ts similarity index 100% rename from packages/frontend-shared/cypress/support/index.ts rename to packages/frontend-shared/cypress/support/component.ts diff --git a/packages/launchpad/cypress/e2e/integration/config-files-error-handling.spec.ts b/packages/launchpad/cypress/e2e/integration/config-files-error-handling.spec.ts index 76880d950a..0bfa23cd0c 100644 --- a/packages/launchpad/cypress/e2e/integration/config-files-error-handling.spec.ts +++ b/packages/launchpad/cypress/e2e/integration/config-files-error-handling.spec.ts @@ -27,7 +27,7 @@ describe('Config files error handling', () => { .should('not.contain.text', 'Something went wrong') }) - it('it shows the upgrade screen if there is a legacy config file', () => { + it('shows the upgrade screen if there is a legacy config file', () => { cy.openProject('pristine-with-config-file') cy.withCtx(async (ctx) => { await ctx.actions.file.writeFileInProject('cypress.json', '{}') @@ -42,7 +42,7 @@ describe('Config files error handling', () => { cy.get('body').should('contain.text', defaultMessages.migration.wizard.description) }) - it('it handles config files with legacy config file in same project', () => { + it('handles config files with legacy config file in same project', () => { cy.openProject('pristine-with-config-file') cy.withCtx(async (ctx) => { await ctx.actions.file.writeFileInProject('cypress.json', '{}') @@ -59,4 +59,36 @@ describe('Config files error handling', () => { cy.get('body').should('not.contain.text', 'Cypress no longer supports') }) + + it('handles deprecated config fields', () => { + cy.openProject('pristine') + + cy.withCtx(async (ctx) => { + await ctx.actions.file.writeFileInProject('cypress.config.js', 'module.exports = { experimentalComponentTesting: true }') + }) + + cy.openProject('pristine') + + cy.visitLaunchpad() + cy.get('[data-cy-testingType=e2e]').click() + cy.get('body').should('contain.text', 'Something went wrong') + cy.get('body').should('contain.text', 'It looks like there\'s some issues that need to be resolved before we continue.') + cy.findByText('Error Loading Config') + }) + + it('handles deprecated fields on root config', () => { + cy.openProject('pristine') + + cy.withCtx(async (ctx) => { + await ctx.actions.file.writeFileInProject('cypress.config.js', `module.exports = { supportFile: 'cypress/support.ts' }`) + }) + + cy.openProject('pristine') + + cy.visitLaunchpad() + cy.get('[data-cy-testingType=e2e]').click() + cy.get('body').should('contain.text', 'Something went wrong') + cy.get('body').should('contain.text', 'It looks like there\'s some issues that need to be resolved before we continue.') + cy.findByText('Error Loading Config') + }) }) diff --git a/packages/launchpad/cypress/e2e/integration/onboarding-flow.spec.ts b/packages/launchpad/cypress/e2e/integration/onboarding-flow.spec.ts index 87c4b5228c..7d4ba03fcf 100644 --- a/packages/launchpad/cypress/e2e/integration/onboarding-flow.spec.ts +++ b/packages/launchpad/cypress/e2e/integration/onboarding-flow.spec.ts @@ -100,10 +100,12 @@ describe('Launchpad: Onboarding Flow', () => { const { defineConfig } = require("cypress") module.exports = defineConfig({ component: { + supportFile: 'cypress/support/component.js', devServer: require('@cypress/webpack-dev-server'), devServerConfig: {} }, e2e: { + supportFile: 'cypress/support/e2e.js', specPattern: 'cypress/e2e/**/*.cy.{js,ts}', viewportHeight: 660, viewportWidth: 1000, diff --git a/packages/launchpad/cypress/e2e/integration/plugin-error-handling.spec.ts b/packages/launchpad/cypress/e2e/integration/plugin-error-handling.spec.ts index 73bf3ca8fe..b5c45a5883 100644 --- a/packages/launchpad/cypress/e2e/integration/plugin-error-handling.spec.ts +++ b/packages/launchpad/cypress/e2e/integration/plugin-error-handling.spec.ts @@ -13,7 +13,7 @@ describe('Plugin error handling', () => { .and('contain.text', 'The function exported by the plugins file threw an error') cy.withCtx(async (ctx) => { - await ctx.actions.file.writeFileInProject('cypress.config.js', `module.exports = { e2e: { baseUrl: 'https://cypress.com' } }`) + await ctx.actions.file.writeFileInProject('cypress.config.js', `module.exports = { e2e: { baseUrl: 'https://cypress.com', supportFile: false } }`) }) cy.get('body') diff --git a/packages/reporter/cypress.config.ts b/packages/reporter/cypress.config.ts index c2874fbacf..f9faab801d 100644 --- a/packages/reporter/cypress.config.ts +++ b/packages/reporter/cypress.config.ts @@ -14,7 +14,8 @@ export default defineConfig({ 'openMode': 0, }, 'e2e': { - specPattern: 'cypress/integration/**/*.{js,ts}', + 'supportFile': 'cypress/support/e2e.ts', + 'specPattern': 'cypress/integration/**/*.{js,ts}', setupNodeEvents (on, config) { const express = require('express') @@ -22,7 +23,7 @@ export default defineConfig({ return config }, - viewportHeight: 660, - viewportWidth: 1000, + 'viewportHeight': 660, + 'viewportWidth': 1000, }, }) diff --git a/packages/reporter/cypress/support/index.ts b/packages/reporter/cypress/support/e2e.ts similarity index 100% rename from packages/reporter/cypress/support/index.ts rename to packages/reporter/cypress/support/e2e.ts diff --git a/packages/runner-ct/cypress/support/index.js b/packages/runner-ct/cypress/support/component.js similarity index 93% rename from packages/runner-ct/cypress/support/index.js rename to packages/runner-ct/cypress/support/component.js index 6df0af0e39..3af46d4dc3 100644 --- a/packages/runner-ct/cypress/support/index.js +++ b/packages/runner-ct/cypress/support/component.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/component.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/packages/runner/cypress/support/index.js b/packages/runner/cypress/support/e2e.js similarity index 100% rename from packages/runner/cypress/support/index.js rename to packages/runner/cypress/support/e2e.js diff --git a/packages/server/__snapshots__/scaffold_spec.js b/packages/server/__snapshots__/scaffold_spec.js index d48b07f908..b9a8a27cf7 100644 --- a/packages/server/__snapshots__/scaffold_spec.js +++ b/packages/server/__snapshots__/scaffold_spec.js @@ -87,7 +87,10 @@ exports['lib/scaffold .fileTree returns tree-like structure of scaffolded 1'] = "name": "commands.js" }, { - "name": "index.js" + "name": "component.js" + }, + { + "name": "e2e.js" } ] } @@ -184,7 +187,10 @@ exports['lib/scaffold .fileTree leaves out integration tests if using component "name": "commands.js" }, { - "name": "index.js" + "name": "component.js" + }, + { + "name": "e2e.js" } ] } @@ -273,7 +279,10 @@ exports['lib/scaffold .fileTree leaves out fixtures if configured to false 1'] = "name": "commands.js" }, { - "name": "index.js" + "name": "component.js" + }, + { + "name": "e2e.js" } ] } @@ -367,59 +376,6 @@ exports['lib/scaffold .fileTree leaves out support if configured to false 1'] = } ] -exports['lib/scaffold .support creates supportFolder and commands.js and index.js when supportFolder does not exist 1'] = ` -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) - -` - -exports['lib/scaffold .support creates supportFolder and commands.js and index.js when supportFolder does not exist 2'] = ` -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your 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/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -` - exports['lib/scaffold .fileTree leaves out plugins if configured to false 1'] = [ { "name": "tests", @@ -509,7 +465,10 @@ exports['lib/scaffold .fileTree leaves out plugins if configured to false 1'] = "name": "commands.js" }, { - "name": "index.js" + "name": "component.js" + }, + { + "name": "e2e.js" } ] } diff --git a/packages/server/lib/config.ts b/packages/server/lib/config.ts index 2e7fc4bee8..4b15788f08 100644 --- a/packages/server/lib/config.ts +++ b/packages/server/lib/config.ts @@ -46,59 +46,26 @@ export const utils = { return require.resolve(name) }, - // tries to find support or plugins file // returns: // false - if the file should not be set // string - found filename // null - if there is an error finding the file discoverModuleFile (options) { debug('discover module file %o', options) - const { filename, isDefault } = options - - if (!isDefault) { - // they have it explicitly set, so it should be there - return fs.pathExists(filename) - .then((found) => { - if (found) { - debug('file exists, assuming it will load') - - return filename - } - - debug('could not find %o', { filename }) - - return null - }) - } - - // support or plugins file doesn't exist on disk? - debug(`support file is default, check if ${path.dirname(filename)} exists`) + const { filename } = options + // they have it explicitly set, so it should be there return fs.pathExists(filename) .then((found) => { if (found) { - debug('is there index.ts in the support or plugins folder %s?', filename) - const tsFilename = path.join(filename, 'index.ts') + debug('file exists, assuming it will load') - return fs.pathExists(tsFilename) - .then((foundTsFile) => { - if (foundTsFile) { - debug('found index TS file %s', tsFilename) - - return tsFilename - } - - // if the directory exists, set it to false so it's ignored - debug('setting support or plugins file to false') - - return false - }) + return filename } - debug('folder does not exist, set to default index.js') + debug('could not find %o', { filename }) - // otherwise, set it up to be scaffolded later - return path.join(filename, 'index.js') + return null }) }, } @@ -426,11 +393,8 @@ export function setSupportFileAndFolder (obj, defaults) { }).catch({ code: 'MODULE_NOT_FOUND' }, () => { debug('support JS module %s does not load', sf) - const loadingDefaultSupportFile = sf === path.resolve(obj.projectRoot, defaults.supportFile) - return utils.discoverModuleFile({ filename: sf, - isDefault: loadingDefaultSupportFile, projectRoot: obj.projectRoot, }) .then((result) => { diff --git a/packages/server/lib/errors.js b/packages/server/lib/errors.js index 9bcc44f9cd..51d85b26b8 100644 --- a/packages/server/lib/errors.js +++ b/packages/server/lib/errors.js @@ -1039,6 +1039,11 @@ const getMsgByType = function (type, ...args) { Deprecation Warning: ${chalk.yellow(`\`${arg1.name}\``)} is currently set to ${chalk.yellow(`\`${arg1.value}\``)} in the ${chalk.yellow(`\`${arg1.configFile}\``)} configuration file. As of Cypress version \`9.0.0\` the default behavior of ${chalk.yellow(`\`${arg1.name}\``)} has changed to always use the version of Node used to start cypress via the cli. When ${chalk.yellow(`\`${arg1.name}\``)} is set to ${chalk.yellow(`\`${arg1.value}\``)}, Cypress will use the version of Node bundled with electron. This can cause problems running certain plugins or integrations. As the ${chalk.yellow(`\`${arg1.name}\``)} configuration option will be removed in a future release, it is recommended to remove the ${chalk.yellow(`\`${arg1.name}\``)} configuration option from ${chalk.yellow(`\`${arg1.configFile}\``)}. ` + case 'SUPPORT_FILE_ROOT_NOT_SUPPORTED': + return stripIndent`\ + The ${chalk.yellow(`\`supportFile\``)} configuration option was removed from the root in Cypress version \`10.0.0\`. Please update this option under each testing type property. + + https://on.cypress.io/migration-guide` default: } } diff --git a/packages/server/lib/makeDataContext.ts b/packages/server/lib/makeDataContext.ts index c83b3ef080..43f7cbfc67 100644 --- a/packages/server/lib/makeDataContext.ts +++ b/packages/server/lib/makeDataContext.ts @@ -54,6 +54,7 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext { errorApi: { error: errors.get, message: errors.getMsgByType, + warning: errors.warning, }, configApi: { getServerPluginHandlers: plugins.getServerPluginHandlers, @@ -62,6 +63,7 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext { validateConfig: configUtils.validate, updateWithPluginValues: config.updateWithPluginValues, setupFullConfigWithDefaults: config.setupFullConfigWithDefaults, + validateRootConfigBreakingChanges: configUtils.validateNoBreakingConfigRoot, }, appApi: { appData, diff --git a/packages/server/lib/project-base.ts b/packages/server/lib/project-base.ts index 41350738b6..e407b3f494 100644 --- a/packages/server/lib/project-base.ts +++ b/packages/server/lib/project-base.ts @@ -18,7 +18,6 @@ import errors from './errors' import Reporter from './reporter' import runEvents from './plugins/run_events' import * as savedState from './saved_state' -import scaffold from './scaffold' import { ServerE2E } from './server-e2e' import system from './util/system' import { ensureProp } from './util/class-helpers' @@ -246,10 +245,7 @@ export class ProjectBase extends EE { projectRoot: this.projectRoot, }) - await Promise.all([ - this.scaffold(cfg), - this.saveState(stateToSave), - ]) + await this.saveState(stateToSave) await Promise.all([ checkSupportFile({ configFile: cfg.configFile, supportFile: cfg.supportFile }), @@ -530,6 +526,7 @@ export class ProjectBase extends EE { } async initializeConfig (): Promise { + this.ctx.lifecycleManager.setCurrentTestingType(this.testingType) let theCfg: Cfg = await this.ctx.lifecycleManager.getFullInitialConfig() as Cfg // ?? types are definitely wrong here I think theCfg = this.testingType === 'e2e' @@ -596,26 +593,6 @@ export class ProjectBase extends EE { fs.writeFileSync(path.resolve(this.projectRoot, configFilename), code) } - scaffold (cfg: Cfg) { - debug('scaffolding project %s', this.projectRoot) - - const scaffolds = [] - - const push = scaffolds.push.bind(scaffolds) as any - - // TODO: we are currently always scaffolding support - // even when headlessly - this is due to a major breaking - // change of 0.18.0 - // we can later force this not to always happen when most - // of our users go beyond 0.18.0 - // - // ensure support dir is created - // and example support file if dir doesnt exist - push(scaffold.support(cfg.supportFolder, cfg)) - - return Promise.all(scaffolds) - } - // These methods are not related to start server/sockets/runners async getProjectId () { diff --git a/packages/server/lib/scaffold.js b/packages/server/lib/scaffold.js index 33f9630d2d..a3b4e9abe2 100644 --- a/packages/server/lib/scaffold.js +++ b/packages/server/lib/scaffold.js @@ -109,28 +109,6 @@ module.exports = { }) }, - support (folder, config) { - debug(`support folder ${folder}, support file ${config.supportFile}`) - - // skip if user has explicitly set supportFile - if (!config.supportFile || !isDefault(config, 'supportFile')) { - return Promise.resolve() - } - - return this.verifyScaffolding(folder, () => { - debug(`copying commands.js and index.js to ${folder}`) - - return cypressEx.getPathToSupportFiles() - .then((supportFiles) => { - return Promise.all( - supportFiles.map((supportFilePath) => { - return this._copy(supportFilePath, folder) - }), - ) - }) - }) - }, - plugins (folder, config) { debug(`plugins folder ${folder}`) // skip if user has explicitly set pluginsFile @@ -232,13 +210,6 @@ module.exports = { ]) } - if (config.supportFolder && (config.supportFile !== false)) { - files = files.concat([ - getFilePath(config.supportFolder, 'commands.js'), - getFilePath(config.supportFolder, 'index.js'), - ]) - } - if (config.pluginsFile) { files = files.concat([ getFilePath(path.dirname(config.pluginsFile), 'index.js'), diff --git a/packages/server/test/integration/cypress_spec.js b/packages/server/test/integration/cypress_spec.js index f2262e21a2..855cb27c10 100644 --- a/packages/server/test/integration/cypress_spec.js +++ b/packages/server/test/integration/cypress_spec.js @@ -427,7 +427,7 @@ describe('lib/cypress', () => { // NOTE: We no longer do this in the new flow it.skip('scaffolds out integration and example specs if they do not exist when not runMode', function () { - ctx.actions.project.setCurrentProjectForTestSetup(this.pristineWithConfigPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.pristineWithConfigPath) return config.get(this.pristineWithConfigPath) .then((cfg) => { @@ -479,28 +479,30 @@ describe('lib/cypress', () => { it.skip('scaffolds out support + files if they do not exist', function () { const supportFolder = path.join(this.pristineWithConfigPath, 'cypress/support') - ctx.actions.project.setCurrentProjectForTestSetup(this.pristineWithConfigPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.pristineWithConfigPath) return config.get(this.pristineWithConfigPath) .then(() => { + return fs.rmdir(supportFolder, { recursive: true }) + }).then(() => { return fs.statAsync(supportFolder) - .then(() => { - throw new Error('supportFolder should not exist!') - }).catch({ code: 'ENOENT' }, () => { - return cypress.start([`--run-project=${this.pristineWithConfigPath}`, '--no-run-mode']) - }).then(() => { - return fs.statAsync(supportFolder) - }).then(() => { - return fs.statAsync(path.join(supportFolder, 'index.js')) - }).then(() => { - return fs.statAsync(path.join(supportFolder, 'commands.js')) - }) + }) + .then(() => { + throw new Error('supportFolder should not exist!') + }).catch({ code: 'ENOENT' }, () => { + return cypress.start([`--run-project=${this.pristineWithConfigPath}`]) + }).then(() => { + return fs.statAsync(supportFolder) + }).then(() => { + throw new Error('supportFolder should not exist!') + }).catch((err) => { + expect(err.code).eq('ENOENT') }) }) // NOTE: Removal of fixtures is not supported in new flow it.skip('removes fixtures when they exist and fixturesFolder is false', function (done) { - ctx.actions.project.setCurrentProjectForTestSetup(this.idsPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.idsPath) config.get(this.idsPath) .then((cfg) => { @@ -560,7 +562,7 @@ describe('lib/cypress', () => { it('can change the reporter with cypress.config.js', function () { sinon.spy(Reporter, 'create') - ctx.actions.project.setCurrentProjectForTestSetup(this.idsPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.idsPath) return config.get(this.idsPath) .then((cfg) => { @@ -628,7 +630,7 @@ describe('lib/cypress', () => { }) it(`logs error when supportFile doesn't exist`, function () { - return settings.writeForTesting(this.idsPath, { supportFile: '/does/not/exist' }) + return settings.writeForTesting(this.idsPath, { e2e: { supportFile: '/does/not/exist' } }) .then(() => { return cypress.start([`--run-project=${this.idsPath}`]) }).then(() => { @@ -799,7 +801,7 @@ describe('lib/cypress', () => { return fs.mkdirAsync(permissionsPath) .then(() => { - return fs.outputFileAsync(cypressConfig, 'module.exports = {}') + return fs.outputFileAsync(cypressConfig, 'module.exports = { e2e: { supportFile: false } }') }).then(() => { // read only return fs.chmodAsync(permissionsPath, '555') @@ -1649,15 +1651,17 @@ describe('lib/cypress', () => { process.env.CYPRESS_responseTimeout = '5555' process.env.CYPRESS_watch_for_file_changes = 'false' - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return user.set({ name: 'brian', authToken: 'auth-token-123' }) - .then(() => settings.read(this.todosPath)) + .then(() => ctx.lifecycleManager.getFullInitialConfig()) .then((json) => { // this should be overriden by the env argument json.baseUrl = 'http://localhost:8080' - return settings.writeForTesting(this.todosPath, json) + const { supportFile, ...rest } = json + + return settings.writeForTesting(this.todosPath, rest) }).then(() => { // TODO(tim): this shouldn't be needed when we refactor the ctx setup process.env.LAUNCHPAD = '0' diff --git a/packages/server/test/integration/http_requests_spec.js b/packages/server/test/integration/http_requests_spec.js index affd0972b7..f1543beef8 100644 --- a/packages/server/test/integration/http_requests_spec.js +++ b/packages/server/test/integration/http_requests_spec.js @@ -103,7 +103,7 @@ describe('Routes', () => { obj.projectRoot = Fixtures.projectPath('e2e') } - ctx.actions.project.setCurrentProjectForTestSetup(obj.projectRoot) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(obj.projectRoot) // get all the config defaults // and allow us to override them @@ -573,6 +573,9 @@ describe('Routes', () => { return this.setup({ projectRoot: Fixtures.projectPath('failures'), + config: { + supportFile: false, + }, }) }) @@ -801,6 +804,7 @@ describe('Routes', () => { config: { integrationFolder: 'tests', fixturesFolder: 'tests/_fixtures', + supportFile: false, }, }) }) @@ -3108,6 +3112,7 @@ describe('Routes', () => { config: { fileServerFolder: 'dev', integrationFolder: 'my-tests', + supportFile: false, }, }) .then(() => { diff --git a/packages/server/test/integration/server_spec.js b/packages/server/test/integration/server_spec.js index a061a5c384..9040d70b20 100644 --- a/packages/server/test/integration/server_spec.js +++ b/packages/server/test/integration/server_spec.js @@ -135,6 +135,7 @@ describe('Server', () => { config: { port: 2000, fileServerFolder: 'dev', + supportFile: false, }, }) }) @@ -332,6 +333,7 @@ describe('Server', () => { projectRoot: '/foo/bar/', config: { port: 2000, + supportFile: false, }, }) }) @@ -918,6 +920,7 @@ describe('Server', () => { config: { port: 2000, fileServerFolder: 'dev', + supportFile: false, }, }) }) diff --git a/packages/server/test/integration/websockets_spec.js b/packages/server/test/integration/websockets_spec.js index 777b66da15..a598881c65 100644 --- a/packages/server/test/integration/websockets_spec.js +++ b/packages/server/test/integration/websockets_spec.js @@ -32,7 +32,7 @@ describe('Web Sockets', () => { this.idsPath = Fixtures.projectPath('ids') - ctx.actions.project.setCurrentProjectForTestSetup(this.idsPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.idsPath) return config.get(this.idsPath, { port: cyPort }) .then((cfg) => { diff --git a/packages/server/test/performance/proxy_performance_spec.js b/packages/server/test/performance/proxy_performance_spec.js index a38c953539..e8864487b6 100644 --- a/packages/server/test/performance/proxy_performance_spec.js +++ b/packages/server/test/performance/proxy_performance_spec.js @@ -349,6 +349,9 @@ describe('Proxy Performance', function () { Config.setupFullConfigWithDefaults({ projectRoot: '/tmp/a', + config: { + supportFile: false, + }, }).then((config) => { config.port = CY_PROXY_PORT diff --git a/packages/server/test/support/fixtures/server/expected_ids_all_tests_iframe.html b/packages/server/test/support/fixtures/server/expected_ids_all_tests_iframe.html index 69d1fdc78e..3118bf5588 100644 --- a/packages/server/test/support/fixtures/server/expected_ids_all_tests_iframe.html +++ b/packages/server/test/support/fixtures/server/expected_ids_all_tests_iframe.html @@ -13,7 +13,7 @@ if (!Cypress) { throw new Error("Tests cannot run without a reference to Cypress!"); } - return Cypress.onSpecWindow(window, [{"absolute":"//ids/cypress/support/index.js","relative":"cypress/support/index.js","relativeUrl":"/__cypress/tests?p=cypress/support/index.js"},{"absolute":"//ids/cypress/integration/bar.js","relative":"cypress/integration/bar.js","relativeUrl":"/__cypress/tests?p=cypress/integration/bar.js"},{"absolute":"//ids/cypress/integration/baz.js","relative":"cypress/integration/baz.js","relativeUrl":"/__cypress/tests?p=cypress/integration/baz.js"},{"absolute":"//ids/cypress/integration/dom.jsx","relative":"cypress/integration/dom.jsx","relativeUrl":"/__cypress/tests?p=cypress/integration/dom.jsx"},{"absolute":"//ids/cypress/integration/es6.js","relative":"cypress/integration/es6.js","relativeUrl":"/__cypress/tests?p=cypress/integration/es6.js"},{"absolute":"//ids/cypress/integration/foo.coffee","relative":"cypress/integration/foo.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/foo.coffee"},{"absolute":"//ids/cypress/integration/nested/tmp.js","relative":"cypress/integration/nested/tmp.js","relativeUrl":"/__cypress/tests?p=cypress/integration/nested/tmp.js"},{"absolute":"//ids/cypress/integration/noop.coffee","relative":"cypress/integration/noop.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/noop.coffee"}]); + return Cypress.onSpecWindow(window, [{"absolute":"//ids/cypress/support/e2e.js","relative":"cypress/support/e2e.js","relativeUrl":"/__cypress/tests?p=cypress/support/e2e.js"},{"absolute":"//ids/cypress/integration/bar.js","relative":"cypress/integration/bar.js","relativeUrl":"/__cypress/tests?p=cypress/integration/bar.js"},{"absolute":"//ids/cypress/integration/baz.js","relative":"cypress/integration/baz.js","relativeUrl":"/__cypress/tests?p=cypress/integration/baz.js"},{"absolute":"//ids/cypress/integration/dom.jsx","relative":"cypress/integration/dom.jsx","relativeUrl":"/__cypress/tests?p=cypress/integration/dom.jsx"},{"absolute":"//ids/cypress/integration/es6.js","relative":"cypress/integration/es6.js","relativeUrl":"/__cypress/tests?p=cypress/integration/es6.js"},{"absolute":"//ids/cypress/integration/foo.coffee","relative":"cypress/integration/foo.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/foo.coffee"},{"absolute":"//ids/cypress/integration/nested/tmp.js","relative":"cypress/integration/nested/tmp.js","relativeUrl":"/__cypress/tests?p=cypress/integration/nested/tmp.js"},{"absolute":"//ids/cypress/integration/noop.coffee","relative":"cypress/integration/noop.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/noop.coffee"}]); })(window.opener || window.parent); diff --git a/packages/server/test/support/fixtures/server/expected_ids_iframe.html b/packages/server/test/support/fixtures/server/expected_ids_iframe.html index f6795f5fd5..70461e5ffc 100644 --- a/packages/server/test/support/fixtures/server/expected_ids_iframe.html +++ b/packages/server/test/support/fixtures/server/expected_ids_iframe.html @@ -13,7 +13,7 @@ if (!Cypress) { throw new Error("Tests cannot run without a reference to Cypress!"); } - return Cypress.onSpecWindow(window, [{"absolute":"//ids/cypress/support/index.js","relative":"cypress/support/index.js","relativeUrl":"/__cypress/tests?p=cypress/support/index.js"},{"absolute":"//ids/cypress/integration/foo.coffee","relative":"cypress/integration/foo.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/foo.coffee"}]); + return Cypress.onSpecWindow(window, [{"absolute":"//ids/cypress/support/e2e.js","relative":"cypress/support/e2e.js","relativeUrl":"/__cypress/tests?p=cypress/support/e2e.js"},{"absolute":"//ids/cypress/integration/foo.coffee","relative":"cypress/integration/foo.coffee","relativeUrl":"/__cypress/tests?p=cypress/integration/foo.coffee"}]); })(window.opener || window.parent); diff --git a/packages/server/test/unit/config_spec.js b/packages/server/test/unit/config_spec.js index e6c048bb75..cf6bd3a0b3 100644 --- a/packages/server/test/unit/config_spec.js +++ b/packages/server/test/unit/config_spec.js @@ -60,10 +60,11 @@ describe('lib/config', () => { this.projectRoot = '/_test-output/path/to/project' + ctx.lifecycleManager.setCurrentTestingType('e2e') sinon.stub(ctx.lifecycleManager, 'verifyProjectRoot').returns(undefined) this.setup = (cypressJson = {}, cypressEnvJson = {}) => { - sinon.stub(ctx.lifecycleManager, 'getConfigFileContents').resolves(cypressJson) + sinon.stub(ctx.lifecycleManager, 'getConfigFileContents').resolves({ ...cypressJson, e2e: cypressJson.e2e ?? { supportFile: false } }) sinon.stub(ctx.lifecycleManager, 'loadCypressEnvFile').resolves(cypressEnvJson) } }) @@ -580,23 +581,23 @@ describe('lib/config', () => { }) context('supportFile', () => { - it('passes if a string', function () { - this.setup({ supportFile: 'cypress/support' }) - - return this.expectValidationPasses() - }) - it('passes if false', function () { - this.setup({ supportFile: false }) + this.setup({ e2e: { supportFile: false } }) return this.expectValidationPasses() }) it('fails if not a string or false', function () { - this.setup({ supportFile: true }) + this.setup({ e2e: { supportFile: true } }) return this.expectValidationFails('be a string or false') }) + + it('fails if is set at root level', function () { + this.setup({ supportFile: false }) + + return this.expectValidationFails('was removed from the root in Cypress version `10.0.0`') + }) }) context('trashAssetsBeforeRuns', () => { @@ -1054,7 +1055,7 @@ describe('lib/config', () => { this.defaults = (prop, value, cfg = {}, options = {}) => { cfg.projectRoot = '/foo/bar/' - return config.mergeDefaults(cfg, options) + return config.mergeDefaults({ ...cfg, supportFile: cfg.supportFile ?? false }, options) .then((mergedConfig) => { expect(mergedConfig[prop]).to.deep.eq(value) }) @@ -1258,35 +1259,35 @@ describe('lib/config', () => { }) it('resets numTestsKeptInMemory to 0 when runMode', () => { - return config.mergeDefaults({ projectRoot: '/foo/bar/' }, { isTextTerminal: true }) + return config.mergeDefaults({ projectRoot: '/foo/bar/', supportFile: false }, { isTextTerminal: true }) .then((cfg) => { expect(cfg.numTestsKeptInMemory).to.eq(0) }) }) it('resets watchForFileChanges to false when runMode', () => { - return config.mergeDefaults({ projectRoot: '/foo/bar/' }, { isTextTerminal: true }) + return config.mergeDefaults({ projectRoot: '/foo/bar/', supportFile: false }, { isTextTerminal: true }) .then((cfg) => { expect(cfg.watchForFileChanges).to.be.false }) }) it('can override morgan in options', () => { - return config.mergeDefaults({ projectRoot: '/foo/bar/' }, { morgan: false }) + return config.mergeDefaults({ projectRoot: '/foo/bar/', supportFile: false }, { morgan: false }) .then((cfg) => { expect(cfg.morgan).to.be.false }) }) it('can override isTextTerminal in options', () => { - return config.mergeDefaults({ projectRoot: '/foo/bar/' }, { isTextTerminal: true }) + return config.mergeDefaults({ projectRoot: '/foo/bar/', supportFile: false }, { isTextTerminal: true }) .then((cfg) => { expect(cfg.isTextTerminal).to.be.true }) }) it('can override socketId in options', () => { - return config.mergeDefaults({ projectRoot: '/foo/bar/' }, { socketId: '1234' }) + return config.mergeDefaults({ projectRoot: '/foo/bar/', supportFile: false }, { socketId: '1234' }) .then((cfg) => { expect(cfg.socketId).to.eq('1234') }) @@ -1295,6 +1296,7 @@ describe('lib/config', () => { it('deletes envFile', () => { const obj = { projectRoot: '/foo/bar/', + supportFile: false, env: { foo: 'bar', version: '0.5.2', @@ -1322,6 +1324,7 @@ describe('lib/config', () => { it('merges env into @config.env', () => { const obj = { projectRoot: '/foo/bar/', + supportFile: false, env: { host: 'localhost', user: 'brian', @@ -1404,6 +1407,7 @@ describe('lib/config', () => { it('sets reporter and port to cli', () => { const obj = { projectRoot: '/foo/bar', + supportFile: false, } const options = { @@ -1456,7 +1460,7 @@ describe('lib/config', () => { screenshotOnRunFailure: { value: true, from: 'default' }, screenshotsFolder: { value: 'cypress/screenshots', from: 'default' }, slowTestThreshold: { value: 10000, from: 'default' }, - supportFile: { value: 'cypress/support', from: 'default' }, + supportFile: { value: false, from: 'config' }, supportFolder: { value: false, from: 'default' }, taskTimeout: { value: 60000, from: 'default' }, specPattern: { value: '**/*.*', from: 'default' }, @@ -1484,6 +1488,7 @@ describe('lib/config', () => { const obj = { projectRoot: '/foo/bar', + supportFile: false, baseUrl: 'http://localhost:8080', port: 2020, env: { @@ -1566,7 +1571,7 @@ describe('lib/config', () => { screenshotOnRunFailure: { value: true, from: 'default' }, screenshotsFolder: { value: 'cypress/screenshots', from: 'default' }, slowTestThreshold: { value: 10000, from: 'default' }, - supportFile: { value: 'cypress/support', from: 'default' }, + supportFile: { value: false, from: 'config' }, supportFolder: { value: false, from: 'default' }, taskTimeout: { value: 60000, from: 'default' }, specPattern: { value: '**/*.*', from: 'default' }, @@ -1992,7 +1997,7 @@ describe('lib/config', () => { context('.setSupportFileAndFolder', () => { const mockSupportDefaults = { - supportFile: 'cypress/support', + supportFile: 'cypress/support/e2e.ts', supportFolder: false, configFile: 'cypress.json', } @@ -2031,14 +2036,14 @@ describe('lib/config', () => { const obj = config.setAbsolutePaths({ projectRoot, - supportFile: 'cypress/support', + supportFile: 'cypress/support/e2e.js', }) return config.setSupportFileAndFolder(obj, mockSupportDefaults) .then((result) => { expect(result).to.eql({ projectRoot, - supportFile: `${projectRoot}/cypress/support/index.js`, + supportFile: `${projectRoot}/cypress/support/e2e.js`, supportFolder: `${projectRoot}/cypress/support`, }) }) @@ -2049,7 +2054,7 @@ describe('lib/config', () => { const obj = config.setAbsolutePaths({ projectRoot, - supportFile: 'cypress/support', + supportFile: false, }) return config.setSupportFileAndFolder(obj, mockSupportDefaults) @@ -2083,11 +2088,11 @@ describe('lib/config', () => { const e = new Error('Cannot resolve TS file by default') e.code = 'MODULE_NOT_FOUND' - sinon.stub(config.utils, 'resolveModule').withArgs(supportFolder).throws(e) + sinon.stub(config.utils, 'resolveModule').withArgs(supportFilename).throws(e) const obj = config.setAbsolutePaths({ projectRoot, - supportFile: 'cypress/support', + supportFile: 'cypress/support/index.ts', }) return config.setSupportFileAndFolder(obj, mockSupportDefaults) diff --git a/packages/server/test/unit/files_spec.js b/packages/server/test/unit/files_spec.js index 5a4b5b54db..b65f11528a 100644 --- a/packages/server/test/unit/files_spec.js +++ b/packages/server/test/unit/files_spec.js @@ -14,12 +14,12 @@ describe('lib/files', () => { this.todosPath = FixturesHelper.projectPath('todos') - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return config.get(this.todosPath).then((cfg) => { this.config = cfg; ({ projectRoot: this.projectRoot } = cfg) - ctx.actions.project.setCurrentProjectForTestSetup(this.projectRoot) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.projectRoot) }) }) diff --git a/packages/server/test/unit/fixture_spec.js b/packages/server/test/unit/fixture_spec.js index 4c3ab7660e..cb336b7fa0 100644 --- a/packages/server/test/unit/fixture_spec.js +++ b/packages/server/test/unit/fixture_spec.js @@ -26,7 +26,7 @@ describe('lib/fixture', () => { return fs.readFileAsync(path.join(folder, image), encoding) } - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return config.get(this.todosPath) .then((cfg) => { @@ -179,7 +179,7 @@ Expecting 'EOF', '}', ':', ',', ']', got 'STRING'\ it('can load a fixture with no extension when a same-named folder also exists', () => { const projectPath = FixturesHelper.projectPath('folder-same-as-fixture') - ctx.actions.project.setCurrentProjectForTestSetup(projectPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(projectPath) return config.get(projectPath) .then((cfg) => { diff --git a/packages/server/test/unit/plugins/index_spec.js b/packages/server/test/unit/plugins/index_spec.js index 72b29b326d..044528391b 100644 --- a/packages/server/test/unit/plugins/index_spec.js +++ b/packages/server/test/unit/plugins/index_spec.js @@ -33,7 +33,7 @@ describe.skip('lib/plugins/index', () => { configFile: `${todosPath}/cypress.config.js`, } - ctx.setCurrentProjectForTestSetup(todosPath) + ctx.setCurrentProjectAndTestingTypeForTestSetup(todosPath) getOptions = (overrides = {}) => { return { diff --git a/packages/server/test/unit/project_spec.js b/packages/server/test/unit/project_spec.js index 3e7c18224a..685581d59f 100644 --- a/packages/server/test/unit/project_spec.js +++ b/packages/server/test/unit/project_spec.js @@ -1,6 +1,5 @@ require('../spec_helper') -const mockedEnv = require('mocked-env') const path = require('path') const chokidar = require('chokidar') const pkg = require('@packages/root') @@ -40,7 +39,7 @@ describe.skip('lib/project-base', () => { sinon.stub(runEvents, 'execute').resolves() - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return settings.read(this.todosPath) .then((obj = {}) => { @@ -300,7 +299,7 @@ This option will not have an effect in Some-other-name. Tests that rely on web s return this.project.open().then(() => { expect(this.checkSupportFileStub).to.be.calledWith({ configFile: 'cypress.config.js', - supportFile: '/foo/bar/cypress/support/index.js', + supportFile: false, }) }) }) @@ -532,72 +531,6 @@ This option will not have an effect in Some-other-name. Tests that rely on web s }) }) - context('#scaffold', () => { - beforeEach(function () { - this.project = new ProjectBase({ projectRoot: '/_test-output/path/to/project-e2e', testingType: 'e2e' }) - sinon.stub(scaffold, 'integration').resolves() - sinon.stub(scaffold, 'fixture').resolves() - sinon.stub(scaffold, 'support').resolves() - sinon.stub(scaffold, 'plugins').resolves() - - this.obj = { projectRoot: 'pr', fixturesFolder: 'ff', integrationFolder: 'if', supportFolder: 'sf', pluginsFile: 'pf/index.js' } - }) - - it('calls support.scaffold with supportFolder', function () { - return this.project.scaffold(this.obj).then(() => { - expect(scaffold.support).to.be.calledWith(this.obj.supportFolder) - }) - }) - - it('does not call support.plugins if config.pluginsFile is falsey', function () { - this.obj.pluginsFile = false - - return this.project.scaffold(this.obj).then(() => { - expect(scaffold.plugins).not.to.be.called - }) - }) - - describe('forced', () => { - let resetEnv - - beforeEach(function () { - this.obj.isTextTerminal = true - resetEnv = mockedEnv({ - CYPRESS_INTERNAL_FORCE_SCAFFOLD: '1', - }) - }) - - afterEach(() => { - resetEnv() - }) - }) - - describe('not forced', () => { - let resetEnv - - beforeEach(function () { - this.obj.isTextTerminal = true - - resetEnv = mockedEnv({ - CYPRESS_INTERNAL_FORCE_SCAFFOLD: undefined, - }) - }) - - afterEach(() => { - resetEnv() - }) - - it('does not scaffold integration folder', function () { - return this.project.scaffold(this.obj).then(() => { - expect(scaffold.integration).to.not.be.calledWith(this.obj.integrationFolder) - expect(scaffold.fixture).to.not.be.calledWith(this.obj.fixturesFolder) - // still scaffolds support folder due to old logic - expect(scaffold.support).to.be.calledWith(this.obj.supportFolder) - }) - }) - }) - }) - context('#startWebsockets', () => { beforeEach(function () { this.project = new ProjectBase({ projectRoot: '/_test-output/path/to/project-e2e', testingType: 'e2e' }) diff --git a/packages/server/test/unit/project_utils_spec.ts b/packages/server/test/unit/project_utils_spec.ts index b64d54a39e..a76a0ac14a 100644 --- a/packages/server/test/unit/project_utils_spec.ts +++ b/packages/server/test/unit/project_utils_spec.ts @@ -143,7 +143,7 @@ describe('lib/project_utils', () => { try { await checkSupportFile({ configFile: 'cypress.config.ts', - supportFile: '/this/file/does/not/exist/foo/bar/cypress/support/index.js', + supportFile: '/this/file/does/not/exist/foo/bar/cypress/support/e2e.js', }) } catch (e) { expect(e.message).to.include('The support file is missing or invalid.') diff --git a/packages/server/test/unit/screenshots_spec.js b/packages/server/test/unit/screenshots_spec.js index 98b0efc686..cc2493e8bd 100644 --- a/packages/server/test/unit/screenshots_spec.js +++ b/packages/server/test/unit/screenshots_spec.js @@ -60,7 +60,7 @@ describe('lib/screenshots', () => { Jimp.prototype.composite = sinon.stub() // Jimp.prototype.getBuffer = sinon.stub().resolves(@buffer) - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return config.get(this.todosPath) .then((config1) => { diff --git a/packages/server/test/unit/server_spec.js b/packages/server/test/unit/server_spec.js index 860c783bdb..eac973efca 100644 --- a/packages/server/test/unit/server_spec.js +++ b/packages/server/test/unit/server_spec.js @@ -22,7 +22,7 @@ describe('lib/server', () => { beforeEach(function () { this.server = new ServerE2E() - return config.setupFullConfigWithDefaults({ projectRoot: '/foo/bar/' }) + return config.setupFullConfigWithDefaults({ projectRoot: '/foo/bar/', config: { supportFile: false } }) .then((cfg) => { this.config = cfg }) diff --git a/packages/server/test/unit/socket_spec.js b/packages/server/test/unit/socket_spec.js index f2dbaaff0d..bc0ed9c752 100644 --- a/packages/server/test/unit/socket_spec.js +++ b/packages/server/test/unit/socket_spec.js @@ -32,7 +32,7 @@ describe('lib/socket', () => { this.server = new ServerE2E(ctx) - ctx.actions.project.setCurrentProjectForTestSetup(this.todosPath) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.todosPath) return config.get(this.todosPath) .then((cfg) => { diff --git a/packages/server/test/unit/util/settings_spec.js b/packages/server/test/unit/util/settings_spec.js index 089cea61d3..592ed17445 100644 --- a/packages/server/test/unit/util/settings_spec.js +++ b/packages/server/test/unit/util/settings_spec.js @@ -18,7 +18,7 @@ describe.skip('lib/util/settings', () => { context('with default configFile option', () => { beforeEach(function () { this.setup = (obj = {}) => { - ctx.actions.project.setCurrentProjectForTestSetup(projectRoot) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(projectRoot) return fs.writeFileAsync('cypress.config.js', `module.exports = ${JSON.stringify(obj)}`) } @@ -98,7 +98,7 @@ describe.skip('lib/util/settings', () => { it('.read returns from configFile when its a JavaScript file', function () { this.projectRoot = path.join(projectRoot, '_test-output/path/to/project/') - ctx.actions.project.setCurrentProjectForTestSetup(this.projectRoot) + ctx.actions.project.setCurrentProjectAndTestingTypeForTestSetup(this.projectRoot) return fs.ensureDirAsync(this.projectRoot) .then(() => { diff --git a/packages/ui-components/cypress/support/index.js b/packages/ui-components/cypress/support/e2e.js similarity index 100% rename from packages/ui-components/cypress/support/index.js rename to packages/ui-components/cypress/support/e2e.js diff --git a/system-tests/__snapshots__/busted_support_file_spec.js b/system-tests/__snapshots__/busted_support_file_spec.js index e1d079c318..33db09cdab 100644 --- a/system-tests/__snapshots__/busted_support_file_spec.js +++ b/system-tests/__snapshots__/busted_support_file_spec.js @@ -18,12 +18,12 @@ exports['e2e busted support file passes 1'] = ` Oops...we found an error preparing this test file: - cypress/support/index.js + cypress/support/e2e.js The error was: Error: Webpack Compilation Error -./cypress/support/index.js +./cypress/support/e2e.js Module not found: Error: Can't resolve './does/not/exist' in '/foo/bar/.projects/busted-support-file/cypress/support' Looked for and couldn't find the file at the following paths: [/foo/bar/.projects/busted-support-file/cypress/support/package.json] @@ -36,7 +36,7 @@ Looked for and couldn't find the file at the following paths: [/foo/bar/.projects/busted-support-file/cypress/support/does/not/exist.coffee] [/foo/bar/.projects/busted-support-file/cypress/support/does/not/exist.ts] [/foo/bar/.projects/busted-support-file/cypress/support/does/not/exist.tsx] - @ ./cypress/support/index.js 3:0-27 + @ ./cypress/support/e2e.js 3:0-27 [stack trace lines] diff --git a/system-tests/projects/browser-extensions/cypress.config.js b/system-tests/projects/browser-extensions/cypress.config.js index 1973d7d594..848fbdc822 100644 --- a/system-tests/projects/browser-extensions/cypress.config.js +++ b/system-tests/projects/browser-extensions/cypress.config.js @@ -2,6 +2,7 @@ const path = require('path') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser, options) => { options.extensions.push(path.join(__dirname, '../plugin-extension/ext')) diff --git a/system-tests/projects/busted-support-file/cypress/support/index.js b/system-tests/projects/busted-support-file/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/busted-support-file/cypress/support/index.js rename to system-tests/projects/busted-support-file/cypress/support/e2e.js diff --git a/system-tests/projects/chrome-browser-preferences/cypress.config.js b/system-tests/projects/chrome-browser-preferences/cypress.config.js index a300564eec..07b1e6d8e8 100644 --- a/system-tests/projects/chrome-browser-preferences/cypress.config.js +++ b/system-tests/projects/chrome-browser-preferences/cypress.config.js @@ -5,6 +5,7 @@ const path = require('path') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const parentPid = process.ppid let { PATH_TO_CHROME_PROFILE } = config.env diff --git a/system-tests/projects/component-tests/cypress/support/index.js b/system-tests/projects/component-tests/cypress/support/component.js similarity index 100% rename from system-tests/projects/component-tests/cypress/support/index.js rename to system-tests/projects/component-tests/cypress/support/component.js diff --git a/system-tests/projects/ids/cypress/support/index.js b/system-tests/projects/component-tests/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/ids/cypress/support/index.js rename to system-tests/projects/component-tests/cypress/support/e2e.js diff --git a/system-tests/projects/config-with-custom-file-js/cypress.config.custom.js b/system-tests/projects/config-with-custom-file-js/cypress.config.custom.js index b6ba20b44b..3ac8b332b5 100644 --- a/system-tests/projects/config-with-custom-file-js/cypress.config.custom.js +++ b/system-tests/projects/config-with-custom-file-js/cypress.config.custom.js @@ -3,6 +3,7 @@ const { defineConfig } = require('cypress') module.exports = defineConfig({ pageLoadTimeout: 10000, e2e: { + supportFile: false, specPattern: 'cypress/integration/**/*', defaultCommandTimeout: 500, videoCompression: 20, diff --git a/system-tests/projects/config-with-custom-file-ts/cypress.config.custom.ts b/system-tests/projects/config-with-custom-file-ts/cypress.config.custom.ts index fafadfaf9f..5200819148 100644 --- a/system-tests/projects/config-with-custom-file-ts/cypress.config.custom.ts +++ b/system-tests/projects/config-with-custom-file-ts/cypress.config.custom.ts @@ -1,6 +1,7 @@ const config: Record = { pageLoadTimeout: 10000, e2e: { + supportFile: false, defaultCommandTimeout: 500, videoCompression: 20, }, diff --git a/system-tests/projects/plugin-returns-bad-config/cypress/support/index.js b/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js similarity index 92% rename from system-tests/projects/plugin-returns-bad-config/cypress/support/index.js rename to system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js index d68db96df2..d1dd1353e8 100644 --- a/system-tests/projects/plugin-returns-bad-config/cypress/support/index.js +++ b/system-tests/projects/config-with-invalid-browser/cypress/support/e2e.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/e2e.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/system-tests/projects/config-with-invalid-viewport/cypress.config.js b/system-tests/projects/config-with-invalid-viewport/cypress.config.js index cda4d27347..d6953fff63 100644 --- a/system-tests/projects/config-with-invalid-viewport/cypress.config.js +++ b/system-tests/projects/config-with-invalid-viewport/cypress.config.js @@ -1,3 +1,6 @@ module.exports = { 'viewportWidth': 'foo', + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/config-with-js/cypress.config.js b/system-tests/projects/config-with-js/cypress.config.js index d95722d5dd..ae5c5a13e5 100644 --- a/system-tests/projects/config-with-js/cypress.config.js +++ b/system-tests/projects/config-with-js/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { pageLoadTimeout: 10000, e2e: { + supportFile: false, defaultCommandTimeout: 500, videoCompression: 20, }, diff --git a/system-tests/projects/config-with-short-timeout/cypress.config.js b/system-tests/projects/config-with-short-timeout/cypress.config.js index dfb84e7cd1..d32c9ac622 100644 --- a/system-tests/projects/config-with-short-timeout/cypress.config.js +++ b/system-tests/projects/config-with-short-timeout/cypress.config.js @@ -1,5 +1,7 @@ module.exports = { 'defaultCommandTimeout': 1000, 'pluginsFile': false, - 'supportFile': false, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/config-with-ts/cypress.config.ts b/system-tests/projects/config-with-ts/cypress.config.ts index ec331922c7..f9aceae5a4 100644 --- a/system-tests/projects/config-with-ts/cypress.config.ts +++ b/system-tests/projects/config-with-ts/cypress.config.ts @@ -3,5 +3,6 @@ export default { e2e: { defaultCommandTimeout: 500, videoCompression: 20, + supportFile: false, }, } diff --git a/system-tests/projects/cookies/cypress.config.js b/system-tests/projects/cookies/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/cookies/cypress.config.js +++ b/system-tests/projects/cookies/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/default-layout/cypress.config.js b/system-tests/projects/default-layout/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/default-layout/cypress.config.js +++ b/system-tests/projects/default-layout/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/downloads/cypress.config.js b/system-tests/projects/downloads/cypress.config.js index 3a77c847f0..f26c94ab10 100644 --- a/system-tests/projects/downloads/cypress.config.js +++ b/system-tests/projects/downloads/cypress.config.js @@ -1,5 +1,7 @@ module.exports = { 'fixturesFolder': false, 'pluginsFile': false, - 'supportFile': false, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/e2e/cypress.config.js b/system-tests/projects/e2e/cypress.config.js index c766456188..07786cb432 100644 --- a/system-tests/projects/e2e/cypress.config.js +++ b/system-tests/projects/e2e/cypress.config.js @@ -8,6 +8,7 @@ module.exports = { }, }, 'component': { + 'supportFile': false, 'specPattern': 'cypress/component/**/*spec.js', devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') diff --git a/system-tests/projects/e2e/cypress/support/index.js b/system-tests/projects/e2e/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/e2e/cypress/support/index.js rename to system-tests/projects/e2e/cypress/support/e2e.js diff --git a/system-tests/projects/failures/cypress.config.js b/system-tests/projects/failures/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/failures/cypress.config.js +++ b/system-tests/projects/failures/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/firefox-memory/cypress.config.js b/system-tests/projects/firefox-memory/cypress.config.js index 56782c2629..c356794e2b 100644 --- a/system-tests/projects/firefox-memory/cypress.config.js +++ b/system-tests/projects/firefox-memory/cypress.config.js @@ -9,6 +9,7 @@ let intervalId module.exports = { 'e2e': { + supportFile: false, setupNodeEvents (on, config) { on('task', { 'console' (...args) { diff --git a/system-tests/projects/fixture-subfolder-of-integration/cypress.config.js b/system-tests/projects/fixture-subfolder-of-integration/cypress.config.js index 6059a204d2..553ea16697 100644 --- a/system-tests/projects/fixture-subfolder-of-integration/cypress.config.js +++ b/system-tests/projects/fixture-subfolder-of-integration/cypress.config.js @@ -1,9 +1,9 @@ module.exports = { 'pluginsFile': false, - 'supportFile': false, 'integrationFolder': 'test', 'fixturesFolder': 'test/fixtures', 'e2e': { 'specPattern': '**/*spec.js', + 'supportFile': false, }, } diff --git a/system-tests/projects/folder-same-as-fixture/cypress.config.js b/system-tests/projects/folder-same-as-fixture/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/folder-same-as-fixture/cypress.config.js +++ b/system-tests/projects/folder-same-as-fixture/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/hooks-after-rerun/cypress/support/index.js b/system-tests/projects/hooks-after-rerun/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/hooks-after-rerun/cypress/support/index.js rename to system-tests/projects/hooks-after-rerun/cypress/support/e2e.js diff --git a/system-tests/projects/ids/cypress/support/e2e.js b/system-tests/projects/ids/cypress/support/e2e.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system-tests/projects/integration-outside-project-root/project-root/cypress.config.js b/system-tests/projects/integration-outside-project-root/project-root/cypress.config.js index 0f2dc30b98..b94c92b7a7 100644 --- a/system-tests/projects/integration-outside-project-root/project-root/cypress.config.js +++ b/system-tests/projects/integration-outside-project-root/project-root/cypress.config.js @@ -1,3 +1,6 @@ module.exports = { 'integrationFolder': '../integration', + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/issue-8111-iframe-input/cypress.config.js b/system-tests/projects/issue-8111-iframe-input/cypress.config.js index 1e55b733bb..a659c563b6 100644 --- a/system-tests/projects/issue-8111-iframe-input/cypress.config.js +++ b/system-tests/projects/issue-8111-iframe-input/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'supportFolder': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser, launchOptions) => { launchOptions.args.push('--auto-open-devtools-for-tabs') diff --git a/system-tests/projects/launchpad/cypress.config.js b/system-tests/projects/launchpad/cypress.config.js index 1770fed183..ddf635700c 100644 --- a/system-tests/projects/launchpad/cypress.config.js +++ b/system-tests/projects/launchpad/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { - supportFile: false, pluginsFile: false, - e2e: {}, + e2e: { + supportFile: false, + }, } diff --git a/system-tests/projects/max-listeners/cypress.config.js b/system-tests/projects/max-listeners/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/max-listeners/cypress.config.js +++ b/system-tests/projects/max-listeners/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/multiple-task-registrations/cypress.config.js b/system-tests/projects/multiple-task-registrations/cypress.config.js index d30ce74cd9..03ddb00317 100644 --- a/system-tests/projects/multiple-task-registrations/cypress.config.js +++ b/system-tests/projects/multiple-task-registrations/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('task', { 'one' () { diff --git a/system-tests/projects/multiples-config-files-with-json/cypress.config.js b/system-tests/projects/multiples-config-files-with-json/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/multiples-config-files-with-json/cypress.config.js +++ b/system-tests/projects/multiples-config-files-with-json/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/no-scaffolding/cypress.config.js b/system-tests/projects/no-scaffolding/cypress.config.js index 54497f5a24..d12d96d7e3 100644 --- a/system-tests/projects/no-scaffolding/cypress.config.js +++ b/system-tests/projects/no-scaffolding/cypress.config.js @@ -1,3 +1,5 @@ module.exports = { - e2e: {}, + e2e: { + supportFile: false, + }, } diff --git a/system-tests/projects/no-scaffolding/cypress/support/e2e.js b/system-tests/projects/no-scaffolding/cypress/support/e2e.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system-tests/projects/no-specs-found/cypress.config.js b/system-tests/projects/no-specs-found/cypress.config.js index 2a12659425..d1cc72b83e 100644 --- a/system-tests/projects/no-specs-found/cypress.config.js +++ b/system-tests/projects/no-specs-found/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { e2e: { + supportFile: false, specPattern: '**/*.no-specs-found-with-this-pattern', }, } diff --git a/system-tests/projects/non-existent-spec/cypress.config.js b/system-tests/projects/non-existent-spec/cypress.config.js index eed09b1f26..89926ef515 100644 --- a/system-tests/projects/non-existent-spec/cypress.config.js +++ b/system-tests/projects/non-existent-spec/cypress.config.js @@ -1,6 +1,6 @@ module.exports = { - 'supportFile': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('file:preprocessor', () => '/does/not/exist.js') diff --git a/system-tests/projects/non-proxied/cypress.config.js b/system-tests/projects/non-proxied/cypress.config.js index e29fd79b14..224732b692 100644 --- a/system-tests/projects/non-proxied/cypress.config.js +++ b/system-tests/projects/non-proxied/cypress.config.js @@ -5,6 +5,7 @@ const socketIo = require('@packages/socket/lib/browser') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('task', { 'get:tmp:path': () => { diff --git a/system-tests/projects/odd-directory-name/cypress.config.js b/system-tests/projects/odd-directory-name/cypress.config.js index 4ba52ba2c8..341f3c7182 100644 --- a/system-tests/projects/odd-directory-name/cypress.config.js +++ b/system-tests/projects/odd-directory-name/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + 'e2e': { + 'supportFile': false, + }, +} diff --git a/system-tests/projects/plugin-after-screenshot/cypress.config.js b/system-tests/projects/plugin-after-screenshot/cypress.config.js index b7b5388940..4370a5834a 100644 --- a/system-tests/projects/plugin-after-screenshot/cypress.config.js +++ b/system-tests/projects/plugin-after-screenshot/cypress.config.js @@ -4,6 +4,7 @@ const replacementPath = path.join(__dirname, './screenshot-replacement.png') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('after:screenshot', (details) => { if (details.testFailure) { diff --git a/system-tests/projects/plugin-after-spec-deletes-video/cypress.config.js b/system-tests/projects/plugin-after-spec-deletes-video/cypress.config.js index 742de8a60c..5aefb7ff45 100644 --- a/system-tests/projects/plugin-after-spec-deletes-video/cypress.config.js +++ b/system-tests/projects/plugin-after-spec-deletes-video/cypress.config.js @@ -2,8 +2,8 @@ const fs = require('fs-extra') module.exports = { 'fixturesFolder': false, - 'supportFile': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('after:spec', (spec, results) => { return fs.remove(results.video) diff --git a/system-tests/projects/plugin-before-browser-launch-deprecation/cypress.config.js b/system-tests/projects/plugin-before-browser-launch-deprecation/cypress.config.js index db8cee057e..a11f5630e8 100644 --- a/system-tests/projects/plugin-before-browser-launch-deprecation/cypress.config.js +++ b/system-tests/projects/plugin-before-browser-launch-deprecation/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + supportFile: false, specPattern: 'cypress/integration/**/*', setupNodeEvents (on, config) { const plugin = require('./plugins') diff --git a/system-tests/projects/plugin-browser/cypress.config.js b/system-tests/projects/plugin-browser/cypress.config.js index ab95387dfe..f9360cdc0e 100644 --- a/system-tests/projects/plugin-browser/cypress.config.js +++ b/system-tests/projects/plugin-browser/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser) => { const { name } = browser diff --git a/system-tests/projects/plugin-config-version/cypress.config.js b/system-tests/projects/plugin-config-version/cypress.config.js index f6816c3402..6482a9fc78 100644 --- a/system-tests/projects/plugin-config-version/cypress.config.js +++ b/system-tests/projects/plugin-config-version/cypress.config.js @@ -2,6 +2,7 @@ const semver = require('semver') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { if (!semver.valid(config.version)) { throw new Error('config.version is invalid') diff --git a/system-tests/projects/plugin-config/cypress.config.js b/system-tests/projects/plugin-config/cypress.config.js index 13759007dd..0b826cf49d 100644 --- a/system-tests/projects/plugin-config/cypress.config.js +++ b/system-tests/projects/plugin-config/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { if (config.testingType !== 'e2e') { throw Error(`This is an e2e testing project. testingType should be 'e2e'. Received ${config.testingType}`) diff --git a/system-tests/projects/plugin-empty/cypress.config.js b/system-tests/projects/plugin-empty/cypress.config.js index 3486efa527..e13aecf2b2 100644 --- a/system-tests/projects/plugin-empty/cypress.config.js +++ b/system-tests/projects/plugin-empty/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { - setupNodeEvents: 'foo', + 'supportFile': false, + 'setupNodeEvents': 'foo', }, } diff --git a/system-tests/projects/plugin-event-deprecated/cypress.config.js b/system-tests/projects/plugin-event-deprecated/cypress.config.js index dc916875b2..160b2aa795 100644 --- a/system-tests/projects/plugin-event-deprecated/cypress.config.js +++ b/system-tests/projects/plugin-event-deprecated/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { if (config.env.NO_MUTATE_RETURN) { on('before:browser:launch', (browser, options) => { diff --git a/system-tests/projects/plugin-extension/cypress.config.js b/system-tests/projects/plugin-extension/cypress.config.js index fb2d82c860..39b5651b66 100644 --- a/system-tests/projects/plugin-extension/cypress.config.js +++ b/system-tests/projects/plugin-extension/cypress.config.js @@ -2,6 +2,7 @@ const path = require('path') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser = {}, options) => { const pathToExt = path.resolve('ext') diff --git a/system-tests/projects/plugin-filter-browsers/cypress.config.js b/system-tests/projects/plugin-filter-browsers/cypress.config.js index 6aaca328f3..dd80230eba 100644 --- a/system-tests/projects/plugin-filter-browsers/cypress.config.js +++ b/system-tests/projects/plugin-filter-browsers/cypress.config.js @@ -2,6 +2,7 @@ const debug = require('debug')('cypress:system-tests') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { debug('plugin file %s', __filename) debug('received config with browsers %o', config.browsers) diff --git a/system-tests/projects/plugin-retries/cypress.config.js b/system-tests/projects/plugin-retries/cypress.config.js index 4ba52ba2c8..341f3c7182 100644 --- a/system-tests/projects/plugin-retries/cypress.config.js +++ b/system-tests/projects/plugin-retries/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + 'e2e': { + 'supportFile': false, + }, +} diff --git a/npm/react/examples/craco/cypress/support/index.js b/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js similarity index 92% rename from npm/react/examples/craco/cypress/support/index.js rename to system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js index d68db96df2..d1dd1353e8 100644 --- a/npm/react/examples/craco/cypress/support/index.js +++ b/system-tests/projects/plugin-returns-bad-config/cypress/support/e2e.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/e2e.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/npm/webpack-preprocessor/cypress/support/index.js b/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js similarity index 92% rename from npm/webpack-preprocessor/cypress/support/index.js rename to system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js index d68db96df2..d1dd1353e8 100644 --- a/npm/webpack-preprocessor/cypress/support/index.js +++ b/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/e2e.js @@ -1,5 +1,5 @@ // *********************************************************** -// This example support/index.js is processed and +// This example support/e2e.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and diff --git a/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/index.js b/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/index.js deleted file mode 100644 index d68db96df2..0000000000 --- a/system-tests/projects/plugin-returns-empty-browsers-list/cypress/support/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your 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/configuration -// *********************************************************** - -// 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 new file mode 100644 index 0000000000..d1dd1353e8 --- /dev/null +++ b/system-tests/projects/plugin-returns-invalid-browser/cypress/support/e2e.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.js is processed and +// loaded automatically before your 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/configuration +// *********************************************************** + +// 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/index.js b/system-tests/projects/plugin-returns-invalid-browser/cypress/support/index.js deleted file mode 100644 index d68db96df2..0000000000 --- a/system-tests/projects/plugin-returns-invalid-browser/cypress/support/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your 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/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/plugin-run-event-throws/cypress.config.js b/system-tests/projects/plugin-run-event-throws/cypress.config.js index c17c7969b1..f6609e0864 100644 --- a/system-tests/projects/plugin-run-event-throws/cypress.config.js +++ b/system-tests/projects/plugin-run-event-throws/cypress.config.js @@ -1,7 +1,7 @@ module.exports = { 'fixturesFolder': false, - 'supportFile': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:spec', () => { throw new Error('error thrown in before:spec') diff --git a/system-tests/projects/plugin-run-events/cypress.config.js b/system-tests/projects/plugin-run-events/cypress.config.js index 23cfcd4c63..1efbc63b0f 100644 --- a/system-tests/projects/plugin-run-events/cypress.config.js +++ b/system-tests/projects/plugin-run-events/cypress.config.js @@ -3,8 +3,8 @@ const Promise = require('bluebird') module.exports = { 'fixturesFolder': false, - 'supportFile': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:run', (runDetails) => { const { specs, browser } = runDetails diff --git a/system-tests/projects/plugin-validation-error/cypress.config.js b/system-tests/projects/plugin-validation-error/cypress.config.js index 1ef8256507..68e0121ee0 100644 --- a/system-tests/projects/plugin-validation-error/cypress.config.js +++ b/system-tests/projects/plugin-validation-error/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('invalid:event', () => {}) diff --git a/system-tests/projects/plugins-absolute-path/cypress.config.js b/system-tests/projects/plugins-absolute-path/cypress.config.js index a31ec0f24e..a652c8d861 100644 --- a/system-tests/projects/plugins-absolute-path/cypress.config.js +++ b/system-tests/projects/plugins-absolute-path/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('task', { 'returns:arg' (arg) { diff --git a/system-tests/projects/plugins-async-error/cypress.config.js b/system-tests/projects/plugins-async-error/cypress.config.js index f0e1b976c9..1dbdf12b40 100644 --- a/system-tests/projects/plugins-async-error/cypress.config.js +++ b/system-tests/projects/plugins-async-error/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('file:preprocessor', () => { return new Promise(() => { diff --git a/system-tests/projects/pristine-with-config-file/cypress/support/e2e.js b/system-tests/projects/pristine-with-config-file/cypress/support/e2e.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system-tests/projects/react-code-gen/cypress.config.js b/system-tests/projects/react-code-gen/cypress.config.js index 70749d407e..f959a842e2 100644 --- a/system-tests/projects/react-code-gen/cypress.config.js +++ b/system-tests/projects/react-code-gen/cypress.config.js @@ -1,6 +1,6 @@ module.exports = { - supportFile: 'cypress/component/support.js', component: { + supportFile: 'cypress/component/support.js', specPattern: 'src/**/*.cy.{js,jsx}', devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') @@ -8,4 +8,7 @@ module.exports = { return startDevServer({ options: cypressConfig, ...devServerConfig }) }, }, + e2e: { + supportFile: 'cypress/component/support.js', + }, } diff --git a/system-tests/projects/read-only-project-root/cypress.config.js b/system-tests/projects/read-only-project-root/cypress.config.js index 7a2aec9774..f93b8ac8be 100644 --- a/system-tests/projects/read-only-project-root/cypress.config.js +++ b/system-tests/projects/read-only-project-root/cypress.config.js @@ -5,6 +5,7 @@ const { expect } = require('chai') module.exports = { 'retries': null, 'e2e': { + 'supportFile': 'cypress/support.js', setupNodeEvents (on, config) { expect(process.geteuid()).to.not.eq(0) console.log('✅ not running as root') diff --git a/system-tests/projects/record/cypress.config.js b/system-tests/projects/record/cypress.config.js index 1ab524bb9f..964eb46d56 100644 --- a/system-tests/projects/record/cypress.config.js +++ b/system-tests/projects/record/cypress.config.js @@ -1,4 +1,6 @@ module.exports = { - 'projectId': 'abc123', - e2e: {}, + projectId: 'abc123', + e2e: { + supportFile: false, + }, } diff --git a/system-tests/projects/remote-debugging-disconnect/cypress.config.js b/system-tests/projects/remote-debugging-disconnect/cypress.config.js index 54da0ea044..685ba07bd5 100644 --- a/system-tests/projects/remote-debugging-disconnect/cypress.config.js +++ b/system-tests/projects/remote-debugging-disconnect/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const plugins = require('./plugins') diff --git a/system-tests/projects/remote-debugging-port-removed/cypress.config.js b/system-tests/projects/remote-debugging-port-removed/cypress.config.js index 7fe4ec2ac9..cdf7022b8c 100644 --- a/system-tests/projects/remote-debugging-port-removed/cypress.config.js +++ b/system-tests/projects/remote-debugging-port-removed/cypress.config.js @@ -2,6 +2,7 @@ const la = require('lazy-ass') module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser = {}, options) => { la(browser.family === 'chromium', 'this test can only be run with a chromium-family browser') diff --git a/system-tests/projects/retries-2/cypress.config.js b/system-tests/projects/retries-2/cypress.config.js index 2f49e4ee97..eda9bbcfd4 100644 --- a/system-tests/projects/retries-2/cypress.config.js +++ b/system-tests/projects/retries-2/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'retries': 2, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const { useFixedBrowserLaunchSize } = require('@tooling/system-tests/lib/pluginUtils') diff --git a/system-tests/projects/same-fixtures-integration-folders/cypress.config.js b/system-tests/projects/same-fixtures-integration-folders/cypress.config.js index 88a6bdbc4e..33a3b432f1 100644 --- a/system-tests/projects/same-fixtures-integration-folders/cypress.config.js +++ b/system-tests/projects/same-fixtures-integration-folders/cypress.config.js @@ -1,6 +1,8 @@ module.exports = { 'pluginsFile': false, - 'supportFile': false, 'fixturesFolder': 'cypress/integration', 'testFiles': '**/*spec.js', + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/screen-size/cypress.config.js b/system-tests/projects/screen-size/cypress.config.js index 82b7982784..59e0960a4c 100644 --- a/system-tests/projects/screen-size/cypress.config.js +++ b/system-tests/projects/screen-size/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('before:browser:launch', (browser, options) => { // options.args.push('-width', '1280', '-height', '1024') diff --git a/system-tests/projects/selectFile/cypress.config.js b/system-tests/projects/selectFile/cypress.config.js index 4ba52ba2c8..d12d96d7e3 100644 --- a/system-tests/projects/selectFile/cypress.config.js +++ b/system-tests/projects/selectFile/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/shadow-dom-global-inclusion/cypress.config.js b/system-tests/projects/shadow-dom-global-inclusion/cypress.config.js index 361b5c94d5..ad3f413325 100644 --- a/system-tests/projects/shadow-dom-global-inclusion/cypress.config.js +++ b/system-tests/projects/shadow-dom-global-inclusion/cypress.config.js @@ -1,5 +1,7 @@ module.exports = { 'includeShadowDom': true, 'pluginsFile': false, - 'supportFile': false, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/spec-generation/cypress.config.js b/system-tests/projects/spec-generation/cypress.config.js index a65b49b7a1..8c7465e84a 100644 --- a/system-tests/projects/spec-generation/cypress.config.js +++ b/system-tests/projects/spec-generation/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'componentFolder': 'src', 'component': { + 'supportFile': false, devServer (cypressConfig, devServerConfig) { const { startDevServer } = require('@cypress/webpack-dev-server') diff --git a/system-tests/projects/spec-name-special-characters/cypress.config.js b/system-tests/projects/spec-name-special-characters/cypress.config.js index 4ba52ba2c8..341f3c7182 100644 --- a/system-tests/projects/spec-name-special-characters/cypress.config.js +++ b/system-tests/projects/spec-name-special-characters/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + 'e2e': { + 'supportFile': false, + }, +} diff --git a/system-tests/projects/studio-no-source-maps/cypress.config.js b/system-tests/projects/studio-no-source-maps/cypress.config.js index b7076fc999..0c6f1142aa 100644 --- a/system-tests/projects/studio-no-source-maps/cypress.config.js +++ b/system-tests/projects/studio-no-source-maps/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'experimentalStudio': true, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const webpackPreprocessor = require('@cypress/webpack-preprocessor') diff --git a/system-tests/projects/studio/cypress/support/index.js b/system-tests/projects/studio/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/studio/cypress/support/index.js rename to system-tests/projects/studio/cypress/support/e2e.js diff --git a/system-tests/projects/studio/cypress/support/external.js b/system-tests/projects/studio/cypress/support/external.js index f5d44d45fe..4a93ce43f4 100644 --- a/system-tests/projects/studio/cypress/support/external.js +++ b/system-tests/projects/studio/cypress/support/external.js @@ -1,4 +1,4 @@ -import { saveStudio, verifyCommandLog } from './index' +import { saveStudio, verifyCommandLog } from './e2e' const isTextTerminal = Cypress.config('isTextTerminal') diff --git a/system-tests/projects/system-node/cypress.config.js b/system-tests/projects/system-node/cypress.config.js index 787963fb42..6d18715ad8 100644 --- a/system-tests/projects/system-node/cypress.config.js +++ b/system-tests/projects/system-node/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { process.stderr.write('Plugin Loaded\n') process.stderr.write(`Plugin Node version: ${process.versions.node}\n`) diff --git a/system-tests/projects/task-not-registered/cypress.config.js b/system-tests/projects/task-not-registered/cypress.config.js index 877daa2db3..000d2da9ba 100644 --- a/system-tests/projects/task-not-registered/cypress.config.js +++ b/system-tests/projects/task-not-registered/cypress.config.js @@ -1,3 +1,6 @@ module.exports = { 'retries': null, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/todos/cypress.config.js b/system-tests/projects/todos/cypress.config.js index 0d57352330..efd213e204 100644 --- a/system-tests/projects/todos/cypress.config.js +++ b/system-tests/projects/todos/cypress.config.js @@ -1,13 +1,14 @@ module.exports = { - 'e2e': { - 'specPattern': 'tests/**/*', - }, 'fixturesFolder': 'tests/_fixtures', - 'supportFile': 'tests/_support/spec_helper.js', 'port': 8888, 'projectId': 'abc123', 'pluginsFile': false, 'component': { 'specFilePattern': 'src/**/*.spec.cy.js', + 'supportFile': 'tests/_support/spec_helper.js', + }, + 'e2e': { + 'supportFile': 'tests/_support/spec_helper.js', + 'specPattern': 'tests/**/*', }, } diff --git a/system-tests/projects/ts-installed/cypress.config.js b/system-tests/projects/ts-installed/cypress.config.js index 4ba52ba2c8..341f3c7182 100644 --- a/system-tests/projects/ts-installed/cypress.config.js +++ b/system-tests/projects/ts-installed/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + 'e2e': { + 'supportFile': false, + }, +} diff --git a/system-tests/projects/ts-proj-custom-names/cypress.config.js b/system-tests/projects/ts-proj-custom-names/cypress.config.js index a7e05e6dbd..c6fba9fa31 100644 --- a/system-tests/projects/ts-proj-custom-names/cypress.config.js +++ b/system-tests/projects/ts-proj-custom-names/cypress.config.js @@ -1,7 +1,6 @@ module.exports = { - 'supportFile': 'cypress/support.ts', - 'pluginsFile': 'cypress/plugins.ts', 'e2e': { + 'supportFile': 'cypress/support.ts', setupNodeEvents (on, config) { on('before:browser:launch', (browser, launchOptions) => { if (browser.family === 'chromium' && browser.name !== 'electron') { diff --git a/system-tests/projects/ts-proj-esmoduleinterop-true/cypress.config.ts b/system-tests/projects/ts-proj-esmoduleinterop-true/cypress.config.ts index cf8bda8059..8375155cf6 100644 --- a/system-tests/projects/ts-proj-esmoduleinterop-true/cypress.config.ts +++ b/system-tests/projects/ts-proj-esmoduleinterop-true/cypress.config.ts @@ -5,5 +5,7 @@ if (commonjsExports.export1 !== 'export1' || commonjsExports.export2 !== 'export } module.exports = { - 'supportFile': false, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/ts-proj-tsconfig-in-plugins/cypress.config.ts b/system-tests/projects/ts-proj-tsconfig-in-plugins/cypress.config.ts index d3220ac1cc..8a8ef046f5 100644 --- a/system-tests/projects/ts-proj-tsconfig-in-plugins/cypress.config.ts +++ b/system-tests/projects/ts-proj-tsconfig-in-plugins/cypress.config.ts @@ -4,5 +4,7 @@ [...Array(100).keys()].map((x) => `${x}`) module.exports = { - 'supportFile': false, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/ts-proj-with-module-esnext/cypress.config.ts b/system-tests/projects/ts-proj-with-module-esnext/cypress.config.ts index 6b55f777ca..cdb0ffec37 100644 --- a/system-tests/projects/ts-proj-with-module-esnext/cypress.config.ts +++ b/system-tests/projects/ts-proj-with-module-esnext/cypress.config.ts @@ -3,6 +3,7 @@ import { asyncGreeting } from './greeting' module.exports = { 'supportFolder': false, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { on('task', { hello: asyncGreeting, diff --git a/system-tests/projects/ts-proj-with-paths/cypress.config.ts b/system-tests/projects/ts-proj-with-paths/cypress.config.ts index 7c080065a6..5150c00adc 100644 --- a/system-tests/projects/ts-proj-with-paths/cypress.config.ts +++ b/system-tests/projects/ts-proj-with-paths/cypress.config.ts @@ -4,4 +4,8 @@ if (appName !== 'Best App Ever') { throw new Error('Path alias not working properly in config file!') } -module.exports = {} +module.exports = { + e2e: { + supportFile: false, + }, +} diff --git a/system-tests/projects/ts-proj/cypress.config.js b/system-tests/projects/ts-proj/cypress.config.js deleted file mode 100644 index 4ba52ba2c8..0000000000 --- a/system-tests/projects/ts-proj/cypress.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {} diff --git a/system-tests/projects/ts-proj/cypress.config.ts b/system-tests/projects/ts-proj/cypress.config.ts new file mode 100644 index 0000000000..ec0a60ca3b --- /dev/null +++ b/system-tests/projects/ts-proj/cypress.config.ts @@ -0,0 +1,5 @@ +module.exports = { + 'e2e': { + 'supportFile': 'cypress/support/e2e.ts', + }, +} diff --git a/system-tests/projects/ts-proj/cypress/support/e2e.ts b/system-tests/projects/ts-proj/cypress/support/e2e.ts new file mode 100644 index 0000000000..ed5730de11 --- /dev/null +++ b/system-tests/projects/ts-proj/cypress/support/e2e.ts @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.ts is processed and +// loaded automatically before your 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/configuration +// *********************************************************** + +// 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/index.ts b/system-tests/projects/ts-proj/cypress/support/index.ts index d68db96df2..e69de29bb2 100644 --- a/system-tests/projects/ts-proj/cypress/support/index.ts +++ b/system-tests/projects/ts-proj/cypress/support/index.ts @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your 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/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/system-tests/projects/uncaught-support-file/cypress/support/index.js b/system-tests/projects/uncaught-support-file/cypress/support/e2e.js similarity index 100% rename from system-tests/projects/uncaught-support-file/cypress/support/index.js rename to system-tests/projects/uncaught-support-file/cypress/support/e2e.js diff --git a/system-tests/projects/unify-onboarding-with-config/cypress.config.js b/system-tests/projects/unify-onboarding-with-config/cypress.config.js index 408cee5af6..77c8491d53 100644 --- a/system-tests/projects/unify-onboarding-with-config/cypress.config.js +++ b/system-tests/projects/unify-onboarding-with-config/cypress.config.js @@ -1,5 +1,6 @@ module.exports = { component: { + supportFile: false, testFiles: '**/*cy-spec.{js,jsx,ts,tsx}', componentFolder: 'src', devServer (cypressConfig) { @@ -14,4 +15,7 @@ module.exports = { } }) }, }, + e2e: { + supportFile: false, + }, } diff --git a/system-tests/projects/unify-onboarding/cypress.config.js b/system-tests/projects/unify-onboarding/cypress.config.js index bc43c55963..afa29287ee 100644 --- a/system-tests/projects/unify-onboarding/cypress.config.js +++ b/system-tests/projects/unify-onboarding/cypress.config.js @@ -12,4 +12,7 @@ module.exports = { } }) }, }, + 'e2e': { + 'supportFile': false, + }, } diff --git a/system-tests/projects/unify-onboarding/cypress/support/component.js b/system-tests/projects/unify-onboarding/cypress/support/component.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system-tests/projects/unify-plugin-errors/cypress.config.js b/system-tests/projects/unify-plugin-errors/cypress.config.js index 75e0d45f29..9f424d1d6b 100644 --- a/system-tests/projects/unify-plugin-errors/cypress.config.js +++ b/system-tests/projects/unify-plugin-errors/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'e2e': { baseUrl: 'https://cypress.com', + supportFile: false, async setupNodeEvents (on, config) { await new Promise((resolve) => setTimeout(resolve, 1000)) diff --git a/system-tests/projects/various-file-types/cypress.config.js b/system-tests/projects/various-file-types/cypress.config.js index 4ba52ba2c8..341f3c7182 100644 --- a/system-tests/projects/various-file-types/cypress.config.js +++ b/system-tests/projects/various-file-types/cypress.config.js @@ -1 +1,5 @@ -module.exports = {} +module.exports = { + 'e2e': { + 'supportFile': false, + }, +} diff --git a/system-tests/projects/webpack-preprocessor-awesome-typescript-loader/cypress.config.js b/system-tests/projects/webpack-preprocessor-awesome-typescript-loader/cypress.config.js index 443ee4df45..c81b867ef6 100644 --- a/system-tests/projects/webpack-preprocessor-awesome-typescript-loader/cypress.config.js +++ b/system-tests/projects/webpack-preprocessor-awesome-typescript-loader/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'retries': null, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const wp = require('@cypress/webpack-preprocessor') const path = require('path') diff --git a/system-tests/projects/webpack-preprocessor-ts-loader-compiler-options/cypress.config.js b/system-tests/projects/webpack-preprocessor-ts-loader-compiler-options/cypress.config.js index 0134d368d1..61b4406e8c 100644 --- a/system-tests/projects/webpack-preprocessor-ts-loader-compiler-options/cypress.config.js +++ b/system-tests/projects/webpack-preprocessor-ts-loader-compiler-options/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'retries': null, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const wp = require('@cypress/webpack-preprocessor') diff --git a/system-tests/projects/webpack-preprocessor-ts-loader/cypress.config.js b/system-tests/projects/webpack-preprocessor-ts-loader/cypress.config.js index 4cf040b71a..defc5a9739 100644 --- a/system-tests/projects/webpack-preprocessor-ts-loader/cypress.config.js +++ b/system-tests/projects/webpack-preprocessor-ts-loader/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'retries': null, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const wp = require('@cypress/webpack-preprocessor') diff --git a/system-tests/projects/webpack-preprocessor/cypress.config.js b/system-tests/projects/webpack-preprocessor/cypress.config.js index ec9f813f83..5dca3f384c 100644 --- a/system-tests/projects/webpack-preprocessor/cypress.config.js +++ b/system-tests/projects/webpack-preprocessor/cypress.config.js @@ -1,6 +1,7 @@ module.exports = { 'retries': null, 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { const proxyquire = require('proxyquire') diff --git a/system-tests/projects/working-preprocessor/cypress/support/e2e.js b/system-tests/projects/working-preprocessor/cypress/support/e2e.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/system-tests/projects/yarn-v2-pnp/cypress.config.js b/system-tests/projects/yarn-v2-pnp/cypress.config.js index 970e33de3c..66c51217b6 100644 --- a/system-tests/projects/yarn-v2-pnp/cypress.config.js +++ b/system-tests/projects/yarn-v2-pnp/cypress.config.js @@ -2,6 +2,7 @@ import * as head from 'lodash/head' module.exports = { 'e2e': { + 'supportFile': false, setupNodeEvents (on, config) { // make sure plugin can access dependencies head([1, 2, 3]) diff --git a/system-tests/test/new_project_spec.js b/system-tests/test/new_project_spec.js index b2edf37f55..494382e27e 100644 --- a/system-tests/test/new_project_spec.js +++ b/system-tests/test/new_project_spec.js @@ -23,6 +23,9 @@ describe('e2e new project', () => { .then(() => { return fs.statAsync(supportPath) }) + .catch((err) => { + expect(err.code).eq('ENOENT') + }) }) }) }) diff --git a/yarn.lock b/yarn.lock index 27834c5159..a32985c649 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17151,9 +17151,9 @@ cyclist@^1.0.1: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= -cypress-example-kitchensink@cypress-io/cypress-example-kitchensink#feat/use-config-file: +cypress-example-kitchensink@cypress-io/cypress-example-kitchensink#feat/use-supportFiles: version "0.0.0-development" - resolved "https://codeload.github.com/cypress-io/cypress-example-kitchensink/tar.gz/9de74fdcfa724324001b82a4a9d0582a38533db0" + resolved "https://codeload.github.com/cypress-io/cypress-example-kitchensink/tar.gz/03d4884a83fe5687e866f747768485ff40e61911" dependencies: npm-run-all "^4.1.2" serve "11.3.0"