@nx/cypress 16.4.0-beta.9 → 16.5.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/migrations.json +18 -0
- package/package.json +7 -7
- 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/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
package/migrations.json
CHANGED
|
@@ -53,6 +53,12 @@
|
|
|
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"
|
|
56
62
|
}
|
|
57
63
|
},
|
|
58
64
|
"packageJsonUpdates": {
|
|
@@ -67,6 +73,18 @@
|
|
|
67
73
|
"alwaysAddToPackageJson": false
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
},
|
|
77
|
+
"16.5.0": {
|
|
78
|
+
"version": "16.5.0-beta.0",
|
|
79
|
+
"requires": {
|
|
80
|
+
"cypress": ">=12.0.0 <12.16.0"
|
|
81
|
+
},
|
|
82
|
+
"packages": {
|
|
83
|
+
"cypress": {
|
|
84
|
+
"version": "^12.16.0",
|
|
85
|
+
"alwaysAddToPackageJson": false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
70
88
|
}
|
|
71
89
|
}
|
|
72
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.5.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
|
-
"@nrwl/cypress": "16.
|
|
38
|
-
"@nx/devkit": "16.
|
|
39
|
-
"@nx/js": "16.
|
|
40
|
-
"@nx/linter": "16.
|
|
37
|
+
"@nrwl/cypress": "16.5.0-beta.0",
|
|
38
|
+
"@nx/devkit": "16.5.0-beta.0",
|
|
39
|
+
"@nx/js": "16.5.0-beta.0",
|
|
40
|
+
"@nx/linter": "16.5.0-beta.0",
|
|
41
41
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
42
42
|
"detect-port": "^1.5.1",
|
|
43
43
|
"dotenv": "~10.0.0",
|
|
44
|
-
"semver": "7.3
|
|
44
|
+
"semver": "7.5.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cypress": ">= 3 < 13"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"types": "./index.d.ts",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "376d656cfc7f6390ff1cd6d9de348baf7bccbf33"
|
|
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;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const nxVersion: any;
|
|
|
2
2
|
export declare const eslintPluginCypressVersion = "^2.10.3";
|
|
3
3
|
export declare const typesNodeVersion = "16.11.7";
|
|
4
4
|
export declare const cypressViteDevServerVersion = "^2.2.1";
|
|
5
|
-
export declare const cypressVersion = "^12.
|
|
5
|
+
export declare const cypressVersion = "^12.16.0";
|
|
6
6
|
export declare const cypressWebpackVersion = "^2.0.0";
|
|
7
7
|
export declare const webpackHttpPluginVersion = "^5.5.0";
|
|
8
8
|
export declare const viteVersion = "^4.3.4";
|
package/src/utils/versions.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.nxVersion = require('../../package.json').version;
|
|
|
5
5
|
exports.eslintPluginCypressVersion = '^2.10.3';
|
|
6
6
|
exports.typesNodeVersion = '16.11.7';
|
|
7
7
|
exports.cypressViteDevServerVersion = '^2.2.1';
|
|
8
|
-
exports.cypressVersion = '^12.
|
|
8
|
+
exports.cypressVersion = '^12.16.0';
|
|
9
9
|
exports.cypressWebpackVersion = '^2.0.0';
|
|
10
10
|
exports.webpackHttpPluginVersion = '^5.5.0';
|
|
11
11
|
exports.viteVersion = '^4.3.4';
|