@nx/cypress 23.0.0-beta.8 → 23.0.0-beta.9

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": "23.0.0-beta.8",
3
+ "version": "23.0.0-beta.9",
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": {
@@ -37,9 +37,9 @@
37
37
  "migrations": "./migrations.json"
38
38
  },
39
39
  "dependencies": {
40
- "@nx/devkit": "23.0.0-beta.8",
41
- "@nx/eslint": "23.0.0-beta.8",
42
- "@nx/js": "23.0.0-beta.8",
40
+ "@nx/devkit": "23.0.0-beta.9",
41
+ "@nx/eslint": "23.0.0-beta.9",
42
+ "@nx/js": "23.0.0-beta.9",
43
43
  "@phenomnomnominal/tsquery": "~6.2.0",
44
44
  "detect-port": "^2.1.0",
45
45
  "semver": "^7.6.3",
@@ -47,7 +47,7 @@
47
47
  "tslib": "^2.3.0"
48
48
  },
49
49
  "devDependencies": {
50
- "nx": "23.0.0-beta.8"
50
+ "nx": "23.0.0-beta.9"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "cypress": ">= 13 < 16"
@@ -48,7 +48,7 @@ async function componentConfigurationGeneratorInternal(tree, options) {
48
48
  }
49
49
  addProjectFiles(tree, projectConfig, opts);
50
50
  if (!hasPlugin || opts.addExplicitTargets) {
51
- (0, deprecation_1.warnCypressExecutorScaffolding)();
51
+ (0, deprecation_1.warnCypressExecutorGenerating)();
52
52
  addTargetToProject(tree, projectConfig, opts);
53
53
  }
54
54
  updateNxJsonConfiguration(tree, hasPlugin);
@@ -42,7 +42,7 @@ async function configurationGeneratorInternal(tree, options) {
42
42
  : p.plugin === '@nx/cypress/plugin');
43
43
  await addFiles(tree, opts, projectGraph, hasPlugin);
44
44
  if (!hasPlugin) {
45
- (0, deprecation_1.warnCypressExecutorScaffolding)();
45
+ (0, deprecation_1.warnCypressExecutorGenerating)();
46
46
  addTarget(tree, opts, projectGraph);
47
47
  }
48
48
  const projectTsConfigPath = (0, devkit_1.joinPathFragments)(opts.projectRoot, 'tsconfig.json');
@@ -70,47 +70,63 @@ async function createNodesInternal(configFilePath, options, context, pluginCache
70
70
  function getTargetOutputs(outputs, subfolder) {
71
71
  return outputs.map((output) => subfolder ? (0, path_1.join)(output, subfolder) : output);
72
72
  }
73
- function getTargetConfig(cypressConfig, outputSubfolder, ciBaseUrl) {
73
+ // Normalize a Cypress config folder (e.g. videosFolder, screenshotsFolder) to a
74
+ // project-root-relative path, then append the per-spec subfolder. Cypress
75
+ // resolves relative folders against the project root (cwd), so this keeps the
76
+ // path Cypress writes to in lockstep with what Nx declares as the target's
77
+ // outputs — regardless of whether the user wrote a relative path or computed
78
+ // an absolute one (e.g. via `path.resolve` / `__dirname`).
79
+ function serializeConfigPath(configPath, projectRoot, workspaceRoot, outputSubfolder) {
80
+ if (!configPath) {
81
+ return configPath;
82
+ }
83
+ const fullProjectRoot = (0, path_1.resolve)(workspaceRoot, projectRoot);
84
+ const fullConfigPath = (0, path_1.resolve)(fullProjectRoot, configPath);
85
+ const relativeConfigPath = (0, devkit_1.normalizePath)((0, path_1.relative)(fullProjectRoot, fullConfigPath));
86
+ return (0, devkit_1.normalizePath)((0, path_1.join)(relativeConfigPath, outputSubfolder));
87
+ }
88
+ function getTargetConfig(cypressConfig, projectRoot, workspaceRoot, outputSubfolder, ciBaseUrl) {
74
89
  const config = {};
75
90
  if (ciBaseUrl) {
76
91
  config['baseUrl'] = ciBaseUrl;
77
92
  }
78
93
  const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
79
94
  if (videosFolder) {
80
- config['videosFolder'] = (0, path_1.join)(videosFolder, outputSubfolder);
95
+ config['videosFolder'] = serializeConfigPath(videosFolder, projectRoot, workspaceRoot, outputSubfolder);
81
96
  }
82
97
  if (screenshotsFolder) {
83
- config['screenshotsFolder'] = (0, path_1.join)(screenshotsFolder, outputSubfolder);
98
+ config['screenshotsFolder'] = serializeConfigPath(screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
84
99
  }
85
100
  if (e2e) {
86
101
  config['e2e'] = {};
87
102
  if (e2e.videosFolder) {
88
- config['e2e']['videosFolder'] = (0, path_1.join)(e2e.videosFolder, outputSubfolder);
103
+ config['e2e']['videosFolder'] = serializeConfigPath(e2e.videosFolder, projectRoot, workspaceRoot, outputSubfolder);
89
104
  }
90
105
  if (e2e.screenshotsFolder) {
91
- config['e2e']['screenshotsFolder'] = (0, path_1.join)(e2e.screenshotsFolder, outputSubfolder);
106
+ config['e2e']['screenshotsFolder'] = serializeConfigPath(e2e.screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
92
107
  }
93
108
  }
94
109
  if (component) {
95
110
  config['component'] = {};
96
111
  if (component.videosFolder) {
97
- config['component']['videosFolder'] = (0, path_1.join)(component.videosFolder, outputSubfolder);
112
+ config['component']['videosFolder'] = serializeConfigPath(component.videosFolder, projectRoot, workspaceRoot, outputSubfolder);
98
113
  }
99
114
  if (component.screenshotsFolder) {
100
- config['component']['screenshotsFolder'] = (0, path_1.join)(component.screenshotsFolder, outputSubfolder);
115
+ config['component']['screenshotsFolder'] = serializeConfigPath(component.screenshotsFolder, projectRoot, workspaceRoot, outputSubfolder);
101
116
  }
102
117
  }
103
118
  // Stringify twice to escape the quotes.
104
119
  return JSON.stringify(JSON.stringify(config));
105
120
  }
106
- function getOutputs(projectRoot, cypressConfig, testingType) {
107
- function getOutput(path) {
108
- if (path.startsWith('..')) {
109
- return (0, devkit_1.joinPathFragments)('{workspaceRoot}', projectRoot, path);
110
- }
111
- else {
112
- return (0, devkit_1.joinPathFragments)('{projectRoot}', path);
121
+ function getOutputs(projectRoot, cypressConfig, testingType, workspaceRoot) {
122
+ const fullProjectRoot = (0, path_1.resolve)(workspaceRoot, projectRoot);
123
+ function getOutput(outputPath) {
124
+ const fullPath = (0, path_1.resolve)(fullProjectRoot, outputPath);
125
+ const relativeToProjectRoot = (0, devkit_1.normalizePath)((0, path_1.relative)(fullProjectRoot, fullPath));
126
+ if (relativeToProjectRoot.startsWith('..')) {
127
+ return (0, devkit_1.joinPathFragments)('{workspaceRoot}', (0, path_1.relative)(workspaceRoot, fullPath));
113
128
  }
129
+ return (0, devkit_1.joinPathFragments)('{projectRoot}', relativeToProjectRoot);
114
130
  }
115
131
  const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
116
132
  const outputs = [];
@@ -164,7 +180,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
164
180
  },
165
181
  cache: true,
166
182
  inputs: getInputs(namedInputs),
167
- outputs: getOutputs(projectRoot, cypressConfig, 'e2e'),
183
+ outputs: getOutputs(projectRoot, cypressConfig, 'e2e', context.workspaceRoot),
168
184
  metadata: {
169
185
  technologies: ['cypress'],
170
186
  description: 'Runs Cypress Tests',
@@ -209,7 +225,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
209
225
  const { specFiles, specPatterns, excludeSpecPatterns } = await getSpecFilesAndPatternsForTestType(cypressConfig, 'e2e', context.workspaceRoot, projectRoot);
210
226
  const ciBaseUrl = pluginPresetOptions?.ciBaseUrl;
211
227
  const dependsOn = [];
212
- const outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
228
+ const outputs = getOutputs(projectRoot, cypressConfig, 'e2e', context.workspaceRoot);
213
229
  const inputs = getInputs(namedInputs);
214
230
  const groupName = 'E2E (CI)';
215
231
  metadata = { targetGroups: { [groupName]: [] } };
@@ -239,7 +255,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
239
255
  outputs: getTargetOutputs(outputs, outputSubfolder),
240
256
  inputs,
241
257
  cache: true,
242
- command: `cypress run --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, outputSubfolder, ciBaseUrl)}`,
258
+ command: `cypress run --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, projectRoot, context.workspaceRoot, outputSubfolder, ciBaseUrl)}`,
243
259
  options: {
244
260
  cwd: projectRoot,
245
261
  env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
@@ -299,7 +315,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
299
315
  }
300
316
  if ('component' in cypressConfig) {
301
317
  const inputs = getInputs(namedInputs);
302
- const outputs = getOutputs(projectRoot, cypressConfig, 'component');
318
+ const outputs = getOutputs(projectRoot, cypressConfig, 'component', context.workspaceRoot);
303
319
  // This will not override the e2e target if it is the same
304
320
  targets[options.componentTestingTargetName] ??= {
305
321
  command: `cypress run --component`,
@@ -351,7 +367,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
351
367
  outputs: getTargetOutputs(outputs, outputSubfolder),
352
368
  inputs,
353
369
  cache: true,
354
- command: `cypress run --component --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, outputSubfolder)}`,
370
+ command: `cypress run --component --spec ${relativeSpecFilePath} --config=${getTargetConfig(cypressConfig, projectRoot, context.workspaceRoot, outputSubfolder)}`,
355
371
  options: {
356
372
  cwd: projectRoot,
357
373
  env: { TS_NODE_COMPILER_OPTIONS: tsNodeCompilerOptions },
@@ -1,4 +1,4 @@
1
1
  export declare const CYPRESS_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/cypress:cypress` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` to migrate to the `@nx/cypress/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
2
  export declare function warnCypressExecutorDeprecation(): void;
3
- export declare function warnCypressExecutorScaffolding(): void;
3
+ export declare function warnCypressExecutorGenerating(): void;
4
4
  //# sourceMappingURL=deprecation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oCAAoC,uQACqN,CAAC;AAEvQ,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAOD,wBAAgB,8BAA8B,IAAI,IAAI,CAIrD"}
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/deprecation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oCAAoC,uQACqN,CAAC;AAEvQ,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAOD,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CYPRESS_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
4
  exports.warnCypressExecutorDeprecation = warnCypressExecutorDeprecation;
5
- exports.warnCypressExecutorScaffolding = warnCypressExecutorScaffolding;
5
+ exports.warnCypressExecutorGenerating = warnCypressExecutorGenerating;
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  // TODO(v24): Remove the @nx/cypress:cypress executor. The inferred plugin
8
8
  // (@nx/cypress/plugin) and the convert-to-inferred generator stay supported.
@@ -11,10 +11,10 @@ function warnCypressExecutorDeprecation() {
11
11
  devkit_1.logger.warn(exports.CYPRESS_EXECUTOR_DEPRECATION_MESSAGE);
12
12
  }
13
13
  // Fired when the @nx/cypress:configuration or :component-configuration
14
- // generator is about to scaffold a target that uses the deprecated executor —
14
+ // generator is about to generate a target that uses the deprecated executor —
15
15
  // i.e. when @nx/cypress/plugin isn't registered in nx.json. Surfaces the
16
- // deprecation at scaffold time rather than only when the user later runs the
16
+ // deprecation at generation time rather than only when the user later runs the
17
17
  // generated target.
18
- function warnCypressExecutorScaffolding() {
19
- devkit_1.logger.warn('Scaffolding a target that uses the deprecated `@nx/cypress:cypress` executor. The executor will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` after this scaffold to migrate the generated target to the `@nx/cypress/plugin` inferred plugin. To skip emitting executor targets entirely on future scaffolds, register `@nx/cypress/plugin` in `nx.json` first (`nx add @nx/cypress` or a manual plugin entry). See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
18
+ function warnCypressExecutorGenerating() {
19
+ devkit_1.logger.warn('Generating a target that uses the deprecated `@nx/cypress:cypress` executor. The executor will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` next to migrate this target to the `@nx/cypress/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
20
20
  }
@@ -1,7 +1,7 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare const nxVersion: any;
3
3
  export declare const eslintPluginCypressVersion = "^3.5.0";
4
- export declare const typesNodeVersion = "20.19.9";
4
+ export declare const typesNodeVersion = "^22.0.0";
5
5
  export declare const cypressViteDevServerVersion = "^7.0.1";
6
6
  export declare const cypressVersion = "^15.8.0";
7
7
  export declare const cypressWebpackVersion = "^5.4.1";
@@ -9,7 +9,7 @@ const devkit_1 = require("@nx/devkit");
9
9
  const semver_1 = require("semver");
10
10
  exports.nxVersion = require('../../package.json').version;
11
11
  exports.eslintPluginCypressVersion = '^3.5.0';
12
- exports.typesNodeVersion = '20.19.9';
12
+ exports.typesNodeVersion = '^22.0.0';
13
13
  exports.cypressViteDevServerVersion = '^7.0.1';
14
14
  exports.cypressVersion = '^15.8.0';
15
15
  exports.cypressWebpackVersion = '^5.4.1';
@@ -27,7 +27,7 @@ const latestVersions = {
27
27
  const versionMap = {
28
28
  13: {
29
29
  eslintPluginCypressVersion: '^3.5.0',
30
- typesNodeVersion: '20.19.9',
30
+ typesNodeVersion: '^22.0.0',
31
31
  cypressViteDevServerVersion: '^2.2.1',
32
32
  cypressVersion: '^13.13.0',
33
33
  cypressWebpackVersion: '^3.8.0',
@@ -36,7 +36,7 @@ const versionMap = {
36
36
  },
37
37
  14: {
38
38
  eslintPluginCypressVersion: '^3.5.0',
39
- typesNodeVersion: '20.19.9',
39
+ typesNodeVersion: '^22.0.0',
40
40
  cypressViteDevServerVersion: '^6.0.3',
41
41
  cypressVersion: '^14.2.1',
42
42
  cypressWebpackVersion: '^4.0.2',