@nx/cypress 18.1.2 → 18.2.0-beta.0
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 +5 -5
- package/src/plugins/plugin.js +25 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.2.0-beta.0",
|
|
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.
|
|
38
|
-
"@nx/eslint": "18.
|
|
39
|
-
"@nx/js": "18.
|
|
37
|
+
"@nx/devkit": "18.2.0-beta.0",
|
|
38
|
+
"@nx/eslint": "18.2.0-beta.0",
|
|
39
|
+
"@nx/js": "18.2.0-beta.0",
|
|
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.
|
|
44
|
+
"@nrwl/cypress": "18.2.0-beta.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 14"
|
package/src/plugins/plugin.js
CHANGED
|
@@ -39,16 +39,25 @@ 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, ciTestingGroup } = targetsCache[hash]
|
|
43
43
|
? targetsCache[hash]
|
|
44
44
|
: await buildCypressTargets(configFilePath, projectRoot, options, context);
|
|
45
|
-
calculatedTargets[hash] = targets;
|
|
45
|
+
calculatedTargets[hash] = { targets, ciTestingGroup };
|
|
46
|
+
const project = {
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
targets,
|
|
49
|
+
metadata: {
|
|
50
|
+
technologies: ['cypress'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
if (ciTestingGroup) {
|
|
54
|
+
project.metadata.targetGroups = {
|
|
55
|
+
[`${projectRoot}:e2e-ci`]: ciTestingGroup,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
46
58
|
return {
|
|
47
59
|
projects: {
|
|
48
|
-
[projectRoot]:
|
|
49
|
-
projectType: 'application',
|
|
50
|
-
targets,
|
|
51
|
-
},
|
|
60
|
+
[projectRoot]: project,
|
|
52
61
|
},
|
|
53
62
|
};
|
|
54
63
|
},
|
|
@@ -56,10 +65,10 @@ exports.createNodes = [
|
|
|
56
65
|
function getOutputs(projectRoot, cypressConfig, testingType) {
|
|
57
66
|
function getOutput(path) {
|
|
58
67
|
if (path.startsWith('..')) {
|
|
59
|
-
return (0,
|
|
68
|
+
return (0, devkit_1.joinPathFragments)('{workspaceRoot}', projectRoot, path);
|
|
60
69
|
}
|
|
61
70
|
else {
|
|
62
|
-
return (0,
|
|
71
|
+
return (0, devkit_1.joinPathFragments)('{projectRoot}', path);
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
74
|
const { screenshotsFolder, videosFolder, e2e, component } = cypressConfig;
|
|
@@ -102,6 +111,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
102
111
|
const webServerCommands = pluginPresetOptions?.webServerCommands;
|
|
103
112
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
104
113
|
const targets = {};
|
|
114
|
+
let ciTestingGroup = [];
|
|
105
115
|
if ('e2e' in cypressConfig) {
|
|
106
116
|
targets[options.targetName] = {
|
|
107
117
|
command: `cypress run`,
|
|
@@ -137,8 +147,9 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
137
147
|
const outputs = getOutputs(projectRoot, cypressConfig, 'e2e');
|
|
138
148
|
const inputs = getInputs(namedInputs);
|
|
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
|
+
ciTestingGroup.push(targetName);
|
|
142
153
|
targets[targetName] = {
|
|
143
154
|
outputs,
|
|
144
155
|
inputs,
|
|
@@ -162,6 +173,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
162
173
|
outputs,
|
|
163
174
|
dependsOn,
|
|
164
175
|
};
|
|
176
|
+
ciTestingGroup.push(options.ciTargetName);
|
|
165
177
|
}
|
|
166
178
|
}
|
|
167
179
|
if ('component' in cypressConfig) {
|
|
@@ -174,7 +186,10 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
174
186
|
outputs: getOutputs(projectRoot, cypressConfig, 'component'),
|
|
175
187
|
};
|
|
176
188
|
}
|
|
177
|
-
|
|
189
|
+
if (ciTestingGroup.length === 0) {
|
|
190
|
+
ciTestingGroup = null;
|
|
191
|
+
}
|
|
192
|
+
return { targets, ciTestingGroup };
|
|
178
193
|
}
|
|
179
194
|
function normalizeOptions(options) {
|
|
180
195
|
options ??= {};
|