@nx/cypress 17.2.0-beta.4 → 17.2.0-beta.5

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": "17.2.0-beta.4",
3
+ "version": "17.2.0-beta.5",
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": {
@@ -34,15 +34,15 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "17.2.0-beta.4",
38
- "@nx/eslint": "17.2.0-beta.4",
39
- "@nx/js": "17.2.0-beta.4",
37
+ "@nx/devkit": "17.2.0-beta.5",
38
+ "@nx/eslint": "17.2.0-beta.5",
39
+ "@nx/js": "17.2.0-beta.5",
40
40
  "@phenomnomnominal/tsquery": "~5.0.1",
41
41
  "detect-port": "^1.5.1",
42
42
  "string-argv": "^0.3.2",
43
43
  "semver": "7.5.3",
44
44
  "tslib": "^2.3.0",
45
- "@nrwl/cypress": "17.2.0-beta.4"
45
+ "@nrwl/cypress": "17.2.0-beta.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "cypress": ">= 3 < 14"
@@ -72,7 +72,7 @@ function nxE2EPreset(pathToConfig, options) {
72
72
  if (!config.env.webServerCommands) {
73
73
  return;
74
74
  }
75
- const webServerCommand = config.env.webServerCommand ?? config.env.webServerCommands.default;
75
+ const webServerCommand = config.env.webServerCommand;
76
76
  if (!webServerCommand) {
77
77
  return;
78
78
  }
@@ -97,7 +97,7 @@ async function addFiles(tree, options, projectGraph, hasPlugin) {
97
97
  const cyFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts');
98
98
  let webServerCommands;
99
99
  let ciDevServerTarget;
100
- if (hasPlugin && !options.baseUrl && options.devServerTarget) {
100
+ if (hasPlugin && options.devServerTarget) {
101
101
  webServerCommands = {};
102
102
  webServerCommands.default = 'nx run ' + options.devServerTarget;
103
103
  const parsedTarget = (0, devkit_1.parseTargetString)(options.devServerTarget, projectGraph);
@@ -36,7 +36,9 @@ exports.createNodes = [
36
36
  !siblingFiles.includes('project.json')) {
37
37
  return {};
38
38
  }
39
- const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context);
39
+ const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
40
+ (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
41
+ ]);
40
42
  const targets = targetsCache[hash]
41
43
  ? targetsCache[hash]
42
44
  : buildCypressTargets(configFilePath, projectRoot, options, context);
@@ -96,7 +98,7 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
96
98
  ...cypressConfig.env,
97
99
  ...cypressConfig.e2e?.env,
98
100
  };
99
- const devServerTargets = cypressEnv?.devServerTargets;
101
+ const webServerCommands = cypressEnv?.webServerCommands;
100
102
  const relativeConfigPath = (0, path_1.relative)(projectRoot, configFilePath);
101
103
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
102
104
  const targets = {};
@@ -117,14 +119,16 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
117
119
  if (e2eTargetDefaults?.outputs === undefined) {
118
120
  targets[options.targetName].outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
119
121
  }
120
- if (devServerTargets?.default) {
121
- delete devServerTargets.default;
122
+ if (webServerCommands?.default) {
123
+ cypressConfig.e2e ??= {};
124
+ cypressConfig.e2e.webServerCommand ??= webServerCommands?.default;
125
+ delete webServerCommands.default;
122
126
  }
123
- if (Object.keys(devServerTargets ?? {}).length > 0) {
127
+ if (Object.keys(webServerCommands ?? {}).length > 0) {
124
128
  targets[options.targetName].configurations ??= {};
125
- for (const [configuration, devServerTarget] of Object.entries(devServerTargets ?? {})) {
129
+ for (const [configuration, webServerCommand] of Object.entries(webServerCommands ?? {})) {
126
130
  targets[options.targetName].configurations[configuration] = {
127
- command: `cypress run --config-file ${relativeConfigPath} --e2e --env.webServerCommand "nx run ${devServerTarget}"`,
131
+ command: `cypress run --config-file ${relativeConfigPath} --e2e --env webServerCommand="${webServerCommand}"`,
128
132
  };
129
133
  }
130
134
  }
@@ -150,7 +154,7 @@ function buildCypressTargets(configFilePath, projectRoot, options, context) {
150
154
  outputs,
151
155
  inputs,
152
156
  cache: true,
153
- command: `cypress run --config-file ${relativeConfigPath} --e2e --env=${JSON.stringify({ webServerCommand: ciWebServerCommand })} --spec ${relativeSpecFilePath}`,
157
+ command: `cypress run --config-file ${relativeConfigPath} --e2e --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath}`,
154
158
  options: {
155
159
  cwd: projectRoot,
156
160
  },