@nx/cypress 18.1.3 → 18.2.0-beta.1
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/LICENSE +1 -1
- package/package.json +5 -5
- package/src/plugins/plugin.js +25 -11
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "18.1
|
|
3
|
+
"version": "18.2.0-beta.1",
|
|
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,14 +34,14 @@
|
|
|
34
34
|
"migrations": "./migrations.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "18.1
|
|
38
|
-
"@nx/eslint": "18.1
|
|
39
|
-
"@nx/js": "18.1
|
|
37
|
+
"@nx/devkit": "18.2.0-beta.1",
|
|
38
|
+
"@nx/eslint": "18.2.0-beta.1",
|
|
39
|
+
"@nx/js": "18.2.0-beta.1",
|
|
40
40
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
41
41
|
"detect-port": "^1.5.1",
|
|
42
42
|
"semver": "^7.5.3",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
|
-
"@nrwl/cypress": "18.1
|
|
44
|
+
"@nrwl/cypress": "18.2.0-beta.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
package/src/plugins/plugin.js
CHANGED
|
@@ -39,16 +39,23 @@ exports.createNodes = [
|
|
|
39
39
|
const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
40
40
|
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
|
41
41
|
]);
|
|
42
|
-
const targets = targetsCache[hash]
|
|
42
|
+
const { targets, targetGroups } = targetsCache[hash]
|
|
43
43
|
? targetsCache[hash]
|
|
44
44
|
: await buildCypressTargets(configFilePath, projectRoot, options, context);
|
|
45
|
-
calculatedTargets[hash] = targets;
|
|
45
|
+
calculatedTargets[hash] = { targets, targetGroups };
|
|
46
|
+
const project = {
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
targets,
|
|
49
|
+
metadata: {
|
|
50
|
+
technologies: ['cypress'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
if (targetGroups) {
|
|
54
|
+
project.metadata.targetGroups = targetGroups;
|
|
55
|
+
}
|
|
46
56
|
return {
|
|
47
57
|
projects: {
|
|
48
|
-
[projectRoot]:
|
|
49
|
-
projectType: 'application',
|
|
50
|
-
targets,
|
|
51
|
-
},
|
|
58
|
+
[projectRoot]: project,
|
|
52
59
|
},
|
|
53
60
|
};
|
|
54
61
|
},
|
|
@@ -56,10 +63,10 @@ exports.createNodes = [
|
|
|
56
63
|
function getOutputs(projectRoot, cypressConfig, testingType) {
|
|
57
64
|
function getOutput(path) {
|
|
58
65
|
if (path.startsWith('..')) {
|
|
59
|
-
return (0,
|
|
66
|
+
return (0, devkit_1.joinPathFragments)('{workspaceRoot}', projectRoot, path);
|
|
60
67
|
}
|
|
61
68
|
else {
|
|
62
|
-
return (0,
|
|
69
|
+
return (0, devkit_1.joinPathFragments)('{projectRoot}', path);
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
|
|
@@ -102,6 +109,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
102
109
|
const webServerCommands = pluginPresetOptions?.webServerCommands;
|
|
103
110
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
104
111
|
const targets = {};
|
|
112
|
+
let targetGroups;
|
|
105
113
|
if ('e2e' in cypressConfig) {
|
|
106
114
|
targets[options.targetName] = {
|
|
107
115
|
command: `cypress run`,
|
|
@@ -136,9 +144,12 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
136
144
|
const dependsOn = [];
|
|
137
145
|
const outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
|
|
138
146
|
const inputs = getInputs(namedInputs);
|
|
147
|
+
targetGroups = { [options.ciTargetName]: [] };
|
|
148
|
+
const ciTargetGroup = targetGroups[options.ciTargetName];
|
|
139
149
|
for (const file of specFiles) {
|
|
140
|
-
const relativeSpecFilePath = (0, path_1.relative)(projectRoot, file);
|
|
150
|
+
const relativeSpecFilePath = (0, devkit_1.normalizePath)((0, path_1.relative)(projectRoot, file));
|
|
141
151
|
const targetName = options.ciTargetName + '--' + relativeSpecFilePath;
|
|
152
|
+
ciTargetGroup.push(targetName);
|
|
142
153
|
targets[targetName] = {
|
|
143
154
|
outputs,
|
|
144
155
|
inputs,
|
|
@@ -154,7 +165,6 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
154
165
|
params: 'forward',
|
|
155
166
|
});
|
|
156
167
|
}
|
|
157
|
-
targets[options.ciTargetName] ??= {};
|
|
158
168
|
targets[options.ciTargetName] = {
|
|
159
169
|
executor: 'nx:noop',
|
|
160
170
|
cache: true,
|
|
@@ -162,6 +172,10 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
162
172
|
outputs,
|
|
163
173
|
dependsOn,
|
|
164
174
|
};
|
|
175
|
+
ciTargetGroup.push(options.ciTargetName);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
targetGroups = null;
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
181
|
if ('component' in cypressConfig) {
|
|
@@ -174,7 +188,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
174
188
|
outputs: getOutputs(projectRoot, cypressConfig, 'component'),
|
|
175
189
|
};
|
|
176
190
|
}
|
|
177
|
-
return targets;
|
|
191
|
+
return { targets, targetGroups };
|
|
178
192
|
}
|
|
179
193
|
function normalizeOptions(options) {
|
|
180
194
|
options ??= {};
|