@nx/cypress 23.0.0-pr.35413.460eeef → 23.0.0-rc.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/{index.d.ts → dist/index.d.ts} +0 -1
- package/dist/internal.d.ts +5 -0
- package/dist/internal.js +12 -0
- package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
- package/{plugins → dist/plugins}/cypress-preset.d.ts +0 -1
- package/{plugins → dist/plugins}/cypress-preset.js +15 -5
- package/{src → dist/src}/executors/cypress/cypress.impl.d.ts +0 -1
- package/{src → dist/src}/executors/cypress/cypress.impl.js +2 -0
- package/{src → dist/src}/executors/cypress/schema.json +1 -0
- package/{src → dist/src}/generators/base-setup/base-setup.d.ts +0 -1
- package/{src → dist/src}/generators/base-setup/base-setup.js +5 -19
- package/dist/src/generators/base-setup/files/config-ts-cjs/cypress.config.ts__ext__ +3 -0
- package/dist/src/generators/base-setup/files/config-ts-esm/__directory__/support/commands.ts__ext__ +35 -0
- package/{src → dist/src}/generators/component-configuration/component-configuration.d.ts +0 -1
- package/{src → dist/src}/generators/component-configuration/component-configuration.js +25 -22
- package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
- package/{src → dist/src}/generators/configuration/configuration.js +12 -11
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +7 -6
- package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +24 -11
- package/{src → dist/src}/generators/init/schema.json +1 -1
- package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.d.ts +0 -1
- package/{src → dist/src}/generators/migrate-to-cypress-11/conversion.util.js +5 -6
- package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +0 -1
- package/{src → dist/src}/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +3 -3
- package/{src/migrations/update-20-8-0/set-inject-document-domain.d.ts → dist/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts} +0 -1
- package/{src → dist/src}/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.js +29 -17
- package/dist/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.md +103 -0
- package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts +0 -1
- package/{src → dist/src}/migrations/update-22-1-0/rename-cy-exec-code-property.js +4 -4
- package/dist/src/migrations/update-22-1-0/rename-cy-exec-code-property.md +19 -0
- package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.d.ts +0 -1
- package/{src → dist/src}/migrations/update-22-1-0/update-angular-component-testing-support.js +4 -4
- package/dist/src/migrations/update-22-1-0/update-angular-component-testing-support.md +19 -0
- package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.d.ts +0 -1
- package/{src → dist/src}/migrations/update-22-1-0/update-selector-playground-api.js +3 -3
- package/dist/src/migrations/update-22-1-0/update-selector-playground-api.md +24 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +223 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
- package/dist/src/migrations/update-23-0-0/remove-experimental-prompt-command.d.ts +2 -0
- package/dist/src/migrations/update-23-0-0/remove-experimental-prompt-command.js +47 -0
- package/dist/src/migrations/update-23-0-0/remove-experimental-prompt-command.md +55 -0
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
- package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +199 -0
- package/dist/src/plugins/plugin.d.ts +10 -0
- package/{src → dist/src}/plugins/plugin.js +88 -40
- package/{src → dist/src}/plugins/preprocessor-vite.d.ts +0 -1
- package/{src → dist/src}/utils/add-linter.d.ts +0 -1
- package/{src → dist/src}/utils/add-linter.js +16 -18
- package/dist/src/utils/assert-supported-cypress-version.d.ts +2 -0
- package/dist/src/utils/assert-supported-cypress-version.js +8 -0
- package/{src → dist/src}/utils/config.d.ts +10 -5
- package/{src → dist/src}/utils/config.js +52 -48
- package/{src → dist/src}/utils/constants.d.ts +0 -1
- package/{src → dist/src}/utils/ct-helpers.d.ts +0 -1
- package/dist/src/utils/deprecation.d.ts +3 -0
- package/dist/src/utils/deprecation.js +20 -0
- package/{src → dist/src}/utils/find-target-options.d.ts +0 -1
- package/{src → dist/src}/utils/migrations.d.ts +0 -1
- package/{src → dist/src}/utils/migrations.js +4 -4
- package/{src → dist/src}/utils/project-name.d.ts +0 -1
- package/{src → dist/src}/utils/start-dev-server.d.ts +0 -1
- package/{src → dist/src}/utils/versions.d.ts +5 -5
- package/{src → dist/src}/utils/versions.js +14 -51
- package/executors.json +2 -2
- package/generators.json +10 -10
- package/migrations.json +52 -61
- package/package.json +60 -13
- package/index.d.ts.map +0 -1
- package/plugin.d.ts.map +0 -1
- package/plugins/cypress-preset.d.ts.map +0 -1
- package/src/executors/cypress/cypress.impl.d.ts.map +0 -1
- package/src/generators/base-setup/base-setup.d.ts.map +0 -1
- package/src/generators/component-configuration/component-configuration.d.ts.map +0 -1
- package/src/generators/configuration/configuration.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/target-options-map.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/generators/migrate-to-cypress-11/conversion.util.d.ts.map +0 -1
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts.map +0 -1
- package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts +0 -3
- package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.d.ts.map +0 -1
- package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.js +0 -48
- package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts +0 -3
- package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.d.ts.map +0 -1
- package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.js +0 -94
- package/src/migrations/update-20-8-0/set-inject-document-domain.d.ts.map +0 -1
- package/src/migrations/update-20-8-0/set-inject-document-domain.js +0 -128
- package/src/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts +0 -3
- package/src/migrations/update-20-8-0/update-component-testing-mount-imports.d.ts.map +0 -1
- package/src/migrations/update-20-8-0/update-component-testing-mount-imports.js +0 -151
- package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts +0 -3
- package/src/migrations/update-21-0-0/remove-tsconfig-and-copy-files-options-from-cypress-executor.d.ts.map +0 -1
- package/src/migrations/update-22-1-0/rename-cy-exec-code-property.d.ts.map +0 -1
- package/src/migrations/update-22-1-0/update-angular-component-testing-support.d.ts.map +0 -1
- package/src/migrations/update-22-1-0/update-selector-playground-api.d.ts.map +0 -1
- package/src/plugins/plugin.d.ts +0 -11
- package/src/plugins/plugin.d.ts.map +0 -1
- package/src/plugins/preprocessor-vite.d.ts.map +0 -1
- package/src/utils/add-linter.d.ts.map +0 -1
- package/src/utils/config.d.ts.map +0 -1
- package/src/utils/constants.d.ts.map +0 -1
- package/src/utils/ct-helpers.d.ts.map +0 -1
- package/src/utils/cypress-version.d.ts +0 -12
- package/src/utils/cypress-version.d.ts.map +0 -1
- package/src/utils/cypress-version.js +0 -38
- package/src/utils/find-target-options.d.ts.map +0 -1
- package/src/utils/migrations.d.ts.map +0 -1
- package/src/utils/project-name.d.ts.map +0 -1
- package/src/utils/start-dev-server.d.ts.map +0 -1
- package/src/utils/versions.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{PLUGIN.md → dist/PLUGIN.md} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{plugin.js → dist/plugin.js} +0 -0
- /package/{src → dist/src}/generators/base-setup/files/common/__directory__/fixtures/example.json +0 -0
- /package/{src → dist/src}/generators/base-setup/files/common/__directory__/support/commands.ts__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/__directory__/support/commands.js__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/config-js-cjs/cypress.config.js__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/config-js-esm/__directory__/support/commands.js__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/config-js-esm/cypress.config.js__ext__ +0 -0
- /package/{src/generators/base-setup/files/config-ts → dist/src/generators/base-setup/files/config-ts-cjs}/__directory__/support/commands.ts__ext__ +0 -0
- /package/{src/generators/base-setup/files/config-ts → dist/src/generators/base-setup/files/config-ts-esm}/cypress.config.ts__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/tsconfig/non-ts-solution/__directory__/tsconfig.json__ext__ +0 -0
- /package/{src → dist/src}/generators/base-setup/files/tsconfig/ts-solution/__directory__/tsconfig.json__ext__ +0 -0
- /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component-index.html +0 -0
- /package/{src → dist/src}/generators/component-configuration/files/__directory__/support/component.ts__ext__ +0 -0
- /package/{src → dist/src}/generators/component-configuration/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/component-configuration/schema.json +0 -0
- /package/{src → dist/src}/generators/configuration/files/__directory__/e2e/app.cy.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/configuration/files/__directory__/support/app.po.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/configuration/files/__directory__/support/e2e.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/configuration/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/add-exclude-spec-pattern.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/target-options-map.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/upsert-baseUrl.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/migrate-to-cypress-11/schema.json +0 -0
- /package/{src → dist/src}/plugins/preprocessor-vite.js +0 -0
- /package/{src → dist/src}/utils/constants.js +0 -0
- /package/{src → dist/src}/utils/ct-helpers.js +0 -0
- /package/{src → dist/src}/utils/find-target-options.js +0 -0
- /package/{src → dist/src}/utils/project-name.js +0 -0
- /package/{src → dist/src}/utils/start-dev-server.js +0 -0
|
@@ -2,4 +2,3 @@ export { configurationGenerator } from './src/generators/configuration/configura
|
|
|
2
2
|
export { componentConfigurationGenerator } from './src/generators/component-configuration/component-configuration';
|
|
3
3
|
export { cypressInitGenerator } from './src/generators/init/init';
|
|
4
4
|
export { migrateCypressProject } from './src/generators/migrate-to-cypress-11/migrate-to-cypress-11';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Semi-private surface for first-party Nx packages.
|
|
3
|
+
//
|
|
4
|
+
// External plugins should NOT import from here — this entry is curated for
|
|
5
|
+
// internal consumers and may change without semver protection. Mirrors
|
|
6
|
+
// `@nx/devkit/internal`.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
tslib_1.__exportStar(require("./src/utils/versions"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./src/utils/ct-helpers"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./src/utils/find-target-options"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./src/utils/config"), exports);
|
|
@@ -4,12 +4,13 @@ exports.nxBaseCypressPreset = nxBaseCypressPreset;
|
|
|
4
4
|
exports.nxE2EPreset = nxE2EPreset;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
8
|
const child_process_1 = require("child_process");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const http_1 = require("http");
|
|
11
11
|
const https_1 = require("https");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
+
const url_1 = require("url");
|
|
13
14
|
const preprocessor_vite_1 = tslib_1.__importDefault(require("../src/plugins/preprocessor-vite"));
|
|
14
15
|
const constants_1 = require("../src/utils/constants");
|
|
15
16
|
const treeKill = require('tree-kill');
|
|
@@ -17,14 +18,23 @@ function nxBaseCypressPreset(pathToConfig, options) {
|
|
|
17
18
|
// used to set babel settings for react CT.
|
|
18
19
|
process.env.NX_CYPRESS_COMPONENT_TEST =
|
|
19
20
|
options?.testingType === 'component' ? 'true' : 'false';
|
|
21
|
+
// ESM-shape configs pass `import.meta.url` (a `file://...` URL string) so
|
|
22
|
+
// the same expression works under both Node's native TS strip (ESM,
|
|
23
|
+
// import.meta.url defined) and Cypress's bundled tsx CJS loader, which
|
|
24
|
+
// exposes `import.meta.url` but not `import.meta.dirname`. CJS-shape
|
|
25
|
+
// configs still pass `__filename` directly. Normalize either form to a
|
|
26
|
+
// filesystem path before stat-checking.
|
|
27
|
+
const resolvedPath = pathToConfig?.startsWith('file://')
|
|
28
|
+
? (0, url_1.fileURLToPath)(pathToConfig)
|
|
29
|
+
: pathToConfig;
|
|
20
30
|
// prevent from placing path outside the root of the workspace
|
|
21
31
|
// if they pass in a file or directory
|
|
22
|
-
const normalizedPath = (0, fs_1.lstatSync)(
|
|
23
|
-
?
|
|
24
|
-
: (0, path_1.dirname)(
|
|
32
|
+
const normalizedPath = (0, fs_1.lstatSync)(resolvedPath).isDirectory()
|
|
33
|
+
? resolvedPath
|
|
34
|
+
: (0, path_1.dirname)(resolvedPath);
|
|
25
35
|
const projectPath = (0, path_1.relative)(devkit_1.workspaceRoot, normalizedPath);
|
|
26
36
|
const offset = (0, path_1.relative)(normalizedPath, devkit_1.workspaceRoot);
|
|
27
|
-
const isTsSolutionSetup = (0,
|
|
37
|
+
const isTsSolutionSetup = (0, internal_1.isUsingTsSolutionSetup)();
|
|
28
38
|
const videosFolder = isTsSolutionSetup
|
|
29
39
|
? (0, path_1.join)('test-output', 'cypress', 'videos')
|
|
30
40
|
: (0, path_1.join)(offset, 'dist', 'cypress', projectPath, 'videos');
|
|
@@ -5,9 +5,11 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const ct_helpers_1 = require("../../utils/ct-helpers");
|
|
8
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
8
9
|
const start_dev_server_1 = require("../../utils/start-dev-server");
|
|
9
10
|
const Cypress = require('cypress'); // @NOTE: Importing via ES6 messes the whole test dependencies.
|
|
10
11
|
async function cypressExecutor(options, context) {
|
|
12
|
+
(0, deprecation_1.warnCypressExecutorDeprecation)();
|
|
11
13
|
options = normalizeOptions(options, context);
|
|
12
14
|
// this is used by cypress component testing presets to build the executor contexts with the correct configuration options.
|
|
13
15
|
process.env.NX_CYPRESS_TARGET_CONFIGURATION = context.configurationName;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"type": "object",
|
|
6
6
|
"outputCapture": "pipe",
|
|
7
7
|
"cli": "nx",
|
|
8
|
+
"x-deprecated": "The `@nx/cypress:cypress` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/cypress:convert-to-inferred` to migrate to the `@nx/cypress/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
8
9
|
"presets": [
|
|
9
10
|
{
|
|
10
11
|
"name": "Starting Dev Server",
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addBaseCypressSetup = addBaseCypressSetup;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/js/internal");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
function addBaseCypressSetup(tree, options) {
|
|
9
9
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -12,7 +12,7 @@ function addBaseCypressSetup(tree, options) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const opts = normalizeOptions(tree, projectConfig, options);
|
|
15
|
-
const isUsingTsSolutionConfig = (0,
|
|
15
|
+
const isUsingTsSolutionConfig = (0, internal_1.isUsingTsSolutionSetup)(tree);
|
|
16
16
|
const templateVars = {
|
|
17
17
|
...opts,
|
|
18
18
|
jsx: !!opts.jsx,
|
|
@@ -35,16 +35,12 @@ function addBaseCypressSetup(tree, options) {
|
|
|
35
35
|
(0, devkit_1.generateFiles)(tree, isUsingTsSolutionConfig
|
|
36
36
|
? (0, path_1.join)(__dirname, 'files/tsconfig/ts-solution')
|
|
37
37
|
: (0, path_1.join)(__dirname, 'files/tsconfig/non-ts-solution'), projectConfig.root, templateVars);
|
|
38
|
+
const isEsm = (0, internal_1.isEsmProject)(tree, projectConfig.root);
|
|
38
39
|
if (options.js) {
|
|
39
|
-
|
|
40
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files/config-js-esm'), projectConfig.root, templateVars);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files/config-js-cjs'), projectConfig.root, templateVars);
|
|
44
|
-
}
|
|
40
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, isEsm ? 'files/config-js-esm' : 'files/config-js-cjs'), projectConfig.root, templateVars);
|
|
45
41
|
}
|
|
46
42
|
else {
|
|
47
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files/config-ts'), projectConfig.root, templateVars);
|
|
43
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, isEsm ? 'files/config-ts-esm' : 'files/config-ts-cjs'), projectConfig.root, templateVars);
|
|
48
44
|
}
|
|
49
45
|
if (opts.hasTsConfig) {
|
|
50
46
|
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json'), (json) => {
|
|
@@ -80,16 +76,6 @@ function normalizeOptions(tree, projectConfig, options) {
|
|
|
80
76
|
hasTsConfig,
|
|
81
77
|
};
|
|
82
78
|
}
|
|
83
|
-
function isEsmProject(tree, projectRoot) {
|
|
84
|
-
let packageJson;
|
|
85
|
-
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'package.json'))) {
|
|
86
|
-
packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
90
|
-
}
|
|
91
|
-
return packageJson.type === 'module';
|
|
92
|
-
}
|
|
93
79
|
function isEslintInstalled(tree) {
|
|
94
80
|
const { dependencies, devDependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
95
81
|
return !!(dependencies?.eslint || devDependencies?.eslint);
|
package/dist/src/generators/base-setup/files/config-ts-esm/__directory__/support/commands.ts__ext__
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
// ***********************************************
|
|
4
|
+
// This example commands.ts shows you how to
|
|
5
|
+
// create various custom commands and overwrite
|
|
6
|
+
// existing commands.
|
|
7
|
+
//
|
|
8
|
+
// For more comprehensive examples of custom
|
|
9
|
+
// commands please read more here:
|
|
10
|
+
// https://on.cypress.io/custom-commands
|
|
11
|
+
// ***********************************************
|
|
12
|
+
<% if (linter === 'eslint') { %>
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace<% } %>
|
|
14
|
+
declare namespace Cypress {<% if (linter === 'eslint') { %>
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars<% } %>
|
|
16
|
+
interface Chainable<Subject> {
|
|
17
|
+
login(email: string, password: string): void;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// -- This is a parent command --
|
|
22
|
+
Cypress.Commands.add('login', (email, password) => {
|
|
23
|
+
console.log('Custom command example: Login', email, password);
|
|
24
|
+
});
|
|
25
|
+
//
|
|
26
|
+
// -- This is a child command --
|
|
27
|
+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
|
28
|
+
//
|
|
29
|
+
//
|
|
30
|
+
// -- This is a dual command --
|
|
31
|
+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
32
|
+
//
|
|
33
|
+
//
|
|
34
|
+
// -- This will overwrite an existing command --
|
|
35
|
+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
|
@@ -4,4 +4,3 @@ export declare function componentConfigurationGenerator(tree: Tree, options: Cyp
|
|
|
4
4
|
export declare function componentConfigurationGeneratorInternal(tree: Tree, options: CypressComponentConfigurationSchema): Promise<GeneratorCallback>;
|
|
5
5
|
export declare function updateTsConfigForComponentTesting(tree: Tree, projectConfig: ProjectConfiguration): void;
|
|
6
6
|
export default componentConfigurationGenerator;
|
|
7
|
-
//# sourceMappingURL=component-configuration.d.ts.map
|
|
@@ -5,8 +5,10 @@ exports.componentConfigurationGeneratorInternal = componentConfigurationGenerato
|
|
|
5
5
|
exports.updateTsConfigForComponentTesting = updateTsConfigForComponentTesting;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
9
|
+
const internal_2 = require("@nx/js/internal");
|
|
10
|
+
const assert_supported_cypress_version_1 = require("../../utils/assert-supported-cypress-version");
|
|
11
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
10
12
|
const versions_1 = require("../../utils/versions");
|
|
11
13
|
const base_setup_1 = require("../base-setup/base-setup");
|
|
12
14
|
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
@@ -17,18 +19,8 @@ function componentConfigurationGenerator(tree, options) {
|
|
|
17
19
|
});
|
|
18
20
|
}
|
|
19
21
|
async function componentConfigurationGeneratorInternal(tree, options) {
|
|
20
|
-
(0,
|
|
21
|
-
|
|
22
|
-
// peer dep is ^5.0.0 || ^6.0.0 || ^7.0.0).
|
|
23
|
-
const viteVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vite');
|
|
24
|
-
if (viteVersion) {
|
|
25
|
-
const viteMajor = (0, semver_1.major)((0, semver_1.coerce)(viteVersion));
|
|
26
|
-
if (viteMajor >= 8) {
|
|
27
|
-
throw new Error(`Cypress component testing does not yet support Vite ${viteMajor}. ` +
|
|
28
|
-
`Downgrade to Vite 7 or earlier to use Cypress component testing. ` +
|
|
29
|
-
`See: https://github.com/cypress-io/cypress/issues/33078`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
22
|
+
(0, assert_supported_cypress_version_1.assertSupportedCypressVersion)(tree);
|
|
23
|
+
(0, internal_2.assertNotUsingTsSolutionSetup)(tree, 'cypress', 'component-configuration');
|
|
32
24
|
const tasks = [];
|
|
33
25
|
const opts = normalizeOptions(tree, options);
|
|
34
26
|
if (!(0, versions_1.getInstalledCypressMajorVersion)(tree)) {
|
|
@@ -47,6 +39,7 @@ async function componentConfigurationGeneratorInternal(tree, options) {
|
|
|
47
39
|
}
|
|
48
40
|
addProjectFiles(tree, projectConfig, opts);
|
|
49
41
|
if (!hasPlugin || opts.addExplicitTargets) {
|
|
42
|
+
(0, deprecation_1.warnCypressExecutorGenerating)();
|
|
50
43
|
addTargetToProject(tree, projectConfig, opts);
|
|
51
44
|
}
|
|
52
45
|
updateNxJsonConfiguration(tree, hasPlugin);
|
|
@@ -123,14 +116,24 @@ function updateNxJsonConfiguration(tree, hasPlugin) {
|
|
|
123
116
|
!cacheableOperations.includes('component-test')) {
|
|
124
117
|
cacheableOperations.push('component-test');
|
|
125
118
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
nxJson.targetDefaults
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
// Either a `target: 'component-test'` default or a default keyed on
|
|
120
|
+
// the executor we're scaffolding will apply to the new target — pick
|
|
121
|
+
// the more specific (target-keyed) when both are present.
|
|
122
|
+
const existingForTarget = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
|
|
123
|
+
target: 'component-test',
|
|
124
|
+
});
|
|
125
|
+
const existingForExecutor = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
|
|
126
|
+
executor: '@nx/cypress:cypress',
|
|
127
|
+
});
|
|
128
|
+
const existing = existingForTarget ?? existingForExecutor;
|
|
129
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
130
|
+
target: 'component-test',
|
|
131
|
+
cache: existing?.cache ?? true,
|
|
132
|
+
inputs: existing?.inputs ?? [
|
|
133
|
+
'default',
|
|
134
|
+
productionFileSet ? '^production' : '^default',
|
|
135
|
+
],
|
|
136
|
+
});
|
|
134
137
|
}
|
|
135
138
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
136
139
|
}
|
|
@@ -22,4 +22,3 @@ export interface CypressE2EConfigSchema {
|
|
|
22
22
|
export declare function configurationGenerator(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
|
|
23
23
|
export declare function configurationGeneratorInternal(tree: Tree, options: CypressE2EConfigSchema): Promise<GeneratorCallback>;
|
|
24
24
|
export default configurationGenerator;
|
|
25
|
-
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.configurationGenerator = configurationGenerator;
|
|
4
4
|
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
|
-
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
|
-
const
|
|
11
|
-
const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
|
|
12
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
|
+
const internal_2 = require("@nx/js/internal");
|
|
13
10
|
const path_1 = require("path");
|
|
14
11
|
const add_linter_1 = require("../../utils/add-linter");
|
|
12
|
+
const assert_supported_cypress_version_1 = require("../../utils/assert-supported-cypress-version");
|
|
15
13
|
const config_1 = require("../../utils/config");
|
|
14
|
+
const deprecation_1 = require("../../utils/deprecation");
|
|
16
15
|
const versions_1 = require("../../utils/versions");
|
|
17
16
|
const base_setup_1 = require("../base-setup/base-setup");
|
|
18
17
|
const init_1 = tslib_1.__importStar(require("../init/init"));
|
|
@@ -23,6 +22,7 @@ function configurationGenerator(tree, options) {
|
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
24
|
async function configurationGeneratorInternal(tree, options) {
|
|
25
|
+
(0, assert_supported_cypress_version_1.assertSupportedCypressVersion)(tree);
|
|
26
26
|
const opts = await normalizeOptions(tree, options);
|
|
27
27
|
const tasks = [];
|
|
28
28
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
@@ -42,6 +42,7 @@ async function configurationGeneratorInternal(tree, options) {
|
|
|
42
42
|
: p.plugin === '@nx/cypress/plugin');
|
|
43
43
|
await addFiles(tree, opts, projectGraph, hasPlugin);
|
|
44
44
|
if (!hasPlugin) {
|
|
45
|
+
(0, deprecation_1.warnCypressExecutorGenerating)();
|
|
45
46
|
addTarget(tree, opts, projectGraph);
|
|
46
47
|
}
|
|
47
48
|
const projectTsConfigPath = (0, devkit_1.joinPathFragments)(opts.projectRoot, 'tsconfig.json');
|
|
@@ -59,7 +60,7 @@ async function configurationGeneratorInternal(tree, options) {
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
const { root: projectRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
62
|
-
const isTsSolutionSetup = (0,
|
|
63
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
63
64
|
if (isTsSolutionSetup) {
|
|
64
65
|
createPackageJson(tree, opts);
|
|
65
66
|
ignoreTestOutput(tree);
|
|
@@ -84,9 +85,9 @@ async function configurationGeneratorInternal(tree, options) {
|
|
|
84
85
|
await (0, devkit_1.formatFiles)(tree);
|
|
85
86
|
}
|
|
86
87
|
if (isTsSolutionSetup) {
|
|
87
|
-
const projectPackageManagerWorkspaceState = (0,
|
|
88
|
+
const projectPackageManagerWorkspaceState = (0, internal_2.getProjectPackageManagerWorkspaceState)(tree, projectRoot);
|
|
88
89
|
if (projectPackageManagerWorkspaceState !== 'included') {
|
|
89
|
-
tasks.push((0,
|
|
90
|
+
tasks.push((0, internal_2.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, tree.root));
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
@@ -102,7 +103,7 @@ function ensureDependencies(tree, options) {
|
|
|
102
103
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true);
|
|
103
104
|
}
|
|
104
105
|
async function normalizeOptions(tree, options) {
|
|
105
|
-
const linter = await (0,
|
|
106
|
+
const linter = await (0, internal_2.normalizeLinterOption)(tree, options.linter);
|
|
106
107
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
107
108
|
if (projectConfig?.targets?.e2e) {
|
|
108
109
|
throw new Error(`Project ${options.project} already has an e2e target.
|
|
@@ -141,7 +142,7 @@ In this case you need to provide a devServerTarget,'<projectName>:<targetName>[:
|
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
144
|
async function promptForMissingServeData(projectName) {
|
|
144
|
-
const { devServerTarget, port } = await (0,
|
|
145
|
+
const { devServerTarget, port } = await (0, internal_1.promptWhenInteractive)([
|
|
145
146
|
{
|
|
146
147
|
type: 'input',
|
|
147
148
|
name: 'devServerTarget',
|
|
@@ -273,7 +274,7 @@ function createPackageJson(tree, options) {
|
|
|
273
274
|
if (tree.exists(packageJsonPath)) {
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
276
|
-
const importPath = (0,
|
|
277
|
+
const importPath = (0, internal_1.resolveImportPath)(tree, projectConfig.name, projectConfig.root);
|
|
277
278
|
const packageJson = {
|
|
278
279
|
name: importPath,
|
|
279
280
|
version: '0.0.1',
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToInferred = convertToInferred;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
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");
|
|
7
6
|
const plugin_1 = require("../../plugins/plugin");
|
|
7
|
+
const assert_supported_cypress_version_1 = require("../../utils/assert-supported-cypress-version");
|
|
8
8
|
const add_dev_server_target_to_config_1 = require("./lib/add-dev-server-target-to-config");
|
|
9
9
|
const add_exclude_spec_pattern_1 = require("./lib/add-exclude-spec-pattern");
|
|
10
10
|
const target_options_map_1 = require("./lib/target-options-map");
|
|
11
11
|
const upsert_baseUrl_1 = require("./lib/upsert-baseUrl");
|
|
12
12
|
async function convertToInferred(tree, options) {
|
|
13
|
+
(0, assert_supported_cypress_version_1.assertSupportedCypressVersion)(tree);
|
|
13
14
|
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
14
|
-
const migratedProjects = await (0,
|
|
15
|
+
const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/cypress/plugin', plugin_1.createNodesV2, {
|
|
15
16
|
targetName: 'cypress',
|
|
16
17
|
ciTargetName: 'e2e-ci',
|
|
17
18
|
componentTestingTargetName: 'component-test',
|
|
@@ -24,7 +25,7 @@ async function convertToInferred(tree, options) {
|
|
|
24
25
|
},
|
|
25
26
|
], options.project);
|
|
26
27
|
if (migratedProjects.size === 0) {
|
|
27
|
-
throw new
|
|
28
|
+
throw new internal_1.NoTargetsToMigrateError();
|
|
28
29
|
}
|
|
29
30
|
if (!options.skipFormat) {
|
|
30
31
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -54,7 +55,7 @@ function postTargetTransformer(target, tree, projectDetails, inferredTargetConfi
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
if (target.outputs) {
|
|
57
|
-
(0,
|
|
58
|
+
(0, internal_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
|
|
58
59
|
projectName: projectDetails.projectName,
|
|
59
60
|
projectRoot: projectDetails.root,
|
|
60
61
|
});
|
|
@@ -65,7 +66,7 @@ function handlePropertiesInOptions(tree, options, projectRoot, target) {
|
|
|
65
66
|
let configFilePath;
|
|
66
67
|
if ('cypressConfig' in options) {
|
|
67
68
|
configFilePath = options.cypressConfig;
|
|
68
|
-
options['config-file'] = (0,
|
|
69
|
+
options['config-file'] = (0, internal_1.toProjectRelativePath)(configFilePath, projectRoot);
|
|
69
70
|
delete options.cypressConfig;
|
|
70
71
|
}
|
|
71
72
|
if ('copyFiles' in options) {
|
package/{src → dist/src}/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts
RENAMED
|
@@ -10,4 +10,3 @@ import type { Tree } from '@nx/devkit';
|
|
|
10
10
|
* b. Replace the existing webServerCommands with the value passed in
|
|
11
11
|
*/
|
|
12
12
|
export declare function addDevServerTargetToConfig(tree: Tree, configFilePath: string, webServerCommands: Record<string, string>, ciDevServerTarget?: string): void;
|
|
13
|
-
//# sourceMappingURL=add-dev-server-target-to-config.d.ts.map
|
|
@@ -4,4 +4,3 @@ export declare function addPlugin(tree: Tree, graph: ProjectGraph, updatePackage
|
|
|
4
4
|
export declare function cypressInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
5
5
|
export declare function cypressInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
6
6
|
export default cypressInitGenerator;
|
|
7
|
-
//# sourceMappingURL=init.d.ts.map
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addPlugin = addPlugin;
|
|
4
4
|
exports.cypressInitGenerator = cypressInitGenerator;
|
|
5
5
|
exports.cypressInitGeneratorInternal = cypressInitGeneratorInternal;
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
8
|
const plugin_1 = require("../../plugins/plugin");
|
|
9
|
+
const assert_supported_cypress_version_1 = require("../../utils/assert-supported-cypress-version");
|
|
9
10
|
const versions_1 = require("../../utils/versions");
|
|
10
11
|
function setupE2ETargetDefaults(tree) {
|
|
11
12
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -13,15 +14,26 @@ function setupE2ETargetDefaults(tree) {
|
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
16
|
// E2e targets depend on all their project's sources + production sources of dependencies
|
|
16
|
-
nxJson.targetDefaults ??= {};
|
|
17
17
|
const productionFileSet = !!nxJson.namedInputs?.production;
|
|
18
|
-
nxJson.targetDefaults
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const existing = findExistingE2eDefault(nxJson.targetDefaults);
|
|
19
|
+
const patch = {};
|
|
20
|
+
if (existing?.cache === undefined)
|
|
21
|
+
patch.cache = true;
|
|
22
|
+
if (existing?.inputs === undefined) {
|
|
23
|
+
patch.inputs = ['default', productionFileSet ? '^production' : '^default'];
|
|
24
|
+
}
|
|
25
|
+
if (Object.keys(patch).length > 0) {
|
|
26
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, { target: 'e2e', ...patch });
|
|
27
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function findExistingE2eDefault(td) {
|
|
31
|
+
if (!td)
|
|
32
|
+
return undefined;
|
|
33
|
+
if (Array.isArray(td)) {
|
|
34
|
+
return td.find((e) => e.target === 'e2e' && e.projects === undefined && e.plugin === undefined);
|
|
35
|
+
}
|
|
36
|
+
return td['e2e'];
|
|
25
37
|
}
|
|
26
38
|
function updateDependencies(tree, options) {
|
|
27
39
|
const tasks = [];
|
|
@@ -32,11 +44,11 @@ function updateDependencies(tree, options) {
|
|
|
32
44
|
if (!(0, versions_1.getInstalledCypressVersion)(tree)) {
|
|
33
45
|
devDependencies.cypress = versions_1.cypressVersion;
|
|
34
46
|
}
|
|
35
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, options.keepExistingVersions));
|
|
47
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, options.keepExistingVersions ?? true));
|
|
36
48
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
37
49
|
}
|
|
38
50
|
function addPlugin(tree, graph, updatePackageScripts) {
|
|
39
|
-
return (0,
|
|
51
|
+
return (0, internal_1.addPlugin)(tree, graph, '@nx/cypress/plugin', plugin_1.createNodesV2, {
|
|
40
52
|
targetName: ['e2e', 'cypress:e2e', 'cypress-e2e'],
|
|
41
53
|
openTargetName: ['open-cypress', 'cypress-open'],
|
|
42
54
|
componentTestingTargetName: [
|
|
@@ -64,6 +76,7 @@ async function cypressInitGenerator(tree, options) {
|
|
|
64
76
|
return cypressInitGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
65
77
|
}
|
|
66
78
|
async function cypressInitGeneratorInternal(tree, options) {
|
|
79
|
+
(0, assert_supported_cypress_version_1.assertSupportedCypressVersion)(tree);
|
|
67
80
|
updateProductionFileset(tree);
|
|
68
81
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
69
82
|
options.addPlugin ??=
|
|
@@ -9,8 +9,7 @@ exports.writeNewConfig = writeNewConfig;
|
|
|
9
9
|
exports.addConfigToTsConfig = addConfigToTsConfig;
|
|
10
10
|
exports.updatePluginFile = updatePluginFile;
|
|
11
11
|
const devkit_1 = require("@nx/devkit");
|
|
12
|
-
const
|
|
13
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
12
|
+
const internal_1 = require("@nx/js/internal");
|
|
14
13
|
const path_1 = require("path");
|
|
15
14
|
let tsModule;
|
|
16
15
|
let tsquery;
|
|
@@ -51,7 +50,7 @@ function createNewCypressConfig(tree, projectConfig, cypressConfigPathJson) {
|
|
|
51
50
|
const { modifyObstructiveCode = null, // no longer needed in configs
|
|
52
51
|
integrationFolder = 'src/e2e', // provide the new defaults if the value isn't present
|
|
53
52
|
supportFile = 'src/support/e2e.ts', ...restOfConfig } = cypressConfigJson;
|
|
54
|
-
const sourceRoot = (0,
|
|
53
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectConfig, tree);
|
|
55
54
|
const newIntegrationFolder = tree.exists((0, devkit_1.joinPathFragments)(sourceRoot, 'integration'))
|
|
56
55
|
? 'src/e2e'
|
|
57
56
|
: integrationFolder;
|
|
@@ -99,7 +98,7 @@ function createSupportFileImport(oldSupportFilePath, newSupportFilePath, project
|
|
|
99
98
|
}
|
|
100
99
|
function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfigJson, }) {
|
|
101
100
|
const { integrationFolder, supportFile } = cypressConfigTs['e2e'];
|
|
102
|
-
const sourceRoot = (0,
|
|
101
|
+
const sourceRoot = (0, internal_1.getProjectSourceRoot)(projectConfig, tree);
|
|
103
102
|
const oldIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, cypressConfigJson.integrationFolder);
|
|
104
103
|
const newIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, integrationFolder);
|
|
105
104
|
let newSupportFile;
|
|
@@ -165,10 +164,10 @@ function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfi
|
|
|
165
164
|
}
|
|
166
165
|
function updateImports(tree, filePath, oldImportPath, newImportPath) {
|
|
167
166
|
if (!tsModule) {
|
|
168
|
-
tsModule = (0,
|
|
167
|
+
tsModule = (0, internal_1.ensureTypescript)();
|
|
169
168
|
}
|
|
170
169
|
if (!tsquery) {
|
|
171
|
-
(0,
|
|
170
|
+
(0, internal_1.ensureTypescript)();
|
|
172
171
|
tsquery = require('@phenomnomnominal/tsquery').tsquery;
|
|
173
172
|
}
|
|
174
173
|
const { isCallExpression, isExportDeclaration, isImportDeclaration } = tsModule;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateCypressProject = migrateCypressProject;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
7
7
|
const conversion_util_1 = require("./conversion.util");
|
|
8
8
|
function migrateCypressExecutorOptions(tree, projectName, target, configuration, previousCypressConfigs) {
|
|
@@ -66,10 +66,10 @@ async function migrateCypressProject(tree) {
|
|
|
66
66
|
// if we don't have the already migrated configs
|
|
67
67
|
// it prevents us from being able to rename files for those projects
|
|
68
68
|
const previousCypressConfigs = new Map();
|
|
69
|
-
(0,
|
|
69
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nx/cypress:cypress', (currentValue, projectName, target, configuration) => {
|
|
70
70
|
migrateCypressExecutorOptions(tree, projectName, target, configuration, previousCypressConfigs);
|
|
71
71
|
});
|
|
72
|
-
(0,
|
|
72
|
+
(0, internal_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (currentValue, projectName, target, configuration) => {
|
|
73
73
|
migrateCypressExecutorOptions(tree, projectName, target, configuration, previousCypressConfigs);
|
|
74
74
|
});
|
|
75
75
|
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|