diff --git a/content/api/commands/origin.md b/content/api/commands/origin.md index 9265053963..75d6124c0f 100644 --- a/content/api/commands/origin.md +++ b/content/api/commands/origin.md @@ -408,18 +408,28 @@ packages and other files. -Using `import()` and `require()` within the callback requires 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). -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`._ + + + + + +Using `require()` or `import()` within the callback from a `node_modules` plugin +is not currently supported. We anticipate adding support with issue +[#24976](https://github.com/cypress-io/cypress/issues/24976). 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`. |