@nx/cypress 17.2.0-beta.4 → 17.2.0-beta.6
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.
|
|
3
|
+
"version": "17.2.0-beta.6",
|
|
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.
|
|
38
|
-
"@nx/eslint": "17.2.0-beta.
|
|
39
|
-
"@nx/js": "17.2.0-beta.
|
|
37
|
+
"@nx/devkit": "17.2.0-beta.6",
|
|
38
|
+
"@nx/eslint": "17.2.0-beta.6",
|
|
39
|
+
"@nx/js": "17.2.0-beta.6",
|
|
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.
|
|
45
|
+
"@nrwl/cypress": "17.2.0-beta.6"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"cypress": ">= 3 < 14"
|
|
@@ -72,13 +72,13 @@ function nxE2EPreset(pathToConfig, options) {
|
|
|
72
72
|
if (!config.env.webServerCommands) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
const webServerCommand = config.env.webServerCommand
|
|
75
|
+
const webServerCommand = config.env.webServerCommand;
|
|
76
76
|
if (!webServerCommand) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
if (config.baseUrl && webServerCommand) {
|
|
80
80
|
if (await isServerUp(config.baseUrl)) {
|
|
81
|
-
if (options
|
|
81
|
+
if (options?.webServerConfig?.reuseExistingServer === undefined
|
|
82
82
|
? true
|
|
83
83
|
: options.webServerConfig.reuseExistingServer) {
|
|
84
84
|
console.log(`Reusing the server already running on ${config.baseUrl}`);
|
|
@@ -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 &&
|
|
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);
|
package/src/plugins/plugin.js
CHANGED
|
@@ -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
|
|
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 (
|
|
121
|
-
|
|
122
|
+
if (webServerCommands?.default) {
|
|
123
|
+
cypressConfig.e2e ??= {};
|
|
124
|
+
cypressConfig.e2e.webServerCommand ??= webServerCommands?.default;
|
|
125
|
+
delete webServerCommands.default;
|
|
122
126
|
}
|
|
123
|
-
if (Object.keys(
|
|
127
|
+
if (Object.keys(webServerCommands ?? {}).length > 0) {
|
|
124
128
|
targets[options.targetName].configurations ??= {};
|
|
125
|
-
for (const [configuration,
|
|
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
|
|
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
|
|
157
|
+
command: `cypress run --config-file ${relativeConfigPath} --e2e --env webServerCommand="${ciWebServerCommand}" --spec ${relativeSpecFilePath}`,
|
|
154
158
|
options: {
|
|
155
159
|
cwd: projectRoot,
|
|
156
160
|
},
|