@nx/cypress 19.4.0-beta.1 → 19.4.0-beta.2
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/generators.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"init": {
|
|
6
6
|
"factory": "./src/generators/init/init#cypressInitGeneratorInternal",
|
|
7
7
|
"schema": "./src/generators/init/schema.json",
|
|
8
|
-
"description": "Initialize the `@
|
|
8
|
+
"description": "Initialize the `@nx/cypress` plugin.",
|
|
9
9
|
"aliases": ["ng-add"],
|
|
10
10
|
"hidden": true
|
|
11
11
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "19.4.0-beta.
|
|
3
|
+
"version": "19.4.0-beta.2",
|
|
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": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"migrations": "./migrations.json"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "19.4.0-beta.
|
|
40
|
-
"@nx/eslint": "19.4.0-beta.
|
|
41
|
-
"@nx/js": "19.4.0-beta.
|
|
39
|
+
"@nx/devkit": "19.4.0-beta.2",
|
|
40
|
+
"@nx/eslint": "19.4.0-beta.2",
|
|
41
|
+
"@nx/js": "19.4.0-beta.2",
|
|
42
42
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
43
43
|
"detect-port": "^1.5.1",
|
|
44
44
|
"tslib": "^2.3.0",
|
|
45
|
-
"@nrwl/cypress": "19.4.0-beta.
|
|
45
|
+
"@nrwl/cypress": "19.4.0-beta.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"cypress": ">= 3 < 14"
|
|
@@ -3,23 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convertToInferred = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
6
|
+
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
6
7
|
const plugin_1 = require("../../plugins/plugin");
|
|
7
|
-
const target_options_map_1 = require("./lib/target-options-map");
|
|
8
|
-
const upsert_baseUrl_1 = require("./lib/upsert-baseUrl");
|
|
9
8
|
const add_dev_server_target_to_config_1 = require("./lib/add-dev-server-target-to-config");
|
|
10
9
|
const add_exclude_spec_pattern_1 = require("./lib/add-exclude-spec-pattern");
|
|
10
|
+
const target_options_map_1 = require("./lib/target-options-map");
|
|
11
|
+
const upsert_baseUrl_1 = require("./lib/upsert-baseUrl");
|
|
11
12
|
async function convertToInferred(tree, options) {
|
|
12
13
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
13
|
-
const
|
|
14
|
-
targetName,
|
|
15
|
-
ciTargetName: 'e2e-ci',
|
|
16
|
-
}), postTargetTransformer, plugin_1.createNodesV2, options.project);
|
|
17
|
-
const migratedProjectsLegacy = await (0, executor_to_plugin_migrator_1.migrateExecutorToPlugin)(tree, projectGraph, '@nrwl/cypress:cypress', '@nx/cypress/plugin', (targetName) => ({
|
|
18
|
-
targetName,
|
|
14
|
+
const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/cypress/plugin', plugin_1.createNodesV2, {
|
|
15
|
+
targetName: 'cypress',
|
|
19
16
|
ciTargetName: 'e2e-ci',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
componentTestingTargetName: 'component-test',
|
|
18
|
+
openTargetName: 'open-cypress',
|
|
19
|
+
}, [
|
|
20
|
+
{
|
|
21
|
+
executors: ['@nx/cypress:cypress', '@nrwl/cypress:cypress'],
|
|
22
|
+
postTargetTransformer,
|
|
23
|
+
targetPluginOptionMapper: (targetName) => ({ targetName }),
|
|
24
|
+
},
|
|
25
|
+
], options.project);
|
|
26
|
+
if (migratedProjects.size === 0) {
|
|
23
27
|
throw new Error('Could not find any targets to migrate.');
|
|
24
28
|
}
|
|
25
29
|
if (!options.skipFormat) {
|
|
@@ -27,58 +31,19 @@ async function convertToInferred(tree, options) {
|
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
exports.convertToInferred = convertToInferred;
|
|
30
|
-
function postTargetTransformer(target, tree) {
|
|
34
|
+
function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
|
31
35
|
if (target.options) {
|
|
32
|
-
|
|
33
|
-
delete target.options.cypressConfig;
|
|
34
|
-
delete target.options.copyFiles;
|
|
35
|
-
delete target.options.skipServe;
|
|
36
|
-
for (const key in target_options_map_1.targetOptionsToCliMap) {
|
|
37
|
-
if (target.options[key]) {
|
|
38
|
-
target.options[target_options_map_1.targetOptionsToCliMap[key]] = target.options[key];
|
|
39
|
-
delete target.options[key];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if ('exit' in target.options && !target.options.exit) {
|
|
43
|
-
delete target.options.exit;
|
|
44
|
-
target.options['no-exit'] = true;
|
|
45
|
-
}
|
|
46
|
-
if (target.options.testingType) {
|
|
47
|
-
delete target.options.testingType;
|
|
48
|
-
}
|
|
49
|
-
if (target.options.watch) {
|
|
50
|
-
target.options.headed = true;
|
|
51
|
-
target.options['no-exit'] = true;
|
|
52
|
-
delete target.options.watch;
|
|
53
|
-
}
|
|
54
|
-
if (target.options.baseUrl) {
|
|
55
|
-
(0, upsert_baseUrl_1.upsertBaseUrl)(tree, configFilePath, target.options.baseUrl);
|
|
56
|
-
delete target.options.baseUrl;
|
|
57
|
-
}
|
|
58
|
-
if (target.options.devServerTarget) {
|
|
59
|
-
const webServerCommands = {
|
|
60
|
-
default: `npx nx run ${target.options.devServerTarget}`,
|
|
61
|
-
};
|
|
62
|
-
delete target.options.devServerTarget;
|
|
63
|
-
if (target.configurations) {
|
|
64
|
-
for (const configuration in target.configurations) {
|
|
65
|
-
if (target.configurations[configuration]?.devServerTarget) {
|
|
66
|
-
webServerCommands[configuration] = `npx nx run ${target.configurations[configuration].devServerTarget}`;
|
|
67
|
-
delete target.configurations[configuration].devServerTarget;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
(0, add_dev_server_target_to_config_1.addDevServerTargetToConfig)(tree, configFilePath, webServerCommands, webServerCommands?.['ci']);
|
|
72
|
-
}
|
|
73
|
-
if (target.options.ignoreTestFiles) {
|
|
74
|
-
(0, add_exclude_spec_pattern_1.addExcludeSpecPattern)(tree, configFilePath, target.options.ignoreTestFiles);
|
|
75
|
-
delete target.options.ignoreTestFiles;
|
|
76
|
-
}
|
|
36
|
+
handlePropertiesInOptions(tree, target.options, projectDetails.root, target);
|
|
77
37
|
if (Object.keys(target.options).length === 0) {
|
|
78
38
|
delete target.options;
|
|
79
39
|
}
|
|
80
|
-
|
|
81
|
-
|
|
40
|
+
}
|
|
41
|
+
if (target.configurations) {
|
|
42
|
+
for (const configurationName in target.configurations) {
|
|
43
|
+
const configuration = target.configurations[configurationName];
|
|
44
|
+
handlePropertiesInOptions(tree, configuration, projectDetails.root, target);
|
|
45
|
+
}
|
|
46
|
+
if (Object.keys(target.configurations).length !== 0) {
|
|
82
47
|
for (const configuration in target.configurations) {
|
|
83
48
|
if (Object.keys(target.configurations[configuration]).length === 0) {
|
|
84
49
|
delete target.configurations[configuration];
|
|
@@ -89,6 +54,68 @@ function postTargetTransformer(target, tree) {
|
|
|
89
54
|
}
|
|
90
55
|
}
|
|
91
56
|
}
|
|
57
|
+
if (target.outputs) {
|
|
58
|
+
(0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
|
|
59
|
+
projectName: projectDetails.projectName,
|
|
60
|
+
projectRoot: projectDetails.root,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
92
63
|
return target;
|
|
93
64
|
}
|
|
65
|
+
function handlePropertiesInOptions(tree, options, projectRoot, target) {
|
|
66
|
+
let configFilePath;
|
|
67
|
+
if ('cypressConfig' in options) {
|
|
68
|
+
configFilePath = options.cypressConfig;
|
|
69
|
+
options['config-file'] = (0, plugin_migration_utils_1.toProjectRelativePath)(configFilePath, projectRoot);
|
|
70
|
+
delete options.cypressConfig;
|
|
71
|
+
}
|
|
72
|
+
if ('copyFiles' in options) {
|
|
73
|
+
delete options.copyFiles;
|
|
74
|
+
}
|
|
75
|
+
if ('skipServe' in options) {
|
|
76
|
+
delete options.skipServe;
|
|
77
|
+
}
|
|
78
|
+
for (const key in target_options_map_1.targetOptionsToCliMap) {
|
|
79
|
+
if (options[key]) {
|
|
80
|
+
const prevValue = options[key];
|
|
81
|
+
delete options[key];
|
|
82
|
+
options[target_options_map_1.targetOptionsToCliMap[key]] = prevValue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if ('exit' in options && !options.exit) {
|
|
86
|
+
delete options.exit;
|
|
87
|
+
options['no-exit'] = true;
|
|
88
|
+
}
|
|
89
|
+
if ('testingType' in options) {
|
|
90
|
+
delete options.testingType;
|
|
91
|
+
}
|
|
92
|
+
if ('watch' in options) {
|
|
93
|
+
options.headed = true;
|
|
94
|
+
options['no-exit'] = true;
|
|
95
|
+
delete options.watch;
|
|
96
|
+
}
|
|
97
|
+
if (options.baseUrl && configFilePath) {
|
|
98
|
+
(0, upsert_baseUrl_1.upsertBaseUrl)(tree, configFilePath, options.baseUrl);
|
|
99
|
+
delete options.baseUrl;
|
|
100
|
+
}
|
|
101
|
+
if (options.devServerTarget && configFilePath) {
|
|
102
|
+
const webServerCommands = {
|
|
103
|
+
default: `npx nx run ${options.devServerTarget}`,
|
|
104
|
+
};
|
|
105
|
+
delete options.devServerTarget;
|
|
106
|
+
if (target.configurations && configFilePath) {
|
|
107
|
+
for (const configuration in target.configurations) {
|
|
108
|
+
if (target.configurations[configuration]?.devServerTarget) {
|
|
109
|
+
webServerCommands[configuration] = `npx nx run ${target.configurations[configuration].devServerTarget}`;
|
|
110
|
+
delete target.configurations[configuration].devServerTarget;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
(0, add_dev_server_target_to_config_1.addDevServerTargetToConfig)(tree, configFilePath, webServerCommands, webServerCommands?.['ci']);
|
|
115
|
+
}
|
|
116
|
+
if ('ignoreTestFiles' in options) {
|
|
117
|
+
(0, add_exclude_spec_pattern_1.addExcludeSpecPattern)(tree, configFilePath, options.ignoreTestFiles);
|
|
118
|
+
delete options.ignoreTestFiles;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
94
121
|
exports.default = convertToInferred;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -173,6 +173,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
173
173
|
metadata: {
|
|
174
174
|
technologies: ['cypress'],
|
|
175
175
|
description: `Runs Cypress Tests in ${relativeSpecFilePath} in CI`,
|
|
176
|
+
nonAtomizedTarget: options.targetName,
|
|
176
177
|
},
|
|
177
178
|
};
|
|
178
179
|
dependsOn.push({
|
|
@@ -190,6 +191,7 @@ async function buildCypressTargets(configFilePath, projectRoot, options, context
|
|
|
190
191
|
metadata: {
|
|
191
192
|
technologies: ['cypress'],
|
|
192
193
|
description: 'Runs Cypress Tests in CI',
|
|
194
|
+
nonAtomizedTarget: options.targetName,
|
|
193
195
|
},
|
|
194
196
|
};
|
|
195
197
|
ciTargetGroup.push(options.ciTargetName);
|