From 89a72c846a15cb89368256ef0eb2592f421fffd5 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Mon, 5 Dec 2022 10:18:42 -0700 Subject: [PATCH 1/4] docs: add documentation for experimentalOriginDependencies --- content/api/commands/origin.md | 23 ++++++++++++++++------- content/guides/references/experiments.md | 11 ++++++----- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/content/api/commands/origin.md b/content/api/commands/origin.md index 9265053963..0e0cdda773 100644 --- a/content/api/commands/origin.md +++ b/content/api/commands/origin.md @@ -408,18 +408,27 @@ packages and other files. -Using `import()` and `require()` within the callback requires version 5.15.0 or -greater of the +Using `require()` or `import()` within the callback from a `node_modules` plugin +is not currently supported. + + + + + +Using `import()` and `require()` within the callback requires requires enabling +the [`experimentalOriginDependencies`](/guides/references/experiments) flag in +the Cypress configuration and using version 5.15.0 or greater of the [`@cypress/webpack-preprocessor`](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor). -This is included in Cypress by default, but if your project installs its own -version of `@cypress/webpack-preprocessor` that is set up in your Cypress -config, make sure it is version 5.15.0 or greater. +The `@cypress/webpack-preprocessor` is included in Cypress by default, but if +your project installs its own version in the Cypress configuration, make sure it +is version 5.15.0 or greater. If using an older version of the webpack or a different preprocessor, you'll see an error that includes the following text: -_Using require() or import() to include dependencies requires using the latest -version of @cypress/webpack-preprocessor._ +_Using `require()` or `import()` to include dependencies requires enabling the +`experimentalOriginDependencies` flag and using the latest version of +`@cypress/webpack-preprocessor`._ diff --git a/content/guides/references/experiments.md b/content/guides/references/experiments.md index 231df3c030..bb38aa05cb 100644 --- a/content/guides/references/experiments.md +++ b/content/guides/references/experiments.md @@ -39,10 +39,11 @@ creating `e2e` and `component` objects inside your Cypress configuration. These experiments are available to be specified inside the `e2e` configuration object: -| Option | Default | Description | -| ------------------------- | ------- | --------------------------------------------------------------------------------------------------------- | -| `experimentalStudio` | `false` | Generate and save commands directly to your test suite by interacting with your app as an end user would. | -| `experimentalRunAllSpecs` | `false` | Enables the "Run All Specs" UI feature, allowing the execution of multiple specs sequentially. | +| Option | Default | Description | +| -------------------------------- | ------- | --------------------------------------------------------------------------------------------------------- | +| `experimentalStudio` | `false` | Generate and save commands directly to your test suite by interacting with your app as an end user would. | +| `experimentalRunAllSpecs` | `false` | Enables the "Run All Specs" UI feature, allowing the execution of multiple specs sequentially. | +| `experimentalOriginDependencies` | `false` | Enables support for `require`/`import` within `cy.origin`. | ### Component Testing @@ -57,7 +58,7 @@ configuration object: | Version | Changes | | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [12.0.0](/guides/references/changelog#12-0-0) | Removed `experimentalSessionAndOrigin` and made it the default behavior. | +| [12.0.0](/guides/references/changelog#12-0-0) | Removed `experimentalSessionAndOrigin` and made it the default behavior. Added `experimentalOriginDependencies`. | | [11.2.0](/guides/references/changelog#11-2-0) | Added `experimentalRunAllSpecs`. | | [10.8.0](/guides/references/changelog#10-8-0) | Added `experimentalWebKitSupport`. | | [10.6.0](/guides/references/changelog#10-6-0) | Added support for `experimentalSingleTabRunMode`. | From faa3610a50d41f77ac0db3d6f855742b282999a6 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Mon, 5 Dec 2022 10:51:42 -0700 Subject: [PATCH 2/4] add github issue --- content/api/commands/origin.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/content/api/commands/origin.md b/content/api/commands/origin.md index 0e0cdda773..229f9b5e8b 100644 --- a/content/api/commands/origin.md +++ b/content/api/commands/origin.md @@ -408,13 +408,6 @@ packages and other files. -Using `require()` or `import()` within the callback from a `node_modules` plugin -is not currently supported. - - - - - Using `import()` and `require()` within the callback requires requires enabling the [`experimentalOriginDependencies`](/guides/references/experiments) flag in the Cypress configuration and using version 5.15.0 or greater of the @@ -432,6 +425,14 @@ _Using `require()` or `import()` to include dependencies requires enabling the + + +Using `require()` or `import()` within the callback from a `node_modules` plugin +is not currently supported. We anticipate to add support with issue +[#24976](https://github.com/cypress-io/cypress/issues/24976). + + + #### Example ```js From 41b70d6e697cce067883ceee4f812c727d66ea50 Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Mon, 5 Dec 2022 11:02:05 -0700 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Bill Glesias Co-authored-by: Chris Breiding --- content/api/commands/origin.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/api/commands/origin.md b/content/api/commands/origin.md index 229f9b5e8b..ec085cd1da 100644 --- a/content/api/commands/origin.md +++ b/content/api/commands/origin.md @@ -408,13 +408,13 @@ packages and other files. -Using `import()` and `require()` within the callback requires requires enabling +Using `import()` and `require()` within the callback requires enabling the [`experimentalOriginDependencies`](/guides/references/experiments) flag in -the Cypress configuration and using version 5.15.0 or greater of the +the Cypress configuration and using version `5.15.0` or greater of the [`@cypress/webpack-preprocessor`](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor). The `@cypress/webpack-preprocessor` is included in Cypress by default, but if your project installs its own version in the Cypress configuration, make sure it -is version 5.15.0 or greater. +is version `5.15.0` or greater. If using an older version of the webpack or a different preprocessor, you'll see an error that includes the following text: @@ -428,7 +428,7 @@ _Using `require()` or `import()` to include dependencies requires enabling the Using `require()` or `import()` within the callback from a `node_modules` plugin -is not currently supported. We anticipate to add support with issue +is not currently supported. We anticipate adding support with issue [#24976](https://github.com/cypress-io/cypress/issues/24976). From 8b9cc9fe38f57ac7d465dcfac96be14d4a534e5c Mon Sep 17 00:00:00 2001 From: Matt Schile Date: Mon, 5 Dec 2022 11:20:22 -0700 Subject: [PATCH 4/4] lint fix --- content/api/commands/origin.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/api/commands/origin.md b/content/api/commands/origin.md index ec085cd1da..75d6124c0f 100644 --- a/content/api/commands/origin.md +++ b/content/api/commands/origin.md @@ -408,9 +408,9 @@ packages and other files. -Using `import()` and `require()` within the callback requires enabling -the [`experimentalOriginDependencies`](/guides/references/experiments) flag in -the Cypress configuration and using version `5.15.0` or greater of the +Using `import()` and `require()` within the callback requires enabling the +[`experimentalOriginDependencies`](/guides/references/experiments) flag in the +Cypress configuration and using version `5.15.0` or greater of the [`@cypress/webpack-preprocessor`](https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor). The `@cypress/webpack-preprocessor` is included in Cypress by default, but if your project installs its own version in the Cypress configuration, make sure it