@nx/cypress 19.5.1 → 19.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "19.5.1",
3
+ "version": "19.5.2",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
6
6
  "repository": {
@@ -36,13 +36,13 @@
36
36
  "migrations": "./migrations.json"
37
37
  },
38
38
  "dependencies": {
39
- "@nx/devkit": "19.5.1",
40
- "@nx/eslint": "19.5.1",
41
- "@nx/js": "19.5.1",
39
+ "@nx/devkit": "19.5.2",
40
+ "@nx/eslint": "19.5.2",
41
+ "@nx/js": "19.5.2",
42
42
  "@phenomnomnominal/tsquery": "~5.0.1",
43
43
  "detect-port": "^1.5.1",
44
44
  "tslib": "^2.3.0",
45
- "@nrwl/cypress": "19.5.1"
45
+ "@nrwl/cypress": "19.5.2"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "cypress": ">= 3 < 14"
@@ -1,3 +1,4 @@
1
+ import type { InlineConfig } from 'vite';
1
2
  interface BaseCypressPreset {
2
3
  videosFolder: string;
3
4
  screenshotsFolder: string;
@@ -67,5 +68,9 @@ export type NxCypressE2EPresetOptions = {
67
68
  * Configures how the web server command is started and monitored.
68
69
  */
69
70
  webServerConfig?: WebServerConfig;
71
+ /**
72
+ * Configure override inside the vite config
73
+ */
74
+ viteConfigOverrides?: InlineConfig;
70
75
  };
71
76
  export {};
@@ -83,7 +83,7 @@ function nxE2EPreset(pathToConfig, options) {
83
83
  const webServerCommands = config.env?.webServerCommands ?? options?.webServerCommands;
84
84
  const webServerCommand = config.env?.webServerCommand ?? webServerCommands?.default;
85
85
  if (options?.bundler === 'vite') {
86
- on('file:preprocessor', (0, preprocessor_vite_1.default)());
86
+ on('file:preprocessor', (0, preprocessor_vite_1.default)(options?.viteConfigOverrides));
87
87
  }
88
88
  if (!options?.webServerCommands) {
89
89
  return;
@@ -22,11 +22,12 @@
22
22
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
23
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
  **/
25
+ import type { InlineConfig } from 'vite';
25
26
  type CypressPreprocessor = (file: Record<string, any>) => string | Promise<string>;
26
27
  /**
27
28
  * Use Vite as a file preprocess for Cypress test files.
28
29
  * This preprocessor shouldn't be used directly.
29
30
  * Instead, use the nxE2EPreset(__filename, { bundler: 'vite' }) function instead.
30
31
  */
31
- declare function vitePreprocessor(userConfigPath?: string): CypressPreprocessor;
32
+ declare function vitePreprocessor(configOverrides?: InlineConfig): CypressPreprocessor;
32
33
  export default vitePreprocessor;
@@ -31,7 +31,7 @@ const cache = new Map();
31
31
  * This preprocessor shouldn't be used directly.
32
32
  * Instead, use the nxE2EPreset(__filename, { bundler: 'vite' }) function instead.
33
33
  */
34
- function vitePreprocessor(userConfigPath) {
34
+ function vitePreprocessor(configOverrides = {}) {
35
35
  return async (file) => {
36
36
  const { outputPath, filePath, shouldWatch } = file;
37
37
  if (cache.has(filePath)) {
@@ -62,8 +62,8 @@ function vitePreprocessor(userConfigPath) {
62
62
  cache.set(filePath, outputPath);
63
63
  const { build } = await Function('return import("vite")')();
64
64
  const watcher = (await build({
65
- configFile: userConfigPath,
66
65
  ...defaultConfig,
66
+ ...configOverrides,
67
67
  }));
68
68
  return new Promise((resolve, reject) => {
69
69
  if (shouldWatch && isWatcher(watcher)) {