@nx/cypress 22.4.0-canary.20260113-246d4fd → 22.4.0-canary.20260114-45f2ae3
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 +6 -6
- package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.js +8 -16
- package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.js +3 -5
- package/src/generators/convert-to-inferred/lib/upsert-baseUrl.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/upsert-baseUrl.js +3 -7
- package/src/migrations/update-20-8-0/remove-experimental-fetch-polyfill.js +1 -1
- package/src/migrations/update-20-8-0/replace-experimental-just-in-time-compile.js +2 -2
- package/src/migrations/update-20-8-0/set-inject-document-domain.js +1 -1
- package/src/migrations/update-20-8-0/update-component-testing-mount-imports.js +6 -6
- package/src/migrations/update-22-1-0/rename-cy-exec-code-property.js +2 -2
- package/src/migrations/update-22-1-0/update-angular-component-testing-support.js +5 -5
- package/src/migrations/update-22-1-0/update-selector-playground-api.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/cypress",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260114-45f2ae3",
|
|
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,17 +36,17 @@
|
|
|
36
36
|
"migrations": "./migrations.json"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nx/devkit": "22.4.0-canary.
|
|
40
|
-
"@nx/eslint": "22.4.0-canary.
|
|
41
|
-
"@nx/js": "22.4.0-canary.
|
|
42
|
-
"@phenomnomnominal/tsquery": "~
|
|
39
|
+
"@nx/devkit": "22.4.0-canary.20260114-45f2ae3",
|
|
40
|
+
"@nx/eslint": "22.4.0-canary.20260114-45f2ae3",
|
|
41
|
+
"@nx/js": "22.4.0-canary.20260114-45f2ae3",
|
|
42
|
+
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
43
43
|
"detect-port": "^1.5.1",
|
|
44
44
|
"semver": "^7.6.3",
|
|
45
45
|
"tree-kill": "1.2.2",
|
|
46
46
|
"tslib": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"nx": "22.4.0-canary.
|
|
49
|
+
"nx": "22.4.0-canary.20260114-45f2ae3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"cypress": ">= 13 < 16"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-dev-server-target-to-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,iBAAiB,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"add-dev-server-target-to-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/add-dev-server-target-to-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,iBAAiB,CAAC,EAAE,MAAM,QA0H3B"}
|
|
@@ -14,20 +14,16 @@ const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
|
14
14
|
*/
|
|
15
15
|
function addDevServerTargetToConfig(tree, configFilePath, webServerCommands, ciDevServerTarget) {
|
|
16
16
|
let configFileContents = tree.read(configFilePath, 'utf-8');
|
|
17
|
-
let
|
|
17
|
+
let sourceFile = (0, tsquery_1.ast)(configFileContents);
|
|
18
18
|
const NX_E2E_PRESET_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) CallExpression:has(Identifier[name=nxE2EPreset])';
|
|
19
|
-
const nxE2ePresetOptionsNodes = (0, tsquery_1.
|
|
20
|
-
visitAllChildren: true,
|
|
21
|
-
});
|
|
19
|
+
const nxE2ePresetOptionsNodes = (0, tsquery_1.query)(sourceFile, NX_E2E_PRESET_SELECTOR);
|
|
22
20
|
if (nxE2ePresetOptionsNodes.length !== 0) {
|
|
23
21
|
const NX_E2E_PRESET_OPTIONS_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) CallExpression:has(Identifier[name=nxE2EPreset]) > ObjectLiteralExpression';
|
|
24
|
-
const optionsObjectNodes = (0, tsquery_1.
|
|
25
|
-
visitAllChildren: true,
|
|
26
|
-
});
|
|
22
|
+
const optionsObjectNodes = (0, tsquery_1.query)(sourceFile, NX_E2E_PRESET_OPTIONS_SELECTOR);
|
|
27
23
|
const hasObjectDefinition = optionsObjectNodes?.length > 0;
|
|
28
24
|
let nxE2ePresetOptionsNode = nxE2ePresetOptionsNodes[0];
|
|
29
25
|
const WEB_SERVER_COMMANDS_SELECTOR = 'PropertyAssignment:has(Identifier[name=webServerCommands])';
|
|
30
|
-
const webServerCommandsNodes = (0, tsquery_1.
|
|
26
|
+
const webServerCommandsNodes = (0, tsquery_1.query)(nxE2ePresetOptionsNode, WEB_SERVER_COMMANDS_SELECTOR);
|
|
31
27
|
if (webServerCommandsNodes.length !== 0) {
|
|
32
28
|
// Already exists, replace it
|
|
33
29
|
tree.write(configFilePath, `${configFileContents.slice(0, webServerCommandsNodes[0].getStart())}webServerCommands: ${JSON.stringify(webServerCommands)}${configFileContents.slice(webServerCommandsNodes[0].getEnd())}`);
|
|
@@ -42,17 +38,13 @@ function addDevServerTargetToConfig(tree, configFilePath, webServerCommands, ciD
|
|
|
42
38
|
}
|
|
43
39
|
if (ciDevServerTarget) {
|
|
44
40
|
configFileContents = tree.read(configFilePath, 'utf-8');
|
|
45
|
-
|
|
46
|
-
nxE2ePresetOptionsNode = (0, tsquery_1.
|
|
47
|
-
visitAllChildren: true,
|
|
48
|
-
})[0];
|
|
41
|
+
sourceFile = (0, tsquery_1.ast)(configFileContents);
|
|
42
|
+
nxE2ePresetOptionsNode = (0, tsquery_1.query)(sourceFile, NX_E2E_PRESET_SELECTOR)[0];
|
|
49
43
|
const NX_E2E_PRESET_OPTIONS_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) CallExpression:has(Identifier[name=nxE2EPreset]) > ObjectLiteralExpression';
|
|
50
|
-
const optionsObjectNodes = (0, tsquery_1.
|
|
51
|
-
visitAllChildren: true,
|
|
52
|
-
});
|
|
44
|
+
const optionsObjectNodes = (0, tsquery_1.query)(sourceFile, NX_E2E_PRESET_OPTIONS_SELECTOR);
|
|
53
45
|
const hasObjectDefinition = optionsObjectNodes?.length > 0;
|
|
54
46
|
const CI_WEB_SERVER_COMMANDS_SELECTOR = 'PropertyAssignment:has(Identifier[name=ciWebServerCommand])';
|
|
55
|
-
const ciWebServerCommandsNodes = (0, tsquery_1.
|
|
47
|
+
const ciWebServerCommandsNodes = (0, tsquery_1.query)(nxE2ePresetOptionsNode, CI_WEB_SERVER_COMMANDS_SELECTOR);
|
|
56
48
|
if (ciWebServerCommandsNodes.length !== 0) {
|
|
57
49
|
const ciWebServerCommandNode = ciWebServerCommandsNodes[0].getChildAt(2);
|
|
58
50
|
const ciWebServerCommand = ciWebServerCommandNode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-exclude-spec-pattern.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"add-exclude-spec-pattern.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/add-exclude-spec-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,QA8CtC"}
|
|
@@ -4,15 +4,13 @@ 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');
|
|
7
|
-
let
|
|
7
|
+
let sourceFile = (0, tsquery_1.ast)(configFileContents);
|
|
8
8
|
const E2E_CONFIG_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) > ObjectLiteralExpression';
|
|
9
|
-
const e2eConfigNodes = (0, tsquery_1.
|
|
10
|
-
visitAllChildren: true,
|
|
11
|
-
});
|
|
9
|
+
const e2eConfigNodes = (0, tsquery_1.query)(sourceFile, E2E_CONFIG_SELECTOR);
|
|
12
10
|
if (e2eConfigNodes.length !== 0) {
|
|
13
11
|
const e2eConfigNode = e2eConfigNodes[0];
|
|
14
12
|
const EXCLUDE_SPEC_PATTERN_SELECTOR = 'PropertyAssignment:has(Identifier[name="excludeSpecPattern"])';
|
|
15
|
-
const excludeSpecPatternNodes = (0, tsquery_1.
|
|
13
|
+
const excludeSpecPatternNodes = (0, tsquery_1.query)(e2eConfigNode, EXCLUDE_SPEC_PATTERN_SELECTOR);
|
|
16
14
|
if (excludeSpecPatternNodes.length !== 0) {
|
|
17
15
|
const excludeSpecPatternNode = excludeSpecPatternNodes[0];
|
|
18
16
|
let updatedExcludePattern = Array.isArray(excludeSpecPattern)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert-baseUrl.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/upsert-baseUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"upsert-baseUrl.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cypress/src/generators/convert-to-inferred/lib/upsert-baseUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,qBAAqB,EAAE,MAAM,QA4C9B"}
|
|
@@ -4,11 +4,9 @@ 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');
|
|
7
|
-
const
|
|
7
|
+
const sourceFile = (0, tsquery_1.ast)(configFileContents);
|
|
8
8
|
const BASE_URL_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) PropertyAssignment:has(Identifier[name="baseUrl"])';
|
|
9
|
-
const baseUrlNodes = (0, tsquery_1.
|
|
10
|
-
visitAllChildren: true,
|
|
11
|
-
});
|
|
9
|
+
const baseUrlNodes = (0, tsquery_1.query)(sourceFile, BASE_URL_SELECTOR);
|
|
12
10
|
if (baseUrlNodes.length !== 0) {
|
|
13
11
|
// The property exists in the config
|
|
14
12
|
const baseUrlValueNode = baseUrlNodes[0].getChildAt(2);
|
|
@@ -20,9 +18,7 @@ function upsertBaseUrl(tree, configFilePath, baseUrlValueInProject) {
|
|
|
20
18
|
}
|
|
21
19
|
else {
|
|
22
20
|
const E2E_OBJECT_SELECTOR = 'PropertyAssignment:has(Identifier[name=e2e]) ObjectLiteralExpression';
|
|
23
|
-
const e2eConfigNodes = (0, tsquery_1.
|
|
24
|
-
visitAllChildren: true,
|
|
25
|
-
});
|
|
21
|
+
const e2eConfigNodes = (0, tsquery_1.query)(sourceFile, E2E_OBJECT_SELECTOR);
|
|
26
22
|
if (e2eConfigNodes.length !== 0) {
|
|
27
23
|
const e2eConfigNode = e2eConfigNodes[0];
|
|
28
24
|
tree.write(configFilePath, `${configFileContents.slice(0, e2eConfigNode.getEnd() - 1)}baseUrl: "${baseUrlValueInProject}",
|
|
@@ -29,7 +29,7 @@ function removeExperimentalFetchPolyfill(cypressConfig) {
|
|
|
29
29
|
// couldn't find the config object, leave as is
|
|
30
30
|
return cypressConfig;
|
|
31
31
|
}
|
|
32
|
-
const sourceFile = tsquery_1.
|
|
32
|
+
const sourceFile = (0, tsquery_1.ast)(cypressConfig);
|
|
33
33
|
const updatedConfig = ts.factory.updateObjectLiteralExpression(config, config.properties
|
|
34
34
|
// remove the experimentalFetchPolyfill property from the top level config object
|
|
35
35
|
.filter((p) => !ts.isPropertyAssignment(p) ||
|
|
@@ -35,7 +35,7 @@ async function updateCtJustInTimeCompile(tree, cypressConfigPath) {
|
|
|
35
35
|
}
|
|
36
36
|
ts ??= (0, ensure_typescript_1.ensureTypescript)();
|
|
37
37
|
printer ??= ts.createPrinter();
|
|
38
|
-
const sourceFile = tsquery_1.
|
|
38
|
+
const sourceFile = (0, tsquery_1.ast)(cypressConfig);
|
|
39
39
|
let updatedConfig = config;
|
|
40
40
|
const bundler = await resolveBundler(updatedConfig, cypressConfigPath);
|
|
41
41
|
const isViteBundler = bundler === 'vite';
|
|
@@ -77,7 +77,7 @@ async function updateCtJustInTimeCompile(tree, cypressConfigPath) {
|
|
|
77
77
|
return cypressConfig.replace(config.getText(), printer.printNode(ts.EmitHint.Unspecified, updatedConfig, sourceFile));
|
|
78
78
|
}
|
|
79
79
|
async function resolveBundler(config, cypressConfigPath) {
|
|
80
|
-
const bundlerProperty = tsquery_1.
|
|
80
|
+
const bundlerProperty = (0, tsquery_1.query)(config, 'PropertyAssignment:has(Identifier[name=component]) PropertyAssignment:has(Identifier[name=devServer]) PropertyAssignment:has(Identifier[name=bundler])')[0];
|
|
81
81
|
if (bundlerProperty) {
|
|
82
82
|
return ts.isStringLiteral(bundlerProperty.initializer)
|
|
83
83
|
? bundlerProperty.initializer.getText().replace(/['"`]/g, '')
|
|
@@ -30,7 +30,7 @@ function setInjectDocumentDomain(cypressConfig) {
|
|
|
30
30
|
// couldn't find the config object, leave as is
|
|
31
31
|
return cypressConfig;
|
|
32
32
|
}
|
|
33
|
-
const sourceFile = tsquery_1.
|
|
33
|
+
const sourceFile = (0, tsquery_1.ast)(cypressConfig);
|
|
34
34
|
let e2eProperty = (0, migrations_1.getObjectProperty)(config, 'e2e');
|
|
35
35
|
let hasOtherTopLevelProperties = config.properties.some((p) => ts.isPropertyAssignment(p) &&
|
|
36
36
|
p.name.getText() !== 'e2e' &&
|
|
@@ -67,7 +67,7 @@ function parseMigrationInfo(tree, cypressConfigPath, projectName, projectGraph)
|
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
function resolveFramework(cypressConfig, config, projectName, projectGraph) {
|
|
70
|
-
const frameworkProperty = tsquery_1.
|
|
70
|
+
const frameworkProperty = (0, tsquery_1.query)(config, 'PropertyAssignment:has(Identifier[name=component]) PropertyAssignment:has(Identifier[name=devServer]) PropertyAssignment:has(Identifier[name=framework])')[0];
|
|
71
71
|
if (frameworkProperty) {
|
|
72
72
|
return ts.isStringLiteral(frameworkProperty.initializer)
|
|
73
73
|
? frameworkProperty.initializer.getText().replace(/['"`]/g, '')
|
|
@@ -75,7 +75,7 @@ function resolveFramework(cypressConfig, config, projectName, projectGraph) {
|
|
|
75
75
|
}
|
|
76
76
|
// component might be assigned to an Nx preset function call, so we try to
|
|
77
77
|
// infer the framework from the Nx preset import
|
|
78
|
-
const sourceFile = tsquery_1.
|
|
78
|
+
const sourceFile = (0, tsquery_1.ast)(cypressConfig);
|
|
79
79
|
const nxPresetModuleSpecifiers = [
|
|
80
80
|
'@nx/angular/plugins/component-testing',
|
|
81
81
|
'@nx/react/plugins/component-testing',
|
|
@@ -111,7 +111,7 @@ function migrateAngularFramework(tree, projectConfig, isLegacyVersion) {
|
|
|
111
111
|
let updatedFileContent;
|
|
112
112
|
if (isLegacyVersion) {
|
|
113
113
|
let needPackage = false;
|
|
114
|
-
updatedFileContent = tsquery_1.
|
|
114
|
+
updatedFileContent = (0, tsquery_1.replace)(content, 'ImportDeclaration', importTransformerFactory(content, 'cypress/angular', '@cypress/angular', () => {
|
|
115
115
|
needPackage = true;
|
|
116
116
|
}));
|
|
117
117
|
if (needPackage) {
|
|
@@ -119,7 +119,7 @@ function migrateAngularFramework(tree, projectConfig, isLegacyVersion) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
updatedFileContent = tsquery_1.
|
|
122
|
+
updatedFileContent = (0, tsquery_1.replace)(content, 'ImportDeclaration', importTransformerFactory(content, 'cypress/angular-signals', 'cypress/angular'));
|
|
123
123
|
}
|
|
124
124
|
tree.write(filePath, updatedFileContent);
|
|
125
125
|
});
|
|
@@ -131,7 +131,7 @@ function migrateReactFramework(tree, projectConfig) {
|
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
const content = tree.read(filePath, 'utf-8');
|
|
134
|
-
const updatedContent = tsquery_1.
|
|
134
|
+
const updatedContent = (0, tsquery_1.replace)(content, 'ImportDeclaration', importTransformerFactory(content, 'cypress/react18', 'cypress/react'));
|
|
135
135
|
tree.write(filePath, updatedContent);
|
|
136
136
|
});
|
|
137
137
|
}
|
|
@@ -141,7 +141,7 @@ function importTransformerFactory(fileContent, sourceModuleSpecifier, targetModu
|
|
|
141
141
|
sourceModuleSpecifier) {
|
|
142
142
|
matchImportCallback?.();
|
|
143
143
|
const updatedImport = ts.factory.updateImportDeclaration(node, node.modifiers, node.importClause, ts.factory.createStringLiteral(targetModuleSpecifier), node.attributes);
|
|
144
|
-
return printer.printNode(ts.EmitHint.Unspecified, updatedImport, tsquery_1.
|
|
144
|
+
return printer.printNode(ts.EmitHint.Unspecified, updatedImport, (0, tsquery_1.ast)(fileContent));
|
|
145
145
|
}
|
|
146
146
|
return node.getText();
|
|
147
147
|
};
|
|
@@ -29,9 +29,9 @@ function updateCyExecItsCalls(fileContent) {
|
|
|
29
29
|
return fileContent;
|
|
30
30
|
}
|
|
31
31
|
ts ??= (0, ensure_typescript_1.ensureTypescript)();
|
|
32
|
-
const sourceFile = tsquery_1.
|
|
32
|
+
const sourceFile = (0, tsquery_1.ast)(fileContent);
|
|
33
33
|
const updates = [];
|
|
34
|
-
const callExpressions = tsquery_1.
|
|
34
|
+
const callExpressions = (0, tsquery_1.query)(sourceFile, 'CallExpression:has(PropertyAccessExpression > Identifier[name="its"])');
|
|
35
35
|
for (const callExpression of callExpressions) {
|
|
36
36
|
if (!shouldUpdateCallExpression(callExpression)) {
|
|
37
37
|
continue;
|
|
@@ -61,8 +61,8 @@ function migrateProject(tree, projectConfig) {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
const originalContent = tree.read(filePath, 'utf-8');
|
|
64
|
-
const sourceFile = tsquery_1.
|
|
65
|
-
const updatedContent = tsquery_1.
|
|
64
|
+
const sourceFile = (0, tsquery_1.ast)(originalContent);
|
|
65
|
+
const updatedContent = (0, tsquery_1.replace)(originalContent, 'ImportDeclaration', (node) => {
|
|
66
66
|
if (!ts.isStringLiteral(node.moduleSpecifier) ||
|
|
67
67
|
node.moduleSpecifier.text !== 'cypress/angular') {
|
|
68
68
|
return node.getText();
|
|
@@ -77,20 +77,20 @@ function migrateProject(tree, projectConfig) {
|
|
|
77
77
|
}
|
|
78
78
|
function resolveFramework(cypressConfig, config, projectName, projectGraph) {
|
|
79
79
|
ts ??= (0, ensure_typescript_1.ensureTypescript)();
|
|
80
|
-
const frameworkProperty = tsquery_1.
|
|
80
|
+
const frameworkProperty = (0, tsquery_1.query)(config, 'PropertyAssignment:has(Identifier[name=component]) PropertyAssignment:has(Identifier[name=devServer]) PropertyAssignment:has(Identifier[name=framework])')[0];
|
|
81
81
|
if (frameworkProperty) {
|
|
82
82
|
return ts.isStringLiteral(frameworkProperty.initializer)
|
|
83
83
|
? frameworkProperty.initializer.text
|
|
84
84
|
: null;
|
|
85
85
|
}
|
|
86
|
-
const sourceFile = tsquery_1.
|
|
86
|
+
const sourceFile = (0, tsquery_1.ast)(cypressConfig);
|
|
87
87
|
const nxPresetModuleSpecifiers = [
|
|
88
88
|
'@nx/angular/plugins/component-testing',
|
|
89
89
|
'@nx/react/plugins/component-testing',
|
|
90
90
|
'@nx/next/plugins/component-testing',
|
|
91
91
|
'@nx/remix/plugins/component-testing',
|
|
92
92
|
];
|
|
93
|
-
const imports = tsquery_1.
|
|
93
|
+
const imports = (0, tsquery_1.query)(sourceFile, 'ImportDeclaration');
|
|
94
94
|
const nxPresetImport = imports.find((decl) => {
|
|
95
95
|
const moduleSpec = decl.moduleSpecifier.getText().replace(/['"`]/g, '');
|
|
96
96
|
return nxPresetModuleSpecifiers.includes(moduleSpec);
|
|
@@ -33,9 +33,9 @@ function migrateSelectorPlaygroundApi(fileContent) {
|
|
|
33
33
|
}
|
|
34
34
|
ts ??= (0, ensure_typescript_1.ensureTypescript)();
|
|
35
35
|
printer ??= ts.createPrinter();
|
|
36
|
-
const sourceFile = tsquery_1.
|
|
36
|
+
const sourceFile = (0, tsquery_1.ast)(updated);
|
|
37
37
|
let hasChanges = false;
|
|
38
|
-
const result = tsquery_1.
|
|
38
|
+
const result = (0, tsquery_1.replace)(updated, 'CallExpression:has(Identifier[name="defaults"])', (node) => {
|
|
39
39
|
if (!ts.isPropertyAccessExpression(node.expression)) {
|
|
40
40
|
return node.getText();
|
|
41
41
|
}
|