diff --git a/packages/errors/__snapshot-html__/COMPONENT_DEV_SERVER_IS_NOT_A_FUNCTION.html b/packages/errors/__snapshot-html__/COMPONENT_DEV_SERVER_IS_NOT_A_FUNCTION.html new file mode 100644 index 0000000000..2c7eb7f832 --- /dev/null +++ b/packages/errors/__snapshot-html__/COMPONENT_DEV_SERVER_IS_NOT_A_FUNCTION.html @@ -0,0 +1,53 @@ + + + + + + + + + + + +
The component.devServer method must be a function with the following signature:
+
+
+        devServer (cypressDevServerConfig, devServerConfig) {
+          // start dev server here
+        }
+      
+
+Instead, we saw: 
+
+{}
+
+This error is from: /path/to/config.ts
+
+Learn more: https://on.cypress.io/dev-server
+
+
\ No newline at end of file diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidArray.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidArray.html index 169f36f643..d9c965fe50 100644 --- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidArray.html +++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidArray.html @@ -34,7 +34,7 @@ -
Your configFile set an invalid value from: cypress.json
+    
Your configFile at cypress.json set an invalid value:
 
 Expected defaultCommandTimeout to be a number.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidObject.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidObject.html
index 33c5f7b109..c512125bd3 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidObject.html	
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidObject.html	
@@ -34,7 +34,7 @@
     
   
     
-    
Your configFile set an invalid value from: cypress.json
+    
Your configFile at cypress.json set an invalid value:
 
 Expected defaultCommandTimeout to be a number.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidString.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidString.html
index 95e4944872..cf809bf987 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidString.html	
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - invalidString.html	
@@ -34,7 +34,7 @@
     
   
     
-    
Your configFile set an invalid value from: cypress.json
+    
Your configFile at cypress.json set an invalid value:
 
 Expected defaultCommandTimeout to be a number.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - list.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - list.html
index ceac95500d..8bb8df4611 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - list.html	
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - list.html	
@@ -34,7 +34,7 @@
     
   
     
-    
Your configFile set an invalid value from: cypress.json
+    
Your configFile at cypress.json set an invalid value:
 
 The error occurred while validating the browsers list.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - pluginsFile.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - pluginsFile.html
index 887f4f86ed..8d55d42948 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - pluginsFile.html	
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR - pluginsFile.html	
@@ -34,7 +34,7 @@
     
   
     
-    
Your pluginsFile set an invalid value from: cypress/plugins/index.js
+    
Your pluginsFile at cypress/plugins/index.js set an invalid value:
 
 Expected defaultCommandTimeout to be a number.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR.html
index f56a76deab..93838e9fc1 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR.html
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_ERROR.html
@@ -34,7 +34,7 @@
     
   
     
-    
Your configFile set an invalid value from: cypress.json
+    
Your configFile at cypress.json set an invalid value:
 
 Expected defaultCommandTimeout to be a number.
 
diff --git a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_MSG_ERROR.html b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_MSG_ERROR.html
index fd8bbffb06..bd6b08ad78 100644
--- a/packages/errors/__snapshot-html__/CONFIG_VALIDATION_MSG_ERROR.html
+++ b/packages/errors/__snapshot-html__/CONFIG_VALIDATION_MSG_ERROR.html
@@ -34,7 +34,7 @@
     
   
     
-    
Your configFile set an invalid value from: cypress.json
+    
Your configFile as cypress.json set an invalid value:
 
 `something` was not right
 
\ No newline at end of file diff --git a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - array.html b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - array.html similarity index 75% rename from packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - array.html rename to packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - array.html index a209881ee3..886ae2d620 100644 --- a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - array.html +++ b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - array.html @@ -34,15 +34,15 @@ -
Your pluginsFile did not export a valid function from: /path/to/pluginsFile
+    
Your configFile is invalid: /path/to/pluginsFile
 
-It must export a function with the following signature:
+The setupNodeEvents in your e2e config should define a function with the following signature:
 
-module.exports = (on, config) => {
-  // configure plugins here
+setupNodeEvents(on, config) {
+  // configure tasks / plugins here
 }
 
-Instead it exported:
+Instead we saw:
 
 [
   "some",
@@ -50,5 +50,5 @@
 ]
 
 https://on.cypress.io/plugins-api
-
+
 
\ No newline at end of file diff --git a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - string.html b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - string.html similarity index 71% rename from packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - string.html rename to packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - string.html index a0c007e69f..714e689374 100644 --- a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION - string.html +++ b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION - string.html @@ -34,18 +34,18 @@ -
Your pluginsFile did not export a valid function from: /path/to/pluginsFile
+    
Your configFile is invalid: /path/to/pluginsFile
 
-It must export a function with the following signature:
+The setupNodeEvents in your e2e config should define a function with the following signature:
 
-module.exports = (on, config) => {
-  // configure plugins here
+setupNodeEvents(on, config) {
+  // configure tasks / plugins here
 }
 
-Instead it exported:
+Instead we saw:
 
 "some string"
 
 https://on.cypress.io/plugins-api
-
+
 
\ No newline at end of file diff --git a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION.html b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION.html similarity index 74% rename from packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION.html rename to packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION.html index c86a0cbfef..140e58107a 100644 --- a/packages/errors/__snapshot-html__/PLUGINS_DIDNT_EXPORT_FUNCTION.html +++ b/packages/errors/__snapshot-html__/SETUP_NODE_EVENTS_IS_NOT_FUNCTION.html @@ -34,20 +34,20 @@ -
Your pluginsFile did not export a valid function from: /path/to/pluginsFile
+    
Your configFile is invalid: /path/to/pluginsFile
 
-It must export a function with the following signature:
+The setupNodeEvents in your e2e config should define a function with the following signature:
 
-module.exports = (on, config) => {
-  // configure plugins here
+setupNodeEvents(on, config) {
+  // configure tasks / plugins here
 }
 
-Instead it exported:
+Instead we saw:
 
 {
   "some": "object"
 }
 
 https://on.cypress.io/plugins-api
-
+
 
\ No newline at end of file diff --git a/packages/errors/src/errors.ts b/packages/errors/src/errors.ts index c1cd131c78..e985ab4125 100644 --- a/packages/errors/src/errors.ts +++ b/packages/errors/src/errors.ts @@ -602,20 +602,20 @@ export const AllCypressErrors = { ` }, // TODO: make this relative path, not absolute - SETUP_NODE_EVENTS_IS_NOT_FUNCTION: (testingType: string, pluginsFilePath: string, exported: any) => { + SETUP_NODE_EVENTS_IS_NOT_FUNCTION: (configFilePath: string, testingType: string, exported: any) => { const code = errPartial` - setupNodeEvents(on, config) => { + setupNodeEvents(on, config) { ${fmt.comment(`// configure tasks / plugins here`)} }` return errTemplate`\ - The setupNodeEvents in your ${fmt.highlight(`configFile.${testingType}`)} config did not export a valid function + Your ${fmt.highlight(`configFile`)} is invalid: ${fmt.path(configFilePath)} - It must export a function with the following signature: + The setupNodeEvents in your ${fmt.highlight(testingType)} config should define a function with the following signature: ${fmt.code(code)} - Instead it exported: + Instead we saw: ${fmt.stringify(exported)} diff --git a/packages/errors/test/unit/visualSnapshotErrors_spec.ts b/packages/errors/test/unit/visualSnapshotErrors_spec.ts index af7c503e3b..a95cd3a43f 100644 --- a/packages/errors/test/unit/visualSnapshotErrors_spec.ts +++ b/packages/errors/test/unit/visualSnapshotErrors_spec.ts @@ -658,9 +658,9 @@ describe('visual error templates', () => { }, SETUP_NODE_EVENTS_IS_NOT_FUNCTION: () => { return { - default: ['e2e', '/path/to/pluginsFile', { some: 'object' }], - string: ['e2e', '/path/to/pluginsFile', 'some string'], - array: ['e2e', '/path/to/pluginsFile', ['some', 'array']], + default: ['/path/to/pluginsFile', 'e2e', { some: 'object' }], + string: ['/path/to/pluginsFile', 'e2e', 'some string'], + array: ['/path/to/pluginsFile', 'e2e', ['some', 'array']], } }, CONFIG_FILE_SETUP_NODE_EVENTS_ERROR: () => { diff --git a/packages/launchpad/cypress/e2e/choose-a-browser.cy.ts b/packages/launchpad/cypress/e2e/choose-a-browser.cy.ts index 2a0be1064d..a9d66c7773 100644 --- a/packages/launchpad/cypress/e2e/choose-a-browser.cy.ts +++ b/packages/launchpad/cypress/e2e/choose-a-browser.cy.ts @@ -37,6 +37,10 @@ describe('Choose a Browser Page', () => { cy.validateExternalLink({ href: 'https://on.cypress.io/customize-browsers', }) + + cy.validateExternalLink({ + href: 'https://on.cypress.io/troubleshooting-launching-browsers', + }) }) // Ensure warning can be dismissed diff --git a/packages/server/lib/config.ts b/packages/server/lib/config.ts index c509ddfb03..b0cbd4af95 100644 --- a/packages/server/lib/config.ts +++ b/packages/server/lib/config.ts @@ -242,10 +242,10 @@ export function updateWithPluginValues (cfg, overrides) { } if (_.isString(validationResult)) { - return errors.throwErr('CONFIG_VALIDATION_MSG_ERROR', 'pluginsFile', configFile, validationResult) + return errors.throwErr('CONFIG_VALIDATION_MSG_ERROR', 'configFile', configFile, validationResult) } - return errors.throwErr('CONFIG_VALIDATION_ERROR', 'pluginsFile', configFile, validationResult) + return errors.throwErr('CONFIG_VALIDATION_ERROR', 'configFile', configFile, validationResult) // return errors.throwErr('CONFIG_VALIDATION_ERROR', 'pluginsFile', relativePluginsPath, errMsg) }) diff --git a/packages/server/lib/plugins/child/run_require_async_child.js b/packages/server/lib/plugins/child/run_require_async_child.js index 6b1f19fbf7..72ba36fa58 100644 --- a/packages/server/lib/plugins/child/run_require_async_child.js +++ b/packages/server/lib/plugins/child/run_require_async_child.js @@ -52,10 +52,10 @@ function run (ipc, configFile, projectRoot) { return false }) - const isValidSetupNodeEvents = (setupNodeEvents) => { - if (setupNodeEvents && typeof setupNodeEvents !== 'function') { + const isValidSetupNodeEvents = (config, testingType) => { + if (config[testingType] && config[testingType].setupNodeEvents && typeof config[testingType].setupNodeEvents !== 'function') { ipc.send('setupTestingType:error', util.serializeError( - require('@packages/errors').getError('SETUP_NODE_EVENTS_IS_NOT_FUNCTION', configFile, setupNodeEvents), + require('@packages/errors').getError('SETUP_NODE_EVENTS_IS_NOT_FUNCTION', configFile, testingType, config[testingType].setupNodeEvents), )) return false @@ -104,8 +104,12 @@ function run (ipc, configFile, projectRoot) { const runPlugins = new RunPlugins(ipc, projectRoot, configFile) + if (!isValidSetupNodeEvents(result, testingType)) { + return + } + if (testingType === 'component') { - if (!isValidSetupNodeEvents(result.setupNodeEvents) || !isValidDevServer((result.component || {}))) { + if (!isValidDevServer((result.component || {}))) { return } @@ -119,10 +123,6 @@ function run (ipc, configFile, projectRoot) { return setupNodeEvents(on, config) }) } else if (testingType === 'e2e') { - if (!isValidSetupNodeEvents(result.e2e && result.e2e.setupNodeEvents)) { - return - } - const setupNodeEvents = result.e2e && result.e2e.setupNodeEvents || ((on, config) => {}) runPlugins.runSetupNodeEvents(options, setupNodeEvents) diff --git a/packages/server/test/unit/plugins/child/run_plugins_spec.js b/packages/server/test/unit/plugins/child/run_plugins_spec.js index 69844d3690..1081a85617 100644 --- a/packages/server/test/unit/plugins/child/run_plugins_spec.js +++ b/packages/server/test/unit/plugins/child/run_plugins_spec.js @@ -66,7 +66,7 @@ describe.skip('lib/plugins/child/run_plugins', () => { it('sends error message if setupNodeEvents does not export a function', function () { mockery.registerMock('plugins-file', null) runPlugins(this.ipc, 'plugins-file', 'proj-root') - expect(this.ipc.send).to.be.calledWith('load:error', 'PLUGINS_DIDNT_EXPORT_FUNCTION', 'plugins-file') + expect(this.ipc.send).to.be.calledWith('load:error', 'SETUP_NODE_EVENTS_IS_NOT_FUNCTION', 'plugins-file') }) it('sends error message if setupNodeEvents is not a function', function () { diff --git a/system-tests/__snapshots__/browser_path_spec.js b/system-tests/__snapshots__/browser_path_spec.js index 681ae4ece8..5a23804b70 100644 --- a/system-tests/__snapshots__/browser_path_spec.js +++ b/system-tests/__snapshots__/browser_path_spec.js @@ -7,14 +7,14 @@ exports['e2e launching browsers by path works with an installed browser path 1'] ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 1.2.3 │ │ Browser: Custom FooBrowser 88 │ - │ Specs: 1 found (simple.cy.js) │ - │ Searched: cypress/e2e/simple.cy.js │ + │ Specs: 1 found (simple.cy.js) │ + │ Searched: cypress/e2e/simple.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ ──────────────────────────────────────────────────────────────────────────────────────────────────── - Running: simple.cy.js (1 of 1) + Running: simple.cy.js (1 of 1) ✓ is true @@ -33,14 +33,14 @@ exports['e2e launching browsers by path works with an installed browser path 1'] │ Screenshots: 0 │ │ Video: true │ │ Duration: X seconds │ - │ Spec Ran: simple.cy.js │ + │ Spec Ran: simple.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ (Video) - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/simple.cy.js.mp4 (X second) + - Finished processing: /XXX/XXX/XXX/cypress/videos/simple.cy.js.mp4 (X second) ==================================================================================================== @@ -50,7 +50,7 @@ exports['e2e launching browsers by path works with an installed browser path 1'] Spec Tests Passing Failing Pending Skipped ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ simple.cy.js XX:XX 1 1 - - - │ + │ ✔ simple.cy.js XX:XX 1 1 - - - │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ ✔ All specs passed! XX:XX 1 1 - - - diff --git a/system-tests/__snapshots__/config_spec.js b/system-tests/__snapshots__/config_spec.js index 01b4b7ff7b..96d2596584 100644 --- a/system-tests/__snapshots__/config_spec.js +++ b/system-tests/__snapshots__/config_spec.js @@ -141,7 +141,7 @@ exports['e2e config applies defaultCommandTimeout globally 1'] = ` ` exports['e2e config throws error when invalid viewportWidth in the configuration file 1'] = ` -Your configFile set an invalid value from: cypress.config.js +Your configFile set an invalid value from: /foo/bar/.projects/config-with-invalid-viewport/cypress.config.js Expected viewportWidth to be a number. @@ -150,7 +150,7 @@ Instead the value was: "foo" ` exports['e2e config throws error when invalid browser in the configuration file 1'] = ` -Your configFile set an invalid value from: cypress.config.js +Your configFile set an invalid value from: /foo/bar/.projects/config-with-invalid-browser/cypress.config.js The error occurred while validating the browsers list. @@ -172,62 +172,73 @@ Instead the value was: exports['e2e config throws error when multiple default config file are found in project 1'] = ` There is both a cypress.config.js and a cypress.config.ts at the location below: - > /foo/bar/.projects/pristine + > /foo/bar/.projects/pristine-with-e2e-testing + +Cypress does not know which one to read for config. Please remove one of the two and try again. ` exports['e2e config throws error when cypress.json is found in project and need migration 1'] = ` -There is a cypress.json file at the location below: -/foo/bar/.projects/pristine -There is both a cypress.config.js and a cypress.config.ts at the location below: +There is a cypress.json file at the path: /foo/bar/.projects/pristine - > /foo/bar/.projects/pristine +Cypress version 10.0.0 no longer supports cypress.json. -Cypress 10 no longer supports 'cypress.json'. Please run \`cypress open\` to launch the migration tool to migrate to 'cypress.config.{ts|js}'. +Please run cypress open to launch the migration tool to migrate to cypress.config.{ts|js}. ` exports['e2e config throws error when cypress.json is found in project and cypress.config.{ts|js} exists as well 1'] = ` -There is both a \`cypress.config.js\` and a cypress.json file at the location below: +There is both a cypress.config.js and a cypress.json file at the location below: + /foo/bar/.projects/multiple-config-files-with-json -Cypress no longer supports 'cypress.json' config, please remove it from your project. +Cypress no longer supports cypress.json, please remove it from your project. ` exports['e2e config throws an error if supportFile is set on the root level 1'] = ` -The \`supportFile\` configuration option was removed from the root in Cypress version \`10.0.0\`. Please update this option under each testing type property. +The supportFile configuration option was removed from the root of the Cypress config object in version 10.0.0. + +Please update this option under each testing type property. https://on.cypress.io/migration-guide ` exports['e2e config throws an error if specPattern is set on the root level 1'] = ` -The \`specPattern\` configuration option was removed from the root in Cypress version \`10.0.0\`. Please update this option under each testing type property. +The specPattern configuration option was removed from the root of the Cypress config object in version 10.0.0. + +Please update this option under each testing type property. https://on.cypress.io/migration-guide ` exports['e2e config throws an error if excludeSpecPattern is set on the root level 1'] = ` -The \`excludeSpecPattern\` configuration option was removed from the root in Cypress version \`10.0.0\`. Please update this option under each testing type property. +The excludeSpecPattern configuration option was removed from the root of the Cypress config object in version 10.0.0. + +Please update this option under each testing type property. https://on.cypress.io/migration-guide ` exports['e2e config throws an error if baseUrl is set on the root level 1'] = ` -The \`baseUrl\` configuration option was removed from the root in Cypress version \`10.0.0\`. Please update this option under e2e testing type property. +The baseUrl configuration option was removed from the root of the Cypress config object in version 10.0.0. + +Please update this option under the e2e testing type property. https://on.cypress.io/migration-guide ` exports['e2e config throws an error if baseUrl is set on the component level 1'] = ` -The \`baseUrl\` configuration option is not valid in Component testing. Please update this option under e2e testing type property. +The baseUrl configuration option is not valid in Component testing. + +Please remove or add this option under e2e testing type property. https://on.cypress.io/migration-guide diff --git a/system-tests/__snapshots__/controllers_spec.js b/system-tests/__snapshots__/controllers_spec.js index e6464b4889..185b6006d4 100644 --- a/system-tests/__snapshots__/controllers_spec.js +++ b/system-tests/__snapshots__/controllers_spec.js @@ -18,7 +18,7 @@ exports['e2e plugins fails when spec does not exist 1'] = ` Oops...we found an error preparing this test file: - > cypress/integration/spec.js + > cypress/e2e/spec.js The error was: diff --git a/system-tests/__snapshots__/deprecated_spec.ts.js b/system-tests/__snapshots__/deprecated_spec.ts.js index 9afcf657e3..3550aa5aac 100644 --- a/system-tests/__snapshots__/deprecated_spec.ts.js +++ b/system-tests/__snapshots__/deprecated_spec.ts.js @@ -1,3 +1,36 @@ +exports['deprecated before:browser:launch args / fails when adding unknown properties to launchOptions'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (app.cy.js) │ + │ Searched: cypress/e2e/app.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app.cy.js (1 of 1) +The launchOptions object returned by your plugin's before:browser:launch handler contained unexpected properties: + + - foo + - width + - height + +launchOptions may only contain the properties: + + - preferences + - extensions + - args + +https://on.cypress.io/browser-launch-api + +` + exports['deprecated before:browser:launch args / push and no return - warns user exactly once'] = ` ==================================================================================================== @@ -109,6 +142,187 @@ exports['deprecated before:browser:launch args / using non-deprecated API - no w ✔ All specs passed! XX:XX 1 1 - - - +` + +exports['deprecated before:browser:launch args / concat return returns once per spec - [electron]'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 2 found (app.cy.js, app_spec2.js) │ + │ Searched: cypress/e2e/app.cy.js, cypress/e2e/app_spec2.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app.cy.js (1 of 2) +Deprecation Warning: The before:browser:launch plugin event changed its signature in Cypress version 4.0.0 + +The event switched from yielding the second argument as an array of browser arguments to an options object with an args property. + +We've detected that your code is still using the previous, deprecated interface signature. + +This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args + + + ✓ asserts on browser args + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: false │ + │ Duration: X seconds │ + │ Spec Ran: app.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app_spec2.js (2 of 2) +Deprecation Warning: The before:browser:launch plugin event changed its signature in Cypress version 4.0.0 + +The event switched from yielding the second argument as an array of browser arguments to an options object with an args property. + +We've detected that your code is still using the previous, deprecated interface signature. + +This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args + + + ✓ 2 - asserts on browser args + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: false │ + │ Duration: X seconds │ + │ Spec Ran: app_spec2.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ app.cy.js XX:XX 1 1 - - - │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✔ app_spec2.js XX:XX 1 1 - - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 2 2 - - - + + +` + +exports['deprecated before:browser:launch args / concat return returns once per test run - [firefox,chromium]'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 2 found (app.cy.js, app_spec2.js) │ + │ Searched: cypress/e2e/app.cy.js, cypress/e2e/app_spec2.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app.cy.js (1 of 2) +Deprecation Warning: The before:browser:launch plugin event changed its signature in Cypress version 4.0.0 + +The event switched from yielding the second argument as an array of browser arguments to an options object with an args property. + +We've detected that your code is still using the previous, deprecated interface signature. + +This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args + + + ✓ asserts on browser args + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: false │ + │ Duration: X seconds │ + │ Spec Ran: app.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: app_spec2.js (2 of 2) + + + ✓ 2 - asserts on browser args + + 1 passing + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 1 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 0 │ + │ Video: false │ + │ Duration: X seconds │ + │ Spec Ran: app_spec2.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ app.cy.js XX:XX 1 1 - - - │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✔ app_spec2.js XX:XX 1 1 - - - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 2 2 - - - + + ` exports['deprecated before:browser:launch args / no mutate return'] = ` @@ -164,101 +378,7 @@ exports['deprecated before:browser:launch args / no mutate return'] = ` ` -exports['deprecated before:browser:launch args / fails when adding unknown properties to launchOptions'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 1 found (app.cy.js) │ - │ Searched: cypress/e2e/app.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: app_spec.js (1 of 2) -Deprecation Warning: The before:browser:launch plugin event changed its signature in Cypress version 4.0.0 - -The event switched from yielding the second argument as an array of browser arguments to an options object with an args property. - -We've detected that your code is still using the previous, deprecated interface signature. - -This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args - - - ✓ asserts on browser args - - 1 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: false │ - │ Duration: X seconds │ - │ Spec Ran: app.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: app_spec2.js (2 of 2) -Deprecation Warning: The before:browser:launch plugin event changed its signature in Cypress version 4.0.0 - -The event switched from yielding the second argument as an array of browser arguments to an options object with an args property. - -We've detected that your code is still using the previous, deprecated interface signature. - -This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args - - - ✓ 2 - asserts on browser args - - 1 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: false │ - │ Duration: X seconds │ - │ Spec Ran: app_spec2.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ app.cy.js XX:XX 1 1 - - - │ - ├────────────────────────────────────────────────────────────────────────────────────────────────┤ - │ ✔ app_spec2.js XX:XX 1 1 - - - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 2 2 - - - - - -` - -exports['deprecated before:browser:launch args / concat return returns once per spec - [electron]'] = ` +exports['deprecated before:browser:launch args / displays errors thrown and aborts the run'] = ` ==================================================================================================== @@ -274,84 +394,30 @@ exports['deprecated before:browser:launch args / concat return returns once per ──────────────────────────────────────────────────────────────────────────────────────────────────── - Running: app_spec.js (1 of 1) -The launchOptions object returned by your plugin's before:browser:launch handler contained unexpected properties: + Running: app.cy.js (1 of 2) +Error thrown from plugins handler +Error: Error thrown from plugins handler + [stack trace lines] +` - - foo - - width - - height +exports['deprecated before:browser:launch args / displays promises rejected and aborts the run'] = ` -launchOptions may only contain the properties: +==================================================================================================== - - preferences - - extensions - - args - - - ✓ asserts on browser args - - 1 passing - - - (Results) + (Run Starting) ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: false │ - │ Duration: X seconds │ - │ Spec Ran: app.cy.js │ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 2 found (app.cy.js, app_spec2.js) │ + │ Searched: cypress/e2e/app.cy.js, cypress/e2e/app_spec2.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ ──────────────────────────────────────────────────────────────────────────────────────────────────── - Running: app_spec2.js (2 of 2) -Deprecation Warning: The \`before:browser:launch\` plugin event changed its signature in version \`4.0.0\` - -The \`before:browser:launch\` plugin event switched from yielding the second argument as an \`array\` of browser arguments to an options \`object\` with an \`args\` property. - -We've detected that your code is still using the previous, deprecated interface signature. - -This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args - - - ✓ 2 - asserts on browser args - - 1 passing - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: false │ - │ Duration: X seconds │ - │ Spec Ran: app_spec2.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ app.cy.js XX:XX 1 1 - - - │ - ├────────────────────────────────────────────────────────────────────────────────────────────────┤ - │ ✔ app_spec2.js XX:XX 1 1 - - - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 2 2 - - - - - + Running: app.cy.js (1 of 2) +Promise rejected from plugins handler +Error: Promise rejected from plugins handler + [stack trace lines] ` diff --git a/system-tests/__snapshots__/plugins_spec.js b/system-tests/__snapshots__/plugins_spec.js index a61a030966..f329fb940e 100644 --- a/system-tests/__snapshots__/plugins_spec.js +++ b/system-tests/__snapshots__/plugins_spec.js @@ -119,14 +119,14 @@ exports['e2e plugins can modify config from plugins 1'] = ` ` exports['e2e plugins catches invalid browsers list returned from plugins 1'] = ` -Your pluginsFile set an invalid value from: cypress/plugins/index.js +Your configFile as cypress.config.js set an invalid value: Expected at least one browser ` exports['e2e plugins catches invalid browser returned from plugins 1'] = ` -Your pluginsFile set an invalid value from: cypress/plugins/index.js +Your configFile at cypress.config.js set an invalid value: The error occurred while validating the browsers list. @@ -159,8 +159,6 @@ You can also use a custom browser: https://on.cypress.io/customize-browsers Available browsers found on your system are: - electron -Read more about how to troubleshoot launching browsers: https://on.cypress.io/troubleshooting-launching-browsers - ` exports['e2e plugins / works with user extensions'] = ` @@ -358,7 +356,7 @@ exports['e2e plugins calls after:screenshot for cy.screenshot() and failure scre ` exports['e2e plugins catches invalid viewportWidth returned from plugins 1'] = ` -Your pluginsFile set an invalid value from: cypress/plugins/index.js +Your configFile at cypress.config.js set an invalid value: Expected viewportWidth to be a number. @@ -421,7 +419,7 @@ Error: Async error from plugins file ` exports['e2e plugins fails when invalid event is registered 1'] = ` -Your pluginsFile threw a validation error: /foo/bar/.projects/plugin-validation-error/cypress/plugins/index.js +Your configFile threw a validation error: /foo/bar/.projects/plugin-validation-error/cypress.config.js You must pass a valid event name when registering a plugin. @@ -564,3 +562,42 @@ The error was thrown while executing your e2e.setupNodeEvents function: InvalidEventHandlerError: The handler for the event \`task\` must be an object [stack trace lines] ` + +exports['e2e plugins fails when setupNodeEvents is not a function 1'] = ` +Your configFile is invalid: /foo/bar/.projects/plugin-empty/cypress.config.js + +The setupNodeEvents in your configFile.e2e should define a function with the following signature: + +setupNodeEvents(on, config) { + // configure tasks / plugins here +} + +Instead we saw: + +"foo" + +https://on.cypress.io/plugins-api + + +` + +exports['e2e plugins fails when there is no function exported 1'] = ` +Your configFile is invalid: /foo/bar/.projects/plugin-no-function-return/cypress.config.js + +The setupNodeEvents in your configFile.e2e should define a function with the following signature: + +setupNodeEvents(on, config) { + // configure tasks / plugins here +} + +Instead we saw: + +{ + "foo": "foo", + "bar": "bar" +} + +https://on.cypress.io/plugins-api + + +` diff --git a/system-tests/projects/plugin-no-function-return/cypress.config.js b/system-tests/projects/plugin-no-function-return/cypress.config.js new file mode 100644 index 0000000000..56b3bf83c0 --- /dev/null +++ b/system-tests/projects/plugin-no-function-return/cypress.config.js @@ -0,0 +1,9 @@ +module.exports = { + e2e: { + supportFile: false, + setupNodeEvents: { + foo: 'foo', + bar: 'bar', + }, + }, +} diff --git a/system-tests/projects/plugin-no-function-return/cypress.json b/system-tests/projects/plugin-no-function-return/cypress.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/system-tests/projects/plugin-no-function-return/cypress.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/system-tests/projects/plugin-no-function-return/cypress/plugins/index.js b/system-tests/projects/plugin-no-function-return/cypress/plugins/index.js deleted file mode 100644 index 4539dc1194..0000000000 --- a/system-tests/projects/plugin-no-function-return/cypress/plugins/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - foo: 'foo', - bar: 'bar', -}