@nx/cypress 24.1.0-beta.1 → 24.1.0-beta.3
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/dist/src/generators/convert-to-inferred/convert-to-inferred.js +26 -3
- package/dist/src/generators/convert-to-inferred/lib/target-options-map.d.ts +1 -0
- package/dist/src/generators/convert-to-inferred/lib/target-options-map.js +31 -1
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +1 -1
- package/package.json +5 -5
|
@@ -33,6 +33,7 @@ async function convertToInferred(tree, options) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
|
36
|
+
removeUnknownExecutorOptions(target, projectDetails.projectName, inferredTargetConfiguration.name);
|
|
36
37
|
if (target.options?.testingType === 'component') {
|
|
37
38
|
moveBuildTargetToComponentTestingPreset(tree, target, projectDetails.projectName);
|
|
38
39
|
}
|
|
@@ -66,6 +67,31 @@ function postTargetTransformer(target, tree, projectDetails, inferredTargetConfi
|
|
|
66
67
|
}
|
|
67
68
|
return target;
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Drops options the executor never defined and therefore ignored. The converted
|
|
72
|
+
* target forwards its options to run-commands, which reads some of them as its
|
|
73
|
+
* own, and `command` replaces the Cypress command outright.
|
|
74
|
+
*/
|
|
75
|
+
function removeUnknownExecutorOptions(target, projectName, targetName) {
|
|
76
|
+
const dropped = new Set();
|
|
77
|
+
const strip = (options) => {
|
|
78
|
+
for (const option of Object.keys(options ?? {})) {
|
|
79
|
+
if (!target_options_map_1.executorOptions.has(option)) {
|
|
80
|
+
delete options[option];
|
|
81
|
+
dropped.add(option);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
strip(target.options);
|
|
86
|
+
for (const configuration of Object.values(target.configurations ?? {})) {
|
|
87
|
+
strip(configuration);
|
|
88
|
+
}
|
|
89
|
+
if (dropped.size) {
|
|
90
|
+
const names = [...dropped].map((option) => `"${option}"`).join(', ');
|
|
91
|
+
const [subject, object] = dropped.size === 1 ? ['that option', 'it'] : ['those options', 'them'];
|
|
92
|
+
devkit_1.logger.warn(`Removed ${names} from the "${targetName}" target of project "${projectName}". The "@nx/cypress:cypress" executor did not define ${subject}, so keeping ${object} would change what the converted target runs.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
69
95
|
function moveBuildTargetToComponentTestingPreset(tree, target, projectName) {
|
|
70
96
|
const defaultConfiguration = target.defaultConfiguration
|
|
71
97
|
? target.configurations?.[target.defaultConfiguration]
|
|
@@ -95,9 +121,6 @@ function handlePropertiesInOptions(tree, options, projectRoot, target) {
|
|
|
95
121
|
options['config-file'] = (0, internal_1.toProjectRelativePath)(configFilePath, projectRoot);
|
|
96
122
|
delete options.cypressConfig;
|
|
97
123
|
}
|
|
98
|
-
if ('copyFiles' in options) {
|
|
99
|
-
delete options.copyFiles;
|
|
100
|
-
}
|
|
101
124
|
if ('skipServe' in options) {
|
|
102
125
|
delete options.skipServe;
|
|
103
126
|
}
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.targetOptionsToCliMap = void 0;
|
|
3
|
+
exports.targetOptionsToCliMap = exports.executorOptions = void 0;
|
|
4
|
+
// The option surface of the `@nx/cypress:cypress` schema. The removed executor
|
|
5
|
+
// no longer ships a schema.json to read it from, and the converter drops
|
|
6
|
+
// anything outside this set rather than forwarding it to run-commands.
|
|
7
|
+
exports.executorOptions = new Set([
|
|
8
|
+
'autoCancelAfterFailures',
|
|
9
|
+
'baseUrl',
|
|
10
|
+
'browser',
|
|
11
|
+
'ciBuildId',
|
|
12
|
+
'cypressConfig',
|
|
13
|
+
'devServerTarget',
|
|
14
|
+
'env',
|
|
15
|
+
'exit',
|
|
16
|
+
'group',
|
|
17
|
+
'headed',
|
|
18
|
+
'headless',
|
|
19
|
+
'ignoreTestFiles',
|
|
20
|
+
'key',
|
|
21
|
+
'parallel',
|
|
22
|
+
'port',
|
|
23
|
+
'quiet',
|
|
24
|
+
'record',
|
|
25
|
+
'reporter',
|
|
26
|
+
'reporterOptions',
|
|
27
|
+
'runnerUi',
|
|
28
|
+
'skipServe',
|
|
29
|
+
'spec',
|
|
30
|
+
'tag',
|
|
31
|
+
'testingType',
|
|
32
|
+
'watch',
|
|
33
|
+
]);
|
|
4
34
|
exports.targetOptionsToCliMap = {
|
|
5
35
|
headed: 'headed',
|
|
6
36
|
headless: 'headless',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#### Convert `@nx/cypress:cypress` targets to inferred tasks
|
|
2
2
|
|
|
3
|
-
Nx 24 removes the `@nx/cypress:cypress` executor and its `@nrwl/cypress:cypress` alias. The migration registers `@nx/cypress/plugin` in `nx.json` and converts the targets that use those executors to inferred tasks. It moves the dev server and `baseUrl` settings into `cypress.config.*`. A component testing target's `devServerTarget` becomes the `buildTarget` option of `nxComponentTestingPreset`. A target with nothing left to override is removed from project configuration. When several projects share the same remaining options, those options move to a `targetDefaults` entry scoped to the plugin. `targetDefaults` entries keyed by a removed executor are removed once no target uses that executor.
|
|
3
|
+
Nx 24 removes the `@nx/cypress:cypress` executor and its `@nrwl/cypress:cypress` alias. The migration registers `@nx/cypress/plugin` in `nx.json` and converts the targets that use those executors to inferred tasks. It moves the dev server and `baseUrl` settings into `cypress.config.*`. A component testing target's `devServerTarget` becomes the `buildTarget` option of `nxComponentTestingPreset`. Options the removed executor never defined are dropped, and the migration logs each one, because the inferred task would otherwise forward them and a key such as `command` replaces the command the task runs. A target with nothing left to override is removed from project configuration. When several projects share the same remaining options, those options move to a `targetDefaults` entry scoped to the plugin. `targetDefaults` entries keyed by a removed executor are removed once no target uses that executor.
|
|
4
4
|
|
|
5
5
|
The migration lists the targets the converter cannot convert safely. In agentic runs, an AI prompt finishes them and validates the project graph.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "24.1.0-beta.
|
|
3
|
+
"version": "24.1.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -84,16 +84,16 @@
|
|
|
84
84
|
"supportsOptionalMigrations": true
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@nx/devkit": "24.1.0-beta.
|
|
88
|
-
"@nx/eslint": "24.1.0-beta.
|
|
89
|
-
"@nx/js": "24.1.0-beta.
|
|
87
|
+
"@nx/devkit": "24.1.0-beta.3",
|
|
88
|
+
"@nx/eslint": "24.1.0-beta.3",
|
|
89
|
+
"@nx/js": "24.1.0-beta.3",
|
|
90
90
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
91
91
|
"semver": "^7.6.3",
|
|
92
92
|
"tree-kill": "^1.2.2",
|
|
93
93
|
"tslib": "^2.3.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"nx": "24.1.0-beta.
|
|
96
|
+
"nx": "24.1.0-beta.3"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"cypress": ">= 13 < 17"
|