@nx/cypress 16.4.0-beta.10 → 16.4.0-beta.14
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/migrations.json +12 -0
- package/package.json +6 -6
- package/plugins/cypress-preset.d.ts +3 -1
- package/plugins/cypress-preset.js +4 -1
- package/src/executors/cypress/cypress.impl.d.ts +0 -1
- package/src/executors/cypress/cypress.impl.js +23 -38
- package/src/executors/cypress/schema.json +1 -0
- package/src/generators/migrate-to-cypress-11/conversion.util.d.ts +5 -0
- package/src/migrations/update-16-4-0/tsconfig-sourcemaps.d.ts +3 -0
- package/src/migrations/update-16-4-0/tsconfig-sourcemaps.js +59 -0
- package/src/migrations/update-16-4-0/warn-incompatible-angular-cypress.d.ts +2 -0
- package/src/migrations/update-16-4-0/warn-incompatible-angular-cypress.js +56 -0
package/migrations.json
CHANGED
|
@@ -53,6 +53,18 @@
|
|
|
53
53
|
"version": "16.2.0-beta.0",
|
|
54
54
|
"description": "Normalize tsconfig.cy.json files to be located at '<projectRoot>/cypress/tsconfig.json'",
|
|
55
55
|
"implementation": "./src/migrations/update-16-2-0/update-cy-tsconfig"
|
|
56
|
+
},
|
|
57
|
+
"update-16-3-0-remove-old-tsconfigs": {
|
|
58
|
+
"cli": "nx",
|
|
59
|
+
"version": "16.4.0-beta.10",
|
|
60
|
+
"description": "Remove tsconfig.e2e.json and add settings to project tsconfig.json. tsConfigs executor option is now deprecated. The project level tsconfig.json file should be used instead.",
|
|
61
|
+
"implementation": "./src/migrations/update-16-4-0/tsconfig-sourcemaps"
|
|
62
|
+
},
|
|
63
|
+
"update-16-4-0-warn-incompatible-angular-cypress": {
|
|
64
|
+
"cli": "nx",
|
|
65
|
+
"version": "16.4.0-beta.11",
|
|
66
|
+
"description": "Cypress Component Testing is broken with Angular 16.1.0. Warn about it if the workspace has Angular >= 16.1.0 and Angular projects using Component Testing.",
|
|
67
|
+
"implementation": "./src/migrations/update-16-4-0/warn-incompatible-angular-cypress"
|
|
56
68
|
}
|
|
57
69
|
},
|
|
58
70
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "16.4.0-beta.
|
|
3
|
+
"version": "16.4.0-beta.14",
|
|
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,10 +34,10 @@
|
|
|
34
34
|
"migrations": "./migrations.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nrwl/cypress": "16.4.0-beta.
|
|
38
|
-
"@nx/devkit": "16.4.0-beta.
|
|
39
|
-
"@nx/js": "16.4.0-beta.
|
|
40
|
-
"@nx/linter": "16.4.0-beta.
|
|
37
|
+
"@nrwl/cypress": "16.4.0-beta.14",
|
|
38
|
+
"@nx/devkit": "16.4.0-beta.14",
|
|
39
|
+
"@nx/js": "16.4.0-beta.14",
|
|
40
|
+
"@nx/linter": "16.4.0-beta.14",
|
|
41
41
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
42
42
|
"detect-port": "^1.5.1",
|
|
43
43
|
"dotenv": "~10.0.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"types": "./index.d.ts",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "796c91c34b96d82306a62e90f9146ae8e68762b5"
|
|
59
59
|
}
|
|
@@ -13,7 +13,9 @@ export interface NxComponentTestingOptions {
|
|
|
13
13
|
ctTargetName?: string;
|
|
14
14
|
bundler?: 'vite' | 'webpack';
|
|
15
15
|
}
|
|
16
|
-
export declare function nxBaseCypressPreset(pathToConfig: string
|
|
16
|
+
export declare function nxBaseCypressPreset(pathToConfig: string, options?: {
|
|
17
|
+
testingType: 'component' | 'e2e';
|
|
18
|
+
}): BaseCypressPreset;
|
|
17
19
|
/**
|
|
18
20
|
* nx E2E Preset for Cypress
|
|
19
21
|
* @description
|
|
@@ -5,7 +5,10 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const preprocessor_vite_1 = require("../src/plugins/preprocessor-vite");
|
|
8
|
-
function nxBaseCypressPreset(pathToConfig) {
|
|
8
|
+
function nxBaseCypressPreset(pathToConfig, options) {
|
|
9
|
+
// used to set babel settings for react CT.
|
|
10
|
+
process.env.NX_CYPRESS_COMPONENT_TEST =
|
|
11
|
+
(options === null || options === void 0 ? void 0 : options.testingType) === 'component' ? 'true' : 'false';
|
|
9
12
|
// prevent from placing path outside the root of the workspace
|
|
10
13
|
// if they pass in a file or directory
|
|
11
14
|
const normalizedPath = (0, fs_1.lstatSync)(pathToConfig).isDirectory()
|
|
@@ -17,25 +17,20 @@ function cypressExecutor(options, context) {
|
|
|
17
17
|
process.env.NX_CYPRESS_TARGET_CONFIGURATION = context.configurationName;
|
|
18
18
|
let success;
|
|
19
19
|
try {
|
|
20
|
-
for (var _d = true, _e = tslib_1.__asyncValues(startDevServer(options, context)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
20
|
+
for (var _d = true, _e = tslib_1.__asyncValues(startDevServer(options, context)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
21
21
|
_c = _f.value;
|
|
22
22
|
_d = false;
|
|
23
|
+
const devServerValues = _c;
|
|
23
24
|
try {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (!options.watch)
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
devkit_1.logger.error(e.message);
|
|
32
|
-
success = false;
|
|
33
|
-
if (!options.watch)
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
25
|
+
success = yield runCypress(devServerValues.baseUrl, Object.assign(Object.assign({}, options), { portLockFilePath: devServerValues.portLockFilePath }));
|
|
26
|
+
if (!options.watch)
|
|
27
|
+
break;
|
|
36
28
|
}
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
catch (e) {
|
|
30
|
+
devkit_1.logger.error(e.message);
|
|
31
|
+
success = false;
|
|
32
|
+
if (!options.watch)
|
|
33
|
+
break;
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
36
|
}
|
|
@@ -53,11 +48,6 @@ exports.default = cypressExecutor;
|
|
|
53
48
|
function normalizeOptions(options, context) {
|
|
54
49
|
var _a, _b, _c;
|
|
55
50
|
options.env = options.env || {};
|
|
56
|
-
if (options.tsConfig) {
|
|
57
|
-
const tsConfigPath = (0, path_1.join)(context.root, options.tsConfig);
|
|
58
|
-
options.env.tsConfig = tsConfigPath;
|
|
59
|
-
process.env.TS_NODE_PROJECT = tsConfigPath;
|
|
60
|
-
}
|
|
61
51
|
if (options.testingType === 'component') {
|
|
62
52
|
const project = (_b = (_a = context === null || context === void 0 ? void 0 : context.projectGraph) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[context.projectName];
|
|
63
53
|
if ((_c = project === null || project === void 0 ? void 0 : project.data) === null || _c === void 0 ? void 0 : _c.root) {
|
|
@@ -142,27 +132,22 @@ If the port is in use, try using a different port value or passing --port='cypre
|
|
|
142
132
|
}
|
|
143
133
|
}
|
|
144
134
|
try {
|
|
145
|
-
for (var _g = true, _h = tslib_1.__asyncValues(yield tslib_1.__await((0, devkit_1.runExecutor)(parsedDevServerTarget, overrides, context))), _j; _j = yield tslib_1.__await(_h.next()), _d = _j.done, !_d;) {
|
|
135
|
+
for (var _g = true, _h = tslib_1.__asyncValues(yield tslib_1.__await((0, devkit_1.runExecutor)(parsedDevServerTarget, overrides, context))), _j; _j = yield tslib_1.__await(_h.next()), _d = _j.done, !_d; _g = true) {
|
|
146
136
|
_f = _j.value;
|
|
147
137
|
_g = false;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
output.baseUrl = `http://localhost:${output.info.port}`;
|
|
157
|
-
}
|
|
158
|
-
yield yield tslib_1.__await({
|
|
159
|
-
baseUrl: opts.baseUrl || output.baseUrl || ((_c = output.info) === null || _c === void 0 ? void 0 : _c.baseUrl),
|
|
160
|
-
portLockFilePath: overrides.port && (0, path_1.join)(__dirname, `${overrides.port}.txt`),
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
finally {
|
|
164
|
-
_g = true;
|
|
138
|
+
const output = _f;
|
|
139
|
+
if (!output.success && !opts.watch)
|
|
140
|
+
throw new Error('Could not compile application files');
|
|
141
|
+
if (!opts.baseUrl &&
|
|
142
|
+
!output.baseUrl &&
|
|
143
|
+
!((_a = output.info) === null || _a === void 0 ? void 0 : _a.baseUrl) &&
|
|
144
|
+
((_b = output.info) === null || _b === void 0 ? void 0 : _b.port)) {
|
|
145
|
+
output.baseUrl = `http://localhost:${output.info.port}`;
|
|
165
146
|
}
|
|
147
|
+
yield yield tslib_1.__await({
|
|
148
|
+
baseUrl: opts.baseUrl || output.baseUrl || ((_c = output.info) === null || _c === void 0 ? void 0 : _c.baseUrl),
|
|
149
|
+
portLockFilePath: overrides.port && (0, path_1.join)(__dirname, `${overrides.port}.txt`),
|
|
150
|
+
});
|
|
166
151
|
}
|
|
167
152
|
}
|
|
168
153
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"default": false
|
|
33
33
|
},
|
|
34
34
|
"tsConfig": {
|
|
35
|
+
"x-deprecated": "This option no longer has any effect. Cypress supports typescript out of the box. Add any options directly to <projectRoot>/tsconfig.json or <projectRoot>/cypress/tsconfig.json",
|
|
35
36
|
"type": "string",
|
|
36
37
|
"description": "The path of the Cypress tsconfig configuration json file.",
|
|
37
38
|
"x-completion-type": "file",
|
|
@@ -31,4 +31,9 @@ export declare function updatePluginFile(tree: Tree, projectConfig: ProjectConfi
|
|
|
31
31
|
}): {
|
|
32
32
|
cypressConfigTs: Record<string, any>;
|
|
33
33
|
cypressConfigJson: Record<string, any>;
|
|
34
|
+
} | {
|
|
35
|
+
cypressConfigTs: {
|
|
36
|
+
e2e: any;
|
|
37
|
+
};
|
|
38
|
+
cypressConfigJson: Record<string, any>;
|
|
34
39
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixLegacyCypressTsconfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
function fixLegacyCypressTsconfig(tree) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/cypress:cypress', (options, projectName, targetName, configName) => {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const projectConfig = projects.get(projectName);
|
|
14
|
+
if (options.testingType !== 'e2e' &&
|
|
15
|
+
((_b = (_a = projectConfig.targets[targetName]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.testingType) !== 'e2e') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const tsconfigToRemove = (_c = options.tsConfig) !== null && _c !== void 0 ? _c : (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.e2e.json');
|
|
19
|
+
const projectLevelConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
|
|
20
|
+
if (!tree.exists(projectLevelConfigPath) ||
|
|
21
|
+
!tree.exists(tsconfigToRemove)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (tsconfigToRemove === projectLevelConfigPath) {
|
|
25
|
+
(0, devkit_1.updateJson)(tree, projectLevelConfigPath, (json) => {
|
|
26
|
+
json.compilerOptions = Object.assign({ sourceMap: false }, json.compilerOptions);
|
|
27
|
+
return json;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const e2eConfig = (0, devkit_1.readJson)(tree, tsconfigToRemove);
|
|
32
|
+
(0, devkit_1.updateJson)(tree, projectLevelConfigPath, (json) => {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
34
|
+
json.compilerOptions = Object.assign(Object.assign({ sourceMap: false }, json.compilerOptions), e2eConfig.compilerOptions);
|
|
35
|
+
json.files = Array.from(new Set([...((_a = json.files) !== null && _a !== void 0 ? _a : []), ...((_b = e2eConfig.files) !== null && _b !== void 0 ? _b : [])]));
|
|
36
|
+
json.include = Array.from(new Set([...((_c = json.include) !== null && _c !== void 0 ? _c : []), ...((_d = e2eConfig.include) !== null && _d !== void 0 ? _d : [])]));
|
|
37
|
+
json.exclude = Array.from(new Set([...((_e = json.exclude) !== null && _e !== void 0 ? _e : []), ...((_f = e2eConfig.exclude) !== null && _f !== void 0 ? _f : [])]));
|
|
38
|
+
// these paths will always be 'unix style'
|
|
39
|
+
// and on windows relative will not work on these paths
|
|
40
|
+
const tsConfigFromProjRoot = path_1.posix.relative(projectConfig.root, tsconfigToRemove);
|
|
41
|
+
json.references = ((_g = json.references) !== null && _g !== void 0 ? _g : []).filter(({ path }) => !path.includes(tsConfigFromProjRoot));
|
|
42
|
+
return json;
|
|
43
|
+
});
|
|
44
|
+
tree.delete(tsconfigToRemove);
|
|
45
|
+
}
|
|
46
|
+
if (configName) {
|
|
47
|
+
delete projectConfig.targets[targetName].configurations[configName]
|
|
48
|
+
.tsConfig;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
delete projectConfig.targets[targetName].options.tsConfig;
|
|
52
|
+
}
|
|
53
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
54
|
+
});
|
|
55
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.fixLegacyCypressTsconfig = fixLegacyCypressTsconfig;
|
|
59
|
+
exports.default = fixLegacyCypressTsconfig;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
+
const package_json_1 = require("nx/src/utils/package-json");
|
|
7
|
+
const semver_1 = require("semver");
|
|
8
|
+
function default_1(tree) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const angularVersion = getInstalledAngularVersion();
|
|
11
|
+
if (!angularVersion || (0, semver_1.lt)(angularVersion, '16.1.0')) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const angularProjects = yield getAngularProjects();
|
|
15
|
+
if (!angularProjects.length) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let skipChecking = false;
|
|
19
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/cypress:cypress', (options, projectName) => {
|
|
20
|
+
if (skipChecking || !angularProjects.includes(projectName)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (options.testingType === 'component') {
|
|
24
|
+
skipChecking = true;
|
|
25
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Some of your Angular projects are setup for Cypress Component testing.
|
|
26
|
+
The current version of Cypress does not support component testing for Angular 16.1 so your tests may fail.
|
|
27
|
+
If your component tests fail, here are some recommended next steps:
|
|
28
|
+
|
|
29
|
+
- Revert these changes and update Nx without updating Angular ("nx migrate latest --interactive"). You can update Angular once the issue has been resolved
|
|
30
|
+
- Keep these changes but temporarily disable the component tests until this issue is resolved
|
|
31
|
+
|
|
32
|
+
Check https://github.com/nrwl/nx/issues/17720 for more details.
|
|
33
|
+
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.default = default_1;
|
|
40
|
+
function getAngularProjects() {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const projectGraph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
43
|
+
return Object.entries(projectGraph.dependencies)
|
|
44
|
+
.filter(([node, dep]) => dep.some(({ target }) => { var _a; return !((_a = projectGraph.externalNodes) === null || _a === void 0 ? void 0 : _a[node]) && target === 'npm:@angular/core'; }))
|
|
45
|
+
.map(([projectName]) => projectName);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function getInstalledAngularVersion() {
|
|
49
|
+
try {
|
|
50
|
+
const { packageJson: { version }, } = (0, package_json_1.readModulePackageJson)('@angular/core');
|
|
51
|
+
return version;
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|