@nx/cypress 19.4.3 → 19.5.0-beta.1
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/package.json +5 -5
- package/plugins/cypress-preset.js +2 -3
- package/src/executors/cypress/cypress.impl.js +1 -1
- package/src/generators/base-setup/base-setup.js +1 -2
- package/src/generators/component-configuration/component-configuration.js +3 -4
- package/src/generators/configuration/configuration.js +2 -3
- package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -2
- package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.js +1 -2
- package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.js +1 -2
- package/src/generators/convert-to-inferred/lib/upsert-baseUrl.js +1 -2
- package/src/generators/init/init.js +3 -4
- package/src/generators/migrate-to-cypress-11/conversion.util.js +8 -9
- package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +1 -2
- package/src/migrations/update-15-5-0/helpers.js +2 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-2-0/update-cy-tsconfig.js +1 -2
- package/src/migrations/update-16-4-0/tsconfig-sourcemaps.js +1 -2
- package/src/migrations/update-16-8-0/cypress-13.js +2 -3
- package/src/migrations/update-18-1-0/update-cypress-version-13-6-6.js +1 -1
- package/src/utils/add-linter.js +1 -2
- package/src/utils/config.js +5 -5
- package/src/utils/ct-helpers.js +5 -5
- package/src/utils/cypress-version.js +2 -3
- package/src/utils/find-target-options.js +1 -2
- package/src/utils/project-name.js +3 -4
- package/src/utils/start-dev-server.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.0-beta.1",
|
|
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.
|
|
40
|
-
"@nx/eslint": "19.
|
|
41
|
-
"@nx/js": "19.
|
|
39
|
+
"@nx/devkit": "19.5.0-beta.1",
|
|
40
|
+
"@nx/eslint": "19.5.0-beta.1",
|
|
41
|
+
"@nx/js": "19.5.0-beta.1",
|
|
42
42
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
43
43
|
"detect-port": "^1.5.1",
|
|
44
44
|
"tslib": "^2.3.0",
|
|
45
|
-
"@nrwl/cypress": "19.
|
|
45
|
+
"@nrwl/cypress": "19.5.0-beta.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"cypress": ">= 3 < 14"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.nxBaseCypressPreset = nxBaseCypressPreset;
|
|
4
|
+
exports.nxE2EPreset = nxE2EPreset;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const fs_1 = require("fs");
|
|
@@ -28,7 +29,6 @@ function nxBaseCypressPreset(pathToConfig, options) {
|
|
|
28
29
|
chromeWebSecurity: false,
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
|
-
exports.nxBaseCypressPreset = nxBaseCypressPreset;
|
|
32
32
|
function startWebServer(webServerCommand) {
|
|
33
33
|
const serverProcess = (0, child_process_1.spawn)(webServerCommand, {
|
|
34
34
|
cwd: devkit_1.workspaceRoot,
|
|
@@ -113,7 +113,6 @@ function nxE2EPreset(pathToConfig, options) {
|
|
|
113
113
|
};
|
|
114
114
|
return baseConfig;
|
|
115
115
|
}
|
|
116
|
-
exports.nxE2EPreset = nxE2EPreset;
|
|
117
116
|
function waitForServer(url, webServerConfig) {
|
|
118
117
|
return new Promise((resolve, reject) => {
|
|
119
118
|
let pollTimeout;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = cypressExecutor;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
@@ -30,7 +31,6 @@ async function cypressExecutor(options, context) {
|
|
|
30
31
|
}
|
|
31
32
|
return { success };
|
|
32
33
|
}
|
|
33
|
-
exports.default = cypressExecutor;
|
|
34
34
|
function normalizeOptions(options, context) {
|
|
35
35
|
options.env = options.env || {};
|
|
36
36
|
if (options.testingType === 'component') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addBaseCypressSetup =
|
|
3
|
+
exports.addBaseCypressSetup = addBaseCypressSetup;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -53,7 +53,6 @@ function addBaseCypressSetup(tree, options) {
|
|
|
53
53
|
tree.rename((0, devkit_1.joinPathFragments)(projectConfig.root, options.directory, 'tsconfig.json'), (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json'));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
exports.addBaseCypressSetup = addBaseCypressSetup;
|
|
57
56
|
function normalizeOptions(tree, projectConfig, options) {
|
|
58
57
|
options.directory ??= 'cypress';
|
|
59
58
|
const offsetFromProjectRoot = options.directory
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.componentConfigurationGenerator = componentConfigurationGenerator;
|
|
4
|
+
exports.componentConfigurationGeneratorInternal = componentConfigurationGeneratorInternal;
|
|
5
|
+
exports.updateTsConfigForComponentTesting = updateTsConfigForComponentTesting;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const cypress_version_1 = require("../../utils/cypress-version");
|
|
6
8
|
const versions_1 = require("../../utils/versions");
|
|
@@ -12,7 +14,6 @@ function componentConfigurationGenerator(tree, options) {
|
|
|
12
14
|
...options,
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
|
-
exports.componentConfigurationGenerator = componentConfigurationGenerator;
|
|
16
17
|
async function componentConfigurationGeneratorInternal(tree, options) {
|
|
17
18
|
const tasks = [];
|
|
18
19
|
const opts = normalizeOptions(tree, options);
|
|
@@ -37,7 +38,6 @@ async function componentConfigurationGeneratorInternal(tree, options) {
|
|
|
37
38
|
}
|
|
38
39
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
39
40
|
}
|
|
40
|
-
exports.componentConfigurationGeneratorInternal = componentConfigurationGeneratorInternal;
|
|
41
41
|
function normalizeOptions(tree, options) {
|
|
42
42
|
const cyVersion = (0, cypress_version_1.installedCypressVersion)();
|
|
43
43
|
if (cyVersion && cyVersion < 10) {
|
|
@@ -161,5 +161,4 @@ function updateTsConfigForComponentTesting(tree, projectConfig) {
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
exports.updateTsConfigForComponentTesting = updateTsConfigForComponentTesting;
|
|
165
164
|
exports.default = componentConfigurationGenerator;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.configurationGenerator = configurationGenerator;
|
|
4
|
+
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const js_1 = require("@nx/js");
|
|
6
7
|
const eslint_1 = require("@nx/eslint");
|
|
@@ -17,7 +18,6 @@ function configurationGenerator(tree, options) {
|
|
|
17
18
|
...options,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
exports.configurationGenerator = configurationGenerator;
|
|
21
21
|
async function configurationGeneratorInternal(tree, options) {
|
|
22
22
|
const opts = normalizeOptions(tree, options);
|
|
23
23
|
opts.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
|
|
@@ -54,7 +54,6 @@ async function configurationGeneratorInternal(tree, options) {
|
|
|
54
54
|
}
|
|
55
55
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
56
56
|
}
|
|
57
|
-
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
58
57
|
function ensureDependencies(tree, options) {
|
|
59
58
|
const devDependencies = {
|
|
60
59
|
'@types/node': versions_1.typesNodeVersion,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToInferred =
|
|
3
|
+
exports.convertToInferred = convertToInferred;
|
|
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
6
|
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
@@ -30,7 +30,6 @@ async function convertToInferred(tree, options) {
|
|
|
30
30
|
await (0, devkit_1.formatFiles)(tree);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.convertToInferred = convertToInferred;
|
|
34
33
|
function postTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
|
35
34
|
if (target.options) {
|
|
36
35
|
handlePropertiesInOptions(tree, target.options, projectDetails.root, target);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDevServerTargetToConfig =
|
|
3
|
+
exports.addDevServerTargetToConfig = addDevServerTargetToConfig;
|
|
4
4
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
5
|
/**
|
|
6
6
|
* Add or update the webServerCommands and ciWebServerCommand options in the Cypress Config
|
|
@@ -73,4 +73,3 @@ function addDevServerTargetToConfig(tree, configFilePath, webServerCommands, ciD
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
exports.addDevServerTargetToConfig = addDevServerTargetToConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addExcludeSpecPattern =
|
|
3
|
+
exports.addExcludeSpecPattern = addExcludeSpecPattern;
|
|
4
4
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
5
|
function addExcludeSpecPattern(tree, configFilePath, excludeSpecPattern) {
|
|
6
6
|
let configFileContents = tree.read(configFilePath, 'utf-8');
|
|
@@ -25,4 +25,3 @@ function addExcludeSpecPattern(tree, configFilePath, excludeSpecPattern) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
exports.addExcludeSpecPattern = addExcludeSpecPattern;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upsertBaseUrl =
|
|
3
|
+
exports.upsertBaseUrl = upsertBaseUrl;
|
|
4
4
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
5
|
function upsertBaseUrl(tree, configFilePath, baseUrlValueInProject) {
|
|
6
6
|
const configFileContents = tree.read(configFilePath, 'utf-8');
|
|
@@ -30,4 +30,3 @@ function upsertBaseUrl(tree, configFilePath, baseUrlValueInProject) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.upsertBaseUrl = upsertBaseUrl;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addPlugin = addPlugin;
|
|
4
|
+
exports.cypressInitGenerator = cypressInitGenerator;
|
|
5
|
+
exports.cypressInitGeneratorInternal = cypressInitGeneratorInternal;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
6
8
|
const plugin_1 = require("../../plugins/plugin");
|
|
@@ -42,7 +44,6 @@ function addPlugin(tree, graph, updatePackageScripts) {
|
|
|
42
44
|
ciTargetName: ['e2e-ci', 'cypress:e2e-ci', 'cypress-e2e-ci'],
|
|
43
45
|
}, updatePackageScripts);
|
|
44
46
|
}
|
|
45
|
-
exports.addPlugin = addPlugin;
|
|
46
47
|
function updateProductionFileset(tree) {
|
|
47
48
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
48
49
|
const productionFileset = nxJson.namedInputs?.production;
|
|
@@ -59,7 +60,6 @@ function updateProductionFileset(tree) {
|
|
|
59
60
|
async function cypressInitGenerator(tree, options) {
|
|
60
61
|
return cypressInitGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
61
62
|
}
|
|
62
|
-
exports.cypressInitGenerator = cypressInitGenerator;
|
|
63
63
|
async function cypressInitGeneratorInternal(tree, options) {
|
|
64
64
|
updateProductionFileset(tree);
|
|
65
65
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -81,5 +81,4 @@ async function cypressInitGeneratorInternal(tree, options) {
|
|
|
81
81
|
}
|
|
82
82
|
return installTask;
|
|
83
83
|
}
|
|
84
|
-
exports.cypressInitGeneratorInternal = cypressInitGeneratorInternal;
|
|
85
84
|
exports.default = cypressInitGenerator;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.findCypressConfigs = findCypressConfigs;
|
|
4
|
+
exports.createNewCypressConfig = createNewCypressConfig;
|
|
5
|
+
exports.createSupportFileImport = createSupportFileImport;
|
|
6
|
+
exports.updateProjectPaths = updateProjectPaths;
|
|
7
|
+
exports.updateImports = updateImports;
|
|
8
|
+
exports.writeNewConfig = writeNewConfig;
|
|
9
|
+
exports.addConfigToTsConfig = addConfigToTsConfig;
|
|
10
|
+
exports.updatePluginFile = updatePluginFile;
|
|
4
11
|
const devkit_1 = require("@nx/devkit");
|
|
5
12
|
const path_1 = require("path");
|
|
6
13
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
@@ -34,7 +41,6 @@ function findCypressConfigs(tree, projectConfig, target, config) {
|
|
|
34
41
|
cypressConfigPathTs,
|
|
35
42
|
};
|
|
36
43
|
}
|
|
37
|
-
exports.findCypressConfigs = findCypressConfigs;
|
|
38
44
|
/**
|
|
39
45
|
* update the existing cypress.json config to the new cypress.config.ts structure.
|
|
40
46
|
* return both the old and new configs
|
|
@@ -66,7 +72,6 @@ function createNewCypressConfig(tree, projectConfig, cypressConfigPathJson) {
|
|
|
66
72
|
};
|
|
67
73
|
return { cypressConfigTs, cypressConfigJson };
|
|
68
74
|
}
|
|
69
|
-
exports.createNewCypressConfig = createNewCypressConfig;
|
|
70
75
|
function createSupportFileImport(oldSupportFilePath, newSupportFilePath, projectSourceRoot) {
|
|
71
76
|
// need to get the new import path for the support file.
|
|
72
77
|
// before it was "<relative path>/support/index.ts" and the new path will be "<relative path>/support/e2e.ts"
|
|
@@ -90,7 +95,6 @@ function createSupportFileImport(oldSupportFilePath, newSupportFilePath, project
|
|
|
90
95
|
: oldImportPathLeaf,
|
|
91
96
|
};
|
|
92
97
|
}
|
|
93
|
-
exports.createSupportFileImport = createSupportFileImport;
|
|
94
98
|
function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfigJson, }) {
|
|
95
99
|
const { integrationFolder, supportFile } = cypressConfigTs['e2e'];
|
|
96
100
|
const oldIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, cypressConfigJson.integrationFolder);
|
|
@@ -156,7 +160,6 @@ function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfi
|
|
|
156
160
|
tree.delete(oldIntegrationFolder);
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
|
-
exports.updateProjectPaths = updateProjectPaths;
|
|
160
163
|
function updateImports(tree, filePath, oldImportPath, newImportPath) {
|
|
161
164
|
if (!tsModule) {
|
|
162
165
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
@@ -180,7 +183,6 @@ function updateImports(tree, filePath, oldImportPath, newImportPath) {
|
|
|
180
183
|
});
|
|
181
184
|
tree.write(filePath, newContent);
|
|
182
185
|
}
|
|
183
|
-
exports.updateImports = updateImports;
|
|
184
186
|
function writeNewConfig(tree, cypressConfigPathTs, cypressConfigs) {
|
|
185
187
|
// remove deprecated configs options
|
|
186
188
|
const { pluginsFile = false, integrationFolder = '', ...restOfConfig } = cypressConfigs.cypressConfigTs.e2e;
|
|
@@ -203,7 +205,6 @@ export default defineConfig({
|
|
|
203
205
|
})
|
|
204
206
|
`);
|
|
205
207
|
}
|
|
206
|
-
exports.writeNewConfig = writeNewConfig;
|
|
207
208
|
function addConfigToTsConfig(tree, tsconfigPath, cypressConfigPath) {
|
|
208
209
|
if (tree.exists(tsconfigPath)) {
|
|
209
210
|
(0, devkit_1.updateJson)(tree, tsconfigPath, (json) => {
|
|
@@ -215,7 +216,6 @@ function addConfigToTsConfig(tree, tsconfigPath, cypressConfigPath) {
|
|
|
215
216
|
}, { expectComments: true });
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
exports.addConfigToTsConfig = addConfigToTsConfig;
|
|
219
219
|
function updatePluginFile(tree, projectConfig, cypressConfigs) {
|
|
220
220
|
// if ts file change module.exports = to export default
|
|
221
221
|
// if js file don't do anything
|
|
@@ -243,4 +243,3 @@ function updatePluginFile(tree, projectConfig, cypressConfigs) {
|
|
|
243
243
|
}
|
|
244
244
|
return updatedCypressConfigs;
|
|
245
245
|
}
|
|
246
|
-
exports.updatePluginFile = updatePluginFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.migrateCypressProject =
|
|
3
|
+
exports.migrateCypressProject = migrateCypressProject;
|
|
4
4
|
const cypress_version_1 = require("../../utils/cypress-version");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
@@ -89,5 +89,4 @@ async function migrateCypressProject(tree) {
|
|
|
89
89
|
(0, devkit_1.installPackagesTask)(tree);
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
exports.migrateCypressProject = migrateCypressProject;
|
|
93
92
|
exports.default = migrateCypressProject;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BANNED_COMMANDS =
|
|
3
|
+
exports.BANNED_COMMANDS = void 0;
|
|
4
|
+
exports.isAlreadyCommented = isAlreadyCommented;
|
|
4
5
|
function isAlreadyCommented(node) {
|
|
5
6
|
return node.getFullText().includes('TODO(@nrwl/cypress)');
|
|
6
7
|
}
|
|
7
|
-
exports.isAlreadyCommented = isAlreadyCommented;
|
|
8
8
|
exports.BANNED_COMMANDS = [
|
|
9
9
|
'as',
|
|
10
10
|
'children',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = replacePackage;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
5
6
|
async function replacePackage(tree) {
|
|
6
7
|
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/cypress', '@nx/cypress');
|
|
7
8
|
await (0, devkit_1.formatFiles)(tree);
|
|
8
9
|
}
|
|
9
|
-
exports.default = replacePackage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeCyTsConfigNames =
|
|
3
|
+
exports.normalizeCyTsConfigNames = normalizeCyTsConfigNames;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
6
|
async function normalizeCyTsConfigNames(tree) {
|
|
@@ -17,7 +17,6 @@ async function normalizeCyTsConfigNames(tree) {
|
|
|
17
17
|
});
|
|
18
18
|
await (0, devkit_1.formatFiles)(tree);
|
|
19
19
|
}
|
|
20
|
-
exports.normalizeCyTsConfigNames = normalizeCyTsConfigNames;
|
|
21
20
|
function moveProjectTsCyConfig(tree, projectConfig, newTsConfigPath) {
|
|
22
21
|
if (tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.cy.json'))) {
|
|
23
22
|
tree.rename((0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.cy.json'), newTsConfigPath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixLegacyCypressTsconfig =
|
|
3
|
+
exports.fixLegacyCypressTsconfig = fixLegacyCypressTsconfig;
|
|
4
4
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -58,5 +58,4 @@ async function fixLegacyCypressTsconfig(tree) {
|
|
|
58
58
|
});
|
|
59
59
|
await (0, devkit_1.formatFiles)(tree);
|
|
60
60
|
}
|
|
61
|
-
exports.fixLegacyCypressTsconfig = fixLegacyCypressTsconfig;
|
|
62
61
|
exports.default = fixLegacyCypressTsconfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.updateToCypress13 = updateToCypress13;
|
|
4
|
+
exports.shouldNotOverrideReadFile = shouldNotOverrideReadFile;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const cypress_version_1 = require("../../utils/cypress-version");
|
|
6
7
|
const typescript_1 = require("typescript");
|
|
@@ -33,7 +34,6 @@ async function updateToCypress13(tree) {
|
|
|
33
34
|
});
|
|
34
35
|
await (0, devkit_1.formatFiles)(tree);
|
|
35
36
|
}
|
|
36
|
-
exports.updateToCypress13 = updateToCypress13;
|
|
37
37
|
function removeVideoUploadOnPassesOption(tree, configPath) {
|
|
38
38
|
const config = tree.read(configPath, 'utf-8');
|
|
39
39
|
const isUsingDeprecatedOption = tsquery_1.tsquery.query(config, getPropertyQuery('videoUploadOnPasses'))?.length > 0;
|
|
@@ -165,7 +165,6 @@ ${node.getText()}`;
|
|
|
165
165
|
});
|
|
166
166
|
tree.write(filePath, markedOverrideUsage);
|
|
167
167
|
}
|
|
168
|
-
exports.shouldNotOverrideReadFile = shouldNotOverrideReadFile;
|
|
169
168
|
function isAlreadyCommented(node) {
|
|
170
169
|
return node.getFullText().includes('TODO(@nx/cypress)');
|
|
171
170
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const cypress_version_1 = require("../../utils/cypress-version");
|
|
5
6
|
async function default_1(tree) {
|
|
@@ -9,4 +10,3 @@ async function default_1(tree) {
|
|
|
9
10
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { cypress: '^13.6.6' });
|
|
10
11
|
await (0, devkit_1.formatFiles)(tree);
|
|
11
12
|
}
|
|
12
|
-
exports.default = default_1;
|
package/src/utils/add-linter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addLinterToCyProject =
|
|
3
|
+
exports.addLinterToCyProject = addLinterToCyProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const eslint_1 = require("@nx/eslint");
|
|
6
6
|
const cypress_version_1 = require("./cypress-version");
|
|
@@ -91,4 +91,3 @@ async function addLinterToCyProject(tree, options) {
|
|
|
91
91
|
}
|
|
92
92
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
93
93
|
}
|
|
94
|
-
exports.addLinterToCyProject = addLinterToCyProject;
|
package/src/utils/config.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CYPRESS_CONFIG_FILE_NAME_PATTERN = void 0;
|
|
4
|
+
exports.addDefaultE2EConfig = addDefaultE2EConfig;
|
|
5
|
+
exports.addDefaultCTConfig = addDefaultCTConfig;
|
|
6
|
+
exports.addMountDefinition = addMountDefinition;
|
|
7
|
+
exports.getProjectCypressConfigPath = getProjectCypressConfigPath;
|
|
4
8
|
const devkit_1 = require("@nx/devkit");
|
|
5
9
|
exports.CYPRESS_CONFIG_FILE_NAME_PATTERN = 'cypress.config.{js,ts,mjs,cjs}';
|
|
6
10
|
const TS_QUERY_COMMON_JS_EXPORT_SELECTOR = 'BinaryExpression:has(Identifier[name="module"]):has(Identifier[name="exports"])';
|
|
@@ -38,7 +42,6 @@ async function addDefaultE2EConfig(cyConfigContents, options, baseUrl) {
|
|
|
38
42
|
}
|
|
39
43
|
return updatedConfigContents;
|
|
40
44
|
}
|
|
41
|
-
exports.addDefaultE2EConfig = addDefaultE2EConfig;
|
|
42
45
|
/**
|
|
43
46
|
* Adds the nxComponentTestingPreset to the cypress config file
|
|
44
47
|
* Make sure after calling this the correct import statement is addeda
|
|
@@ -76,7 +79,6 @@ async function addDefaultCTConfig(cyConfigContents, options = {}) {
|
|
|
76
79
|
}
|
|
77
80
|
return updatedConfigContents;
|
|
78
81
|
}
|
|
79
|
-
exports.addDefaultCTConfig = addDefaultCTConfig;
|
|
80
82
|
/**
|
|
81
83
|
* Adds the mount command for Cypress
|
|
82
84
|
* Make sure after calling this the correct import statement is added
|
|
@@ -102,7 +104,6 @@ async function addMountDefinition(cmpCommandFileContents) {
|
|
|
102
104
|
});
|
|
103
105
|
return `${updatedInterface}\n${mountCommand}`;
|
|
104
106
|
}
|
|
105
|
-
exports.addMountDefinition = addMountDefinition;
|
|
106
107
|
function getProjectCypressConfigPath(tree, projectRoot) {
|
|
107
108
|
const cypressConfigPaths = (0, devkit_1.glob)(tree, [
|
|
108
109
|
(0, devkit_1.joinPathFragments)(projectRoot, exports.CYPRESS_CONFIG_FILE_NAME_PATTERN),
|
|
@@ -112,4 +113,3 @@ function getProjectCypressConfigPath(tree, projectRoot) {
|
|
|
112
113
|
}
|
|
113
114
|
return cypressConfigPaths[0];
|
|
114
115
|
}
|
|
115
|
-
exports.getProjectCypressConfigPath = getProjectCypressConfigPath;
|
package/src/utils/ct-helpers.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CY_FILE_MATCHER = void 0;
|
|
4
|
+
exports.getTempTailwindPath = getTempTailwindPath;
|
|
5
|
+
exports.isCtProjectUsingBuildProject = isCtProjectUsingBuildProject;
|
|
6
|
+
exports.getProjectConfigByPath = getProjectConfigByPath;
|
|
7
|
+
exports.createExecutorContext = createExecutorContext;
|
|
4
8
|
const devkit_1 = require("@nx/devkit");
|
|
5
9
|
const path_1 = require("path");
|
|
6
10
|
const fs_1 = require("fs");
|
|
@@ -25,7 +29,6 @@ function getTempTailwindPath(context) {
|
|
|
25
29
|
return (0, path_1.join)(context.root, 'tmp', project.data.root, 'ct-styles.css');
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
|
-
exports.getTempTailwindPath = getTempTailwindPath;
|
|
29
32
|
/**
|
|
30
33
|
* Checks if the childProjectName is a descendent of the parentProjectName
|
|
31
34
|
* in the project graph
|
|
@@ -47,7 +50,6 @@ function isCtProjectUsingBuildProject(graph, parentProjectName, childProjectName
|
|
|
47
50
|
}
|
|
48
51
|
return false;
|
|
49
52
|
}
|
|
50
|
-
exports.isCtProjectUsingBuildProject = isCtProjectUsingBuildProject;
|
|
51
53
|
function getProjectConfigByPath(graph, configPath) {
|
|
52
54
|
const configFileFromWorkspaceRoot = (0, path_1.relative)(devkit_1.workspaceRoot, configPath);
|
|
53
55
|
const normalizedPathFromWorkspaceRoot = (0, devkit_1.normalizePath)((0, fs_1.lstatSync)(configPath).isFile()
|
|
@@ -66,7 +68,6 @@ function getProjectConfigByPath(graph, configPath) {
|
|
|
66
68
|
componentTestingProjectName;
|
|
67
69
|
return graph.nodes[componentTestingProjectName].data;
|
|
68
70
|
}
|
|
69
|
-
exports.getProjectConfigByPath = getProjectConfigByPath;
|
|
70
71
|
function createExecutorContext(graph, targets, projectName, targetName, configurationName) {
|
|
71
72
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(graph);
|
|
72
73
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
|
@@ -83,4 +84,3 @@ function createExecutorContext(graph, targets, projectName, targetName, configur
|
|
|
83
84
|
nxJsonConfiguration,
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
|
-
exports.createExecutorContext = createExecutorContext;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.installedCypressVersion = installedCypressVersion;
|
|
4
|
+
exports.assertMinimumCypressVersion = assertMinimumCypressVersion;
|
|
4
5
|
let cypressPackageJson;
|
|
5
6
|
let loadedCypress = false;
|
|
6
7
|
function installedCypressVersion() {
|
|
@@ -20,7 +21,6 @@ function installedCypressVersion() {
|
|
|
20
21
|
}
|
|
21
22
|
return +majorVersion;
|
|
22
23
|
}
|
|
23
|
-
exports.installedCypressVersion = installedCypressVersion;
|
|
24
24
|
/**
|
|
25
25
|
* will not throw if cypress is not installed
|
|
26
26
|
*/
|
|
@@ -30,4 +30,3 @@ function assertMinimumCypressVersion(minVersion) {
|
|
|
30
30
|
throw new Error(`Cypress version of ${minVersion} or higher is not installed. Expected Cypress v${minVersion}+, found Cypress v${version} instead.`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.assertMinimumCypressVersion = assertMinimumCypressVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findBuildConfig =
|
|
3
|
+
exports.findBuildConfig = findBuildConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const configuration_1 = require("nx/src/config/configuration");
|
|
6
6
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
@@ -32,7 +32,6 @@ async function findBuildConfig(tree, options) {
|
|
|
32
32
|
Provided Executors? ${[...options.validExecutorNames].join(', ')}`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
exports.findBuildConfig = findBuildConfig;
|
|
36
35
|
function findInTarget(tree, graph, options) {
|
|
37
36
|
const { project, target, configuration } = (0, devkit_1.parseTargetString)(options.buildTarget, graph);
|
|
38
37
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getUnscopedLibName = getUnscopedLibName;
|
|
4
|
+
exports.getE2eProjectName = getE2eProjectName;
|
|
5
|
+
exports.filePathPrefix = filePathPrefix;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
function getUnscopedLibName(libRoot) {
|
|
6
8
|
return libRoot.slice(libRoot.lastIndexOf('/') + 1);
|
|
7
9
|
}
|
|
8
|
-
exports.getUnscopedLibName = getUnscopedLibName;
|
|
9
10
|
function getE2eProjectName(targetProjectName, targetLibRoot, cypressDirectory) {
|
|
10
11
|
if (cypressDirectory) {
|
|
11
12
|
return `${filePathPrefix(cypressDirectory)}-${getUnscopedLibName(targetLibRoot)}-e2e`;
|
|
12
13
|
}
|
|
13
14
|
return `${targetProjectName}-e2e`;
|
|
14
15
|
}
|
|
15
|
-
exports.getE2eProjectName = getE2eProjectName;
|
|
16
16
|
function filePathPrefix(directory) {
|
|
17
17
|
return `${(0, devkit_1.names)(directory).fileName}`.replace(new RegExp('/', 'g'), '-');
|
|
18
18
|
}
|
|
19
|
-
exports.filePathPrefix = filePathPrefix;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.startDevServer =
|
|
3
|
+
exports.startDevServer = startDevServer;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const detectPort = require("detect-port");
|
|
@@ -50,7 +50,6 @@ If the port is in use, try using a different port value or passing --port='cypre
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
exports.startDevServer = startDevServer;
|
|
54
53
|
/**
|
|
55
54
|
* try to find a free port for the project to run on
|
|
56
55
|
* will return undefined if no port is found or the project doesn't have a port option
|