@nx/cypress 16.0.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +16 -0
  5. package/generators.json +66 -0
  6. package/index.d.ts +5 -0
  7. package/index.js +14 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +53 -0
  10. package/package.json +59 -0
  11. package/plugins/cypress-preset.d.ts +62 -0
  12. package/plugins/cypress-preset.js +53 -0
  13. package/plugins/cypress-preset.js.map +1 -0
  14. package/src/executors/cypress/compat.d.ts +2 -0
  15. package/src/executors/cypress/compat.js +6 -0
  16. package/src/executors/cypress/compat.js.map +1 -0
  17. package/src/executors/cypress/cypress.impl.d.ts +40 -0
  18. package/src/executors/cypress/cypress.impl.js +372 -0
  19. package/src/executors/cypress/cypress.impl.js.map +1 -0
  20. package/src/executors/cypress/schema.json +158 -0
  21. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.d.ts +4 -0
  22. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +104 -0
  23. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js.map +1 -0
  24. package/src/generators/convert-tslint-to-eslint/schema.json +44 -0
  25. package/src/generators/cypress-component-project/cypress-component-project.d.ts +4 -0
  26. package/src/generators/cypress-component-project/cypress-component-project.js +127 -0
  27. package/src/generators/cypress-component-project/cypress-component-project.js.map +1 -0
  28. package/src/generators/cypress-component-project/files/cypress/fixtures/example.json +5 -0
  29. package/src/generators/cypress-component-project/files/cypress/support/commands.ts__ext__ +34 -0
  30. package/src/generators/cypress-component-project/files/cypress/support/component-index.html +13 -0
  31. package/src/generators/cypress-component-project/files/cypress/support/component.ts__ext__ +17 -0
  32. package/src/generators/cypress-component-project/files/cypress/tsconfig.cy.json +17 -0
  33. package/src/generators/cypress-component-project/files/cypress.config.ts__ext__ +3 -0
  34. package/src/generators/cypress-component-project/schema.d.ts +5 -0
  35. package/src/generators/cypress-component-project/schema.json +33 -0
  36. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.d.ts +18 -0
  37. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js +133 -0
  38. package/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.js.map +1 -0
  39. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/e2e/app.cy.ts__tmpl__ +13 -0
  40. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/fixtures/example.json__tmpl__ +4 -0
  41. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/app.po.ts__tmpl__ +1 -0
  42. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/commands.ts__tmpl__ +33 -0
  43. package/src/generators/cypress-e2e-configuration/files/v10/__dir__/support/e2e.ts__tmpl__ +17 -0
  44. package/src/generators/cypress-e2e-configuration/files/v10/cypress.config.ts__tmpl__ +9 -0
  45. package/src/generators/cypress-e2e-configuration/files/v10/tsconfig__tsFileExt__ +10 -0
  46. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/fixtures/example.json__tmpl__ +4 -0
  47. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/integration/app.spec.ts__tmpl__ +13 -0
  48. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/plugins/index.js +22 -0
  49. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/app.po.ts__tmpl__ +1 -0
  50. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/commands.ts__tmpl__ +33 -0
  51. package/src/generators/cypress-e2e-configuration/files/v9/__dir__/support/index.ts__tmpl__ +17 -0
  52. package/src/generators/cypress-e2e-configuration/files/v9/cypress.json +12 -0
  53. package/src/generators/cypress-e2e-configuration/files/v9/tsconfig__tsFileExt__ +10 -0
  54. package/src/generators/cypress-e2e-configuration/schema.json +91 -0
  55. package/src/generators/cypress-project/cypress-project.d.ts +13 -0
  56. package/src/generators/cypress-project/cypress-project.js +172 -0
  57. package/src/generators/cypress-project/cypress-project.js.map +1 -0
  58. package/src/generators/cypress-project/files/v10-and-after/cypress.config.ts__tmpl__ +10 -0
  59. package/src/generators/cypress-project/files/v10-and-after/src/e2e/app.cy.ts__tmpl__ +13 -0
  60. package/src/generators/cypress-project/files/v10-and-after/src/fixtures/example.json__tmpl__ +4 -0
  61. package/src/generators/cypress-project/files/v10-and-after/src/support/app.po.ts__tmpl__ +1 -0
  62. package/src/generators/cypress-project/files/v10-and-after/src/support/commands.ts__tmpl__ +33 -0
  63. package/src/generators/cypress-project/files/v10-and-after/src/support/e2e.ts__tmpl__ +17 -0
  64. package/src/generators/cypress-project/files/v10-and-after/tsconfig.json +10 -0
  65. package/src/generators/cypress-project/files/v9-and-under/cypress.json +12 -0
  66. package/src/generators/cypress-project/files/v9-and-under/src/fixtures/example.json__tmpl__ +4 -0
  67. package/src/generators/cypress-project/files/v9-and-under/src/integration/app.spec.ts__tmpl__ +13 -0
  68. package/src/generators/cypress-project/files/v9-and-under/src/plugins/index.js +22 -0
  69. package/src/generators/cypress-project/files/v9-and-under/src/support/app.po.ts__tmpl__ +1 -0
  70. package/src/generators/cypress-project/files/v9-and-under/src/support/commands.ts__tmpl__ +33 -0
  71. package/src/generators/cypress-project/files/v9-and-under/src/support/index.ts__tmpl__ +17 -0
  72. package/src/generators/cypress-project/files/v9-and-under/tsconfig.json +10 -0
  73. package/src/generators/cypress-project/schema.d.ts +15 -0
  74. package/src/generators/cypress-project/schema.json +79 -0
  75. package/src/generators/init/init.d.ts +5 -0
  76. package/src/generators/init/init.js +47 -0
  77. package/src/generators/init/init.js.map +1 -0
  78. package/src/generators/init/schema.d.ts +5 -0
  79. package/src/generators/init/schema.json +16 -0
  80. package/src/generators/migrate-to-cypress-11/conversion.util.d.ts +34 -0
  81. package/src/generators/migrate-to-cypress-11/conversion.util.js +241 -0
  82. package/src/generators/migrate-to-cypress-11/conversion.util.js.map +1 -0
  83. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.d.ts +3 -0
  84. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js +85 -0
  85. package/src/generators/migrate-to-cypress-11/migrate-to-cypress-11.js.map +1 -0
  86. package/src/generators/migrate-to-cypress-11/schema.json +15 -0
  87. package/src/migrations/update-12-8-0/remove-typescript-plugin.d.ts +2 -0
  88. package/src/migrations/update-12-8-0/remove-typescript-plugin.js +89 -0
  89. package/src/migrations/update-12-8-0/remove-typescript-plugin.js.map +1 -0
  90. package/src/migrations/update-14-6-1/update-cypress-configs-presets.d.ts +3 -0
  91. package/src/migrations/update-14-6-1/update-cypress-configs-presets.js +111 -0
  92. package/src/migrations/update-14-6-1/update-cypress-configs-presets.js.map +1 -0
  93. package/src/migrations/update-14-7-0/update-cypress-version-if-10.d.ts +3 -0
  94. package/src/migrations/update-14-7-0/update-cypress-version-if-10.js +33 -0
  95. package/src/migrations/update-14-7-0/update-cypress-version-if-10.js.map +1 -0
  96. package/src/migrations/update-15-0-0/add-cypress-inputs.d.ts +2 -0
  97. package/src/migrations/update-15-0-0/add-cypress-inputs.js +48 -0
  98. package/src/migrations/update-15-0-0/add-cypress-inputs.js.map +1 -0
  99. package/src/migrations/update-15-0-0/update-cy-mount-usage.d.ts +5 -0
  100. package/src/migrations/update-15-0-0/update-cy-mount-usage.js +124 -0
  101. package/src/migrations/update-15-0-0/update-cy-mount-usage.js.map +1 -0
  102. package/src/migrations/update-15-1-0/cypress-11.d.ts +6 -0
  103. package/src/migrations/update-15-1-0/cypress-11.js +118 -0
  104. package/src/migrations/update-15-1-0/cypress-11.js.map +1 -0
  105. package/src/migrations/update-15-5-0/helpers.d.ts +3 -0
  106. package/src/migrations/update-15-5-0/helpers.js +40 -0
  107. package/src/migrations/update-15-5-0/helpers.js.map +1 -0
  108. package/src/migrations/update-15-5-0/update-to-cypress-12.d.ts +24 -0
  109. package/src/migrations/update-15-5-0/update-to-cypress-12.js +183 -0
  110. package/src/migrations/update-15-5-0/update-to-cypress-12.js.map +1 -0
  111. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  112. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  113. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  114. package/src/plugins/preprocessor-vite.d.ts +32 -0
  115. package/src/plugins/preprocessor-vite.js +96 -0
  116. package/src/plugins/preprocessor-vite.js.map +1 -0
  117. package/src/utils/add-linter.d.ts +21 -0
  118. package/src/utils/add-linter.js +90 -0
  119. package/src/utils/add-linter.js.map +1 -0
  120. package/src/utils/ct-helpers.d.ts +16 -0
  121. package/src/utils/ct-helpers.js +86 -0
  122. package/src/utils/ct-helpers.js.map +1 -0
  123. package/src/utils/cypress-version.d.ts +5 -0
  124. package/src/utils/cypress-version.js +34 -0
  125. package/src/utils/cypress-version.js.map +1 -0
  126. package/src/utils/find-target-options.d.ts +16 -0
  127. package/src/utils/find-target-options.js +115 -0
  128. package/src/utils/find-target-options.js.map +1 -0
  129. package/src/utils/project-name.d.ts +3 -0
  130. package/src/utils/project-name.js +20 -0
  131. package/src/utils/project-name.js.map +1 -0
  132. package/src/utils/versions.d.ts +9 -0
  133. package/src/utils/versions.js +13 -0
  134. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const typescript_1 = require("typescript");
6
+ const path_1 = require("path");
7
+ const cypress_version_1 = require("../../utils/cypress-version");
8
+ function removeTypescriptPlugin(tree) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const cypressVersion = (0, cypress_version_1.installedCypressVersion)();
11
+ if (cypressVersion < 7) {
12
+ console.warn(`Cypress v${cypressVersion} is installed. This migration was skipped. Please rerun this migration after updating to Cypress 7.`);
13
+ return;
14
+ }
15
+ for (const [_, proj] of (0, devkit_1.getProjects)(tree)) {
16
+ const cypressTargets = getCypressTargets(proj);
17
+ if (cypressTargets.length <= 0) {
18
+ continue;
19
+ }
20
+ for (const target of cypressTargets) {
21
+ const cypressConfigs = getCypressConfigs(target);
22
+ for (const config of cypressConfigs) {
23
+ const cypressConfig = (0, devkit_1.readJson)(tree, config);
24
+ if (cypressConfig.pluginsFile) {
25
+ let pluginPath = (0, path_1.join)((0, path_1.dirname)(config), cypressConfig.pluginsFile);
26
+ if (!tree.exists(pluginPath)) {
27
+ pluginPath = ['.js', '.ts']
28
+ .map((ext) => pluginPath + ext)
29
+ .find((path) => tree.exists(path));
30
+ }
31
+ removePreprocessor(tree, pluginPath);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ yield (0, devkit_1.formatFiles)(tree);
37
+ });
38
+ }
39
+ exports.default = removeTypescriptPlugin;
40
+ function removePreprocessor(tree, pluginPath) {
41
+ const pluginContents = tree.read(pluginPath, 'utf-8');
42
+ const sourceFile = (0, typescript_1.createSourceFile)(pluginPath, pluginContents, typescript_1.ScriptTarget.ESNext, true);
43
+ const deletions = [];
44
+ const callback = (node) => {
45
+ // Look for the invocation of preprocessTypescript
46
+ if ((0, typescript_1.isCallExpression)(node) &&
47
+ (0, typescript_1.isIdentifier)(node.expression) &&
48
+ node.expression.getText(sourceFile) === 'preprocessTypescript' &&
49
+ node.arguments.length < 2) {
50
+ // Get the Statement that the function call belongs to
51
+ let n = node.parent;
52
+ while (!(0, typescript_1.isExpressionStatement)(n) && n === sourceFile) {
53
+ n = n.parent;
54
+ }
55
+ deletions.push({
56
+ type: devkit_1.ChangeType.Delete,
57
+ start: n.getStart(),
58
+ length: n.getWidth() +
59
+ (pluginContents[n.getStart() + n.getWidth()] === ';' ? 1 : 0),
60
+ });
61
+ }
62
+ };
63
+ // Call the callback for every node in the file
64
+ sourceFile.forEachChild(recurse);
65
+ function recurse(node) {
66
+ callback(node);
67
+ node.forEachChild((child) => recurse(child));
68
+ }
69
+ // Remove the preprocessor from the file
70
+ tree.write(pluginPath, (0, devkit_1.applyChangesToString)(pluginContents, deletions));
71
+ }
72
+ function getCypressConfigs(target) {
73
+ if (!target.configurations && !target.options.cypressConfig) {
74
+ return [];
75
+ }
76
+ else if (!target.configurations && target.options.cypressConfig) {
77
+ return [target.options.cypressConfig];
78
+ }
79
+ return [target.options, Object.values(target.configurations)]
80
+ .filter((options) => !!options.cypressConfig)
81
+ .map((options) => options.cypressConfig);
82
+ }
83
+ function getCypressTargets(proj) {
84
+ if (!proj.targets) {
85
+ return [];
86
+ }
87
+ return Object.values(proj.targets).filter((target) => target.executor === '@nrwl/cypress:cypress');
88
+ }
89
+ //# sourceMappingURL=remove-typescript-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-typescript-plugin.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-12-8-0/remove-typescript-plugin.ts"],"names":[],"mappings":";;;AAAA,uCAUoB;AACpB,2CAOoB;AACpB,+BAAqC;AACrC,iEAAsE;AAEtE,SAA8B,sBAAsB,CAAC,IAAU;;QAC7D,MAAM,cAAc,GAAG,IAAA,yCAAuB,GAAE,CAAC;QACjD,IAAI,cAAc,GAAG,CAAC,EAAE;YACtB,OAAO,CAAC,IAAI,CACV,YAAY,cAAc,qGAAqG,CAChI,CAAC;YACF,OAAO;SACR;QAED,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,EAAE;YACzC,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,cAAc,CAAC,MAAM,IAAI,CAAC,EAAE;gBAC9B,SAAS;aACV;YAED,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;gBACnC,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBAEjD,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;oBACnC,MAAM,aAAa,GAAG,IAAA,iBAAQ,EA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CAAC,CAAC;SAC1D,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;SAC5C,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,iBAAiB,CAAC,IAA0B;IACnD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CACvC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,uBAAuB,CACxD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function updateCypressConfigsPresets(tree: Tree): Promise<void>;
3
+ export default updateCypressConfigsPresets;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCypressConfigsPresets = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
7
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
8
+ const cypress_version_1 = require("../../utils/cypress-version");
9
+ const find_target_options_1 = require("../../utils/find-target-options");
10
+ function updateCypressConfigsPresets(tree) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ if ((0, cypress_version_1.installedCypressVersion)() < 10) {
13
+ return;
14
+ }
15
+ const projectsWithoutDevServerTarget = new Set();
16
+ const updateTasks = [];
17
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, projectName, targetName, configName) => {
18
+ var _a, _b, _c, _d;
19
+ if (options.cypressConfig && tree.exists(options.cypressConfig)) {
20
+ updatePreset(tree, options, targetName);
21
+ }
22
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
23
+ const testingType = options.testingType ||
24
+ ((_b = (_a = projectConfig.targets[targetName]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.testingType);
25
+ const devServerTarget = options.devServerTarget ||
26
+ ((_d = (_c = projectConfig.targets[targetName]) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.devServerTarget);
27
+ if (!devServerTarget && testingType === 'component') {
28
+ updateTasks.push(addBuildTargetToConfig(tree, projectName, targetName, configName).then((didUpdate) => {
29
+ if (!didUpdate) {
30
+ projectsWithoutDevServerTarget.add(projectName);
31
+ }
32
+ }));
33
+ }
34
+ });
35
+ if (updateTasks.length > 0) {
36
+ cacheComponentTestTarget(tree);
37
+ }
38
+ yield Promise.all(updateTasks);
39
+ if (projectsWithoutDevServerTarget.size > 0) {
40
+ devkit_1.logger.warn(`Unable to find a build target to add to the component testing target in the following projects:`);
41
+ devkit_1.logger.warn(`- ${Array.from(projectsWithoutDevServerTarget).join('\n- ')}`);
42
+ devkit_1.logger.warn((0, devkit_1.stripIndents) `
43
+ You can manually add the 'devServerTarget' option to the
44
+ component testing target to specify the build target to use.
45
+ The build configuration should be using @nrwl/web:webpack as the executor.
46
+ Usually this is a React app in your workspace.
47
+ Component testing will fallback to a default configuration if one isn't provided,
48
+ but might require modifications if your projects are more complex.
49
+ `);
50
+ }
51
+ });
52
+ }
53
+ exports.updateCypressConfigsPresets = updateCypressConfigsPresets;
54
+ function updatePreset(tree, options, targetName) {
55
+ let contents = tsquery_1.tsquery.replace(tree.read(options.cypressConfig, 'utf-8'), 'CallExpression', (node) => {
56
+ // technically someone could have both component and e2e in the same project.
57
+ const expression = node.expression.getText();
58
+ if (expression === 'nxE2EPreset') {
59
+ return 'nxE2EPreset(__filename)';
60
+ }
61
+ else if (expression === 'nxE2EStorybookPreset') {
62
+ return 'nxE2EStorybookPreset(__filename)';
63
+ }
64
+ else if (node.expression.getText() === 'nxComponentTestingPreset') {
65
+ return targetName && targetName !== 'component-test' // the default
66
+ ? `nxComponentTestingPreset(__filename, { ctTargetName: '${targetName}' })`
67
+ : 'nxComponentTestingPreset(__filename)';
68
+ }
69
+ return;
70
+ });
71
+ tree.write(options.cypressConfig, contents);
72
+ }
73
+ function addBuildTargetToConfig(tree, projectName, targetName, configName) {
74
+ var _a, _b;
75
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
+ const projectWithBuild = yield (0, find_target_options_1.findBuildConfig)(tree, {
77
+ project: projectName,
78
+ validExecutorNames: new Set(['@nrwl/web:webpack']),
79
+ });
80
+ // didn't find the config so can't update. consumer should collect list of them and display a warning at the end
81
+ // no reason to fail since the preset will fallback to a default config so should still keep working.
82
+ if (!(projectWithBuild === null || projectWithBuild === void 0 ? void 0 : projectWithBuild.target) || !(projectWithBuild === null || projectWithBuild === void 0 ? void 0 : projectWithBuild.config)) {
83
+ return false;
84
+ }
85
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
86
+ // if using a custom config and the devServerTarget default args
87
+ // has a different target, then add it to the custom target config
88
+ // otherwise add it to the default options
89
+ if (configName &&
90
+ projectWithBuild.target !==
91
+ ((_b = (_a = projectConfig.targets[targetName]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.devServerTarget)) {
92
+ projectConfig.targets[targetName].configurations[configName] = Object.assign(Object.assign({}, projectConfig.targets[targetName].configurations[configName]), { devServerTarget: projectWithBuild.target, skipServe: true });
93
+ }
94
+ else {
95
+ projectConfig.targets[targetName].options = Object.assign(Object.assign({}, projectConfig.targets[targetName].options), { devServerTarget: projectWithBuild.target, skipServe: true });
96
+ }
97
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
98
+ return true;
99
+ });
100
+ }
101
+ function cacheComponentTestTarget(tree) {
102
+ (0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
103
+ var _a, _b, _c, _d, _e, _f, _g;
104
+ return (Object.assign(Object.assign({}, json), { tasksRunnerOptions: Object.assign(Object.assign({}, json.tasksRunnerOptions), { default: Object.assign(Object.assign({}, (_a = json.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a.default), { options: Object.assign(Object.assign({}, (_c = (_b = json.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) === null || _c === void 0 ? void 0 : _c.options), { cacheableOperations: Array.from(new Set([
105
+ ...((_g = (_f = (_e = (_d = json.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.cacheableOperations) !== null && _g !== void 0 ? _g : []),
106
+ 'component-test',
107
+ ])) }) }) }) }));
108
+ });
109
+ }
110
+ exports.default = updateCypressConfigsPresets;
111
+ //# sourceMappingURL=update-cypress-configs-presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-cypress-configs-presets.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-14-6-1/update-cypress-configs-presets.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,6FAA0F;AAC1F,uDAAoD;AAGpD,iEAAsE;AACtE,yEAAkE;AAElE,SAAsB,2BAA2B,CAAC,IAAU;;QAC1D,IAAI,IAAA,yCAAuB,GAAE,GAAG,EAAE,EAAE;YAClC,OAAO;SACR;QAED,MAAM,8BAA8B,GAAG,IAAI,GAAG,EAAU,CAAC;QACzD,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;;YAC/C,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBAC/D,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;aACzC;YAED,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CA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B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ export declare function updateCypressVersionIf10(tree: Tree): GeneratorCallback;
3
+ export default updateCypressVersionIf10;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCypressVersionIf10 = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ // don't import from root level to prevent issue where angular isn't installed.
6
+ const semver_1 = require("@nx/devkit/src/utils/semver");
7
+ const semver_2 = require("semver");
8
+ function updateCypressVersionIf10(tree) {
9
+ var _a;
10
+ const installedVersion = (_a = (0, devkit_1.readJson)(tree, 'package.json').devDependencies) === null || _a === void 0 ? void 0 : _a['cypress'];
11
+ if (!installedVersion) {
12
+ return;
13
+ }
14
+ const normalizedInstalledCypressVersion = (0, semver_1.checkAndCleanWithSemver)('cypress', installedVersion);
15
+ // not using v10
16
+ if ((0, semver_2.lt)(normalizedInstalledCypressVersion, '10.0.0') ||
17
+ (0, semver_2.gte)(normalizedInstalledCypressVersion, '11.0.0')) {
18
+ return;
19
+ }
20
+ const ngComponentTestingVersion = '10.7.0';
21
+ if ((0, semver_2.lt)(normalizedInstalledCypressVersion, ngComponentTestingVersion)) {
22
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
23
+ json.devDependencies['cypress'] = `^${ngComponentTestingVersion}`;
24
+ return json;
25
+ });
26
+ return () => {
27
+ (0, devkit_1.installPackagesTask)(tree);
28
+ };
29
+ }
30
+ }
31
+ exports.updateCypressVersionIf10 = updateCypressVersionIf10;
32
+ exports.default = updateCypressVersionIf10;
33
+ //# sourceMappingURL=update-cypress-version-if-10.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-cypress-version-if-10.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-14-7-0/update-cypress-version-if-10.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AACpB,+EAA+E;AAC/E,wDAAsE;AACtE,mCAAiC;AAEjC,SAAgB,wBAAwB,CAAC,IAAU;;IACjD,MAAM,gBAAgB,GAAG,MAAA,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC,eAAe,0CACrE,SAAS,CACV,CAAC;IAEF,IAAI,CAAC,gBAAgB,EAAE;QACrB,OAAO;KACR;IACD,MAAM,iCAAiC,GAAG,IAAA,gCAAuB,EAC/D,SAAS,EACT,gBAAgB,CACjB,CAAC;IAEF,gBAAgB;IAChB,IACE,IAAA,WAAE,EAAC,iCAAiC,EAAE,QAAQ,CAAC;QAC/C,IAAA,YAAG,EAAC,iCAAiC,EAAE,QAAQ,CAAC,EAChD;QACA,OAAO;KACR;IAED,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAE3C,IAAI,IAAA,WAAE,EAAC,iCAAiC,EAAE,yBAAyB,CAAC,EAAE;QACpE,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,IAAI,yBAAyB,EAAE,CAAC;YAClE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;KACH;AACH,CAAC;AAhCD,4DAgCC;AAED,kBAAe,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ function default_1(tree) {
7
+ var _a, _b, _c, _d;
8
+ var _e;
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const nxJson = (0, devkit_1.readNxJson)(tree);
11
+ const { cypressTargets, hasComponentTesting } = getCypressTargetNames(tree);
12
+ const hasProductionFileset = !!((_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.production);
13
+ if (hasComponentTesting && hasProductionFileset && cypressTargets.size > 0) {
14
+ const productionFileset = new Set(nxJson.namedInputs.production);
15
+ for (const exclusion of [
16
+ '!{projectRoot}/cypress/**/*',
17
+ '!{projectRoot}/**/*.cy.[jt]s?(x)',
18
+ '!{projectRoot}/cypress.config.[jt]s',
19
+ ]) {
20
+ productionFileset.add(exclusion);
21
+ }
22
+ nxJson.namedInputs.production = Array.from(productionFileset);
23
+ }
24
+ for (const targetName of cypressTargets) {
25
+ (_b = nxJson.targetDefaults) !== null && _b !== void 0 ? _b : (nxJson.targetDefaults = {});
26
+ const cypressTargetDefaults = ((_c = (_e = nxJson.targetDefaults)[targetName]) !== null && _c !== void 0 ? _c : (_e[targetName] = {}));
27
+ (_d = cypressTargetDefaults.inputs) !== null && _d !== void 0 ? _d : (cypressTargetDefaults.inputs = [
28
+ 'default',
29
+ hasProductionFileset ? '^production' : '^default',
30
+ ]);
31
+ }
32
+ (0, devkit_1.updateNxJson)(tree, nxJson);
33
+ yield (0, devkit_1.formatFiles)(tree);
34
+ });
35
+ }
36
+ exports.default = default_1;
37
+ function getCypressTargetNames(tree) {
38
+ const cypressTargets = new Set();
39
+ let hasComponentTesting = false;
40
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, __, target) => {
41
+ cypressTargets.add(target);
42
+ if (options.testingType === 'component') {
43
+ hasComponentTesting = true;
44
+ }
45
+ });
46
+ return { cypressTargets, hasComponentTesting };
47
+ }
48
+ //# sourceMappingURL=add-cypress-inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-cypress-inputs.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-15-0-0/add-cypress-inputs.ts"],"names":[],"mappings":";;;AAAA,uCAAyE;AACzE,6FAA0F;AAG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I,GAAG,EAAU,CAAC;IACzC,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAChC,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QACtB,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,OAAO,CAAC,WAAW,KAAK,WAAW,EAAE;YACvC,mBAAmB,GAAG,IAAI,CAAC;SAC5B;IACH,CAAC,CACF,CAAC;IACF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function updateCyMountUsage(tree: Tree): Promise<void>;
3
+ export declare function addMountCommand(tree: Tree, projectRoot: string, framework: string): void;
4
+ export declare function updateCyFile(tree: Tree, filePath: string, framework: 'angular' | 'react' | 'react18'): void;
5
+ export default updateCyMountUsage;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCyFile = exports.addMountCommand = exports.updateCyMountUsage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ct_helpers_1 = require("../../utils/ct-helpers");
6
+ const cypress_version_1 = require("../../utils/cypress-version");
7
+ const devkit_1 = require("@nx/devkit");
8
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
9
+ const semver_1 = require("@nx/devkit/src/utils/semver");
10
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
11
+ const semver_2 = require("semver");
12
+ function updateCyMountUsage(tree) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ if ((0, cypress_version_1.installedCypressVersion)() < 10) {
15
+ return;
16
+ }
17
+ const projects = (0, devkit_1.getProjects)(tree);
18
+ const graph = yield (0, devkit_1.createProjectGraphAsync)();
19
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, projectName) => {
20
+ if (options.testingType !== 'component' || !options.devServerTarget) {
21
+ return;
22
+ }
23
+ const parsed = (0, devkit_1.parseTargetString)(options.devServerTarget, graph);
24
+ if (!(parsed === null || parsed === void 0 ? void 0 : parsed.project) || !(parsed === null || parsed === void 0 ? void 0 : parsed.target)) {
25
+ return;
26
+ }
27
+ const buildProjectConfig = projects.get(parsed.project);
28
+ const framework = getFramework(tree, parsed.configuration
29
+ ? buildProjectConfig.targets[parsed.target].configurations[parsed.configuration]
30
+ : buildProjectConfig.targets[parsed.target]);
31
+ const ctProjectConfig = projects.get(projectName);
32
+ addMountCommand(tree, ctProjectConfig.root, framework);
33
+ (0, devkit_1.visitNotIgnoredFiles)(tree, ctProjectConfig.sourceRoot, (filePath) => {
34
+ if (ct_helpers_1.CY_FILE_MATCHER.test(filePath)) {
35
+ updateCyFile(tree, filePath, framework);
36
+ }
37
+ });
38
+ });
39
+ yield (0, devkit_1.formatFiles)(tree);
40
+ });
41
+ }
42
+ exports.updateCyMountUsage = updateCyMountUsage;
43
+ function addMountCommand(tree, projectRoot, framework) {
44
+ const commandFilePath = (0, devkit_1.joinPathFragments)(projectRoot, 'cypress', 'support', 'commands.ts');
45
+ if (!tree.exists(commandFilePath)) {
46
+ return;
47
+ }
48
+ const commandFile = tree.read(commandFilePath, 'utf-8');
49
+ const mountCommand = tsquery_1.tsquery.query(commandFile, 'CallExpression:has(StringLiteral[value="mount"]) PropertyAccessExpression:has(Identifier[name="add"])');
50
+ if ((mountCommand === null || mountCommand === void 0 ? void 0 : mountCommand.length) > 0) {
51
+ return;
52
+ }
53
+ const existingCommands = tsquery_1.tsquery.query(commandFile, 'InterfaceDeclaration:has(Identifier[name="Chainable"]) > MethodSignature, InterfaceDeclaration:has(Identifier[name="Chainable"]) > PropertySignature');
54
+ const isGlobalDeclaration = tsquery_1.tsquery.query(commandFile, 'ModuleDeclaration > Identifier[name="global"]');
55
+ const updatedInterface = tsquery_1.tsquery.replace(commandFile, 'ModuleDeclaration:has(Identifier[name="Cypress"])', (node) => {
56
+ const newModuleDelcaration = `declare global {
57
+ // eslint-disable-next-line @typescript-eslint/no-namespace
58
+ namespace Cypress {
59
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
+ interface Chainable<Subject> {
61
+ ${existingCommands.map((c) => c.getText()).join('\n')}
62
+ mount: typeof mount;
63
+ }
64
+ }
65
+ }`;
66
+ /*
67
+ * this is to prevent the change being applied twice since
68
+ * declare global { 1
69
+ * interface Cypress { 2
70
+ * }
71
+ * }
72
+ * matches twice.
73
+ * i.e. if there is no global declaration, then add it
74
+ * or if the node is the global declaration, then add it,
75
+ * but not to the cypress module declaration inside the global declaration
76
+ */
77
+ if ((isGlobalDeclaration === null || isGlobalDeclaration === void 0 ? void 0 : isGlobalDeclaration.length) === 0 ||
78
+ node.name.getText() === 'global') {
79
+ return newModuleDelcaration;
80
+ }
81
+ });
82
+ const updatedCommandFile = `import { mount } from 'cypress/${framework}'\n${updatedInterface}\nCypress.Commands.add('mount', mount);`;
83
+ tree.write(commandFilePath, updatedCommandFile);
84
+ }
85
+ exports.addMountCommand = addMountCommand;
86
+ function getFramework(tree, target) {
87
+ var _a;
88
+ if (target.executor === '@nrwl/angular:webpack-browser' ||
89
+ target.executor === '@angular-devkit/build-angular:browser') {
90
+ return 'angular';
91
+ }
92
+ const pkgJson = (0, devkit_1.readJson)(tree, 'package.json');
93
+ const reactDomVersion = (_a = pkgJson === null || pkgJson === void 0 ? void 0 : pkgJson.dependencies) === null || _a === void 0 ? void 0 : _a['react-dom'];
94
+ const hasReact18 = reactDomVersion &&
95
+ (0, semver_2.gte)((0, semver_1.checkAndCleanWithSemver)('react-dom', reactDomVersion), '18.0.0');
96
+ if (hasReact18) {
97
+ return 'react18';
98
+ }
99
+ return 'react';
100
+ }
101
+ function updateCyFile(tree, filePath, framework) {
102
+ if (!tree.exists(filePath)) {
103
+ return;
104
+ }
105
+ const contents = tree.read(filePath, 'utf-8');
106
+ const withCyMount = tsquery_1.tsquery.replace(contents, ':matches(CallExpression>Identifier[name="mount"])', (node) => {
107
+ return `cy.mount`;
108
+ });
109
+ const withUpdatedImports = tsquery_1.tsquery.replace(withCyMount, ':matches(ImportDeclaration, VariableStatement):has(Identifier[name="mount"]):has(StringLiteral[value="cypress/react"], StringLiteral[value="cypress/angular"], StringLiteral[value="cypress/react18"])', (node) => {
110
+ switch (framework) {
111
+ case 'angular':
112
+ return `import { MountConfig } from 'cypress/angular';`;
113
+ case 'react18':
114
+ case 'react':
115
+ return ' '; // have to return non falsy string to remove the node
116
+ default:
117
+ return node.getText().replace('mount', '');
118
+ }
119
+ });
120
+ tree.write(filePath, withUpdatedImports);
121
+ }
122
+ exports.updateCyFile = updateCyFile;
123
+ exports.default = updateCyMountUsage;
124
+ //# sourceMappingURL=update-cy-mount-usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-cy-mount-usage.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-15-0-0/update-cy-mount-usage.ts"],"names":[],"mappings":";;;;AACA,uDAAyD;AACzD,iEAAsE;AACtE,uCAUoB;AACpB,6FAA0F;AAC1F,wDAAsE;AACtE,uDAAoD;AACpD,mCAA6B;AAG7B,SAAsB,kBAAkB,CAAC,IAAU;;QACjD,IAAI,IAAA,yCAAuB,GAAE,GAAG,EAAE,EAAE;YAClC,OAAO;SACR;QAED,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,IAAA,gCAAuB,GAAE,CAAC;QAE9C,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE;YACvB,IAAI,OAAO,CAAC,WAAW,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;gBACnE,OAAO;aACR;YAED,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;YACjE,IAAI,C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,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function updateToCypress11(tree: Tree): Promise<() => void>;
3
+ export declare function updateMountHookUsage(tree: Tree, filePath: string): void;
4
+ export declare function updateUnmountUsage(tree: Tree, filePath: string): void;
5
+ export declare function updateProviderUsage(tree: Tree, filePath: string): void;
6
+ export default updateToCypress11;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateProviderUsage = exports.updateUnmountUsage = exports.updateMountHookUsage = exports.updateToCypress11 = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ct_helpers_1 = require("../../utils/ct-helpers");
6
+ const devkit_1 = require("@nx/devkit");
7
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
8
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
9
+ const path_1 = require("path");
10
+ const ts = require("typescript");
11
+ const cypress_version_1 = require("../../utils/cypress-version");
12
+ const versions_1 = require("../../utils/versions");
13
+ function updateToCypress11(tree) {
14
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+ const installedVersion = (0, cypress_version_1.installedCypressVersion)();
16
+ if (installedVersion < 10) {
17
+ return;
18
+ }
19
+ const projects = (0, devkit_1.getProjects)(tree);
20
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, projectName, targetName, configurationName) => {
21
+ if (options.testingType !== 'component' ||
22
+ !(options.cypressConfig && tree.exists(options.cypressConfig))) {
23
+ return;
24
+ }
25
+ const projectConfig = projects.get(projectName);
26
+ const commandsFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'commands.ts');
27
+ const framework = getFramework(tree.exists(commandsFile)
28
+ ? tree.read(commandsFile, 'utf-8')
29
+ : tree.read(options.cypressConfig, 'utf-8'));
30
+ (0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.sourceRoot, (filePath) => {
31
+ if (!ct_helpers_1.CY_FILE_MATCHER.test(filePath)) {
32
+ return;
33
+ }
34
+ const frameworkFromFile = getFramework(tree.read(filePath, 'utf-8'));
35
+ if (framework === 'react' || frameworkFromFile === 'react') {
36
+ updateUnmountUsage(tree, filePath);
37
+ updateMountHookUsage(tree, filePath);
38
+ }
39
+ if (framework === 'angular' || frameworkFromFile === 'angular') {
40
+ updateProviderUsage(tree, filePath);
41
+ }
42
+ });
43
+ });
44
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { cypress: versions_1.cypressVersion });
45
+ yield (0, devkit_1.formatFiles)(tree);
46
+ return () => {
47
+ installTask();
48
+ };
49
+ });
50
+ }
51
+ exports.updateToCypress11 = updateToCypress11;
52
+ function updateMountHookUsage(tree, filePath) {
53
+ const originalContents = tree.read(filePath, 'utf-8');
54
+ const commentedMountHook = tsquery_1.tsquery.replace(originalContents, ':matches(ImportDeclaration, VariableStatement):has(Identifier[name="mountHook"]):has(StringLiteral[value="cypress/react"], StringLiteral[value="cypress/react18"])', (node) => {
55
+ return `/** TODO: mountHook is deprecate.
56
+ * Use a wrapper component instead.
57
+ * See post for details: https://www.cypress.io/blog/2022/11/04/upcoming-changes-to-component-testing/#reactmounthook-removed
58
+ * */\n${node.getText()}`;
59
+ });
60
+ tree.write(filePath, commentedMountHook);
61
+ }
62
+ exports.updateMountHookUsage = updateMountHookUsage;
63
+ function updateUnmountUsage(tree, filePath) {
64
+ const reactDomImport = (0, path_1.extname)(filePath).includes('ts')
65
+ ? `import ReactDom from 'react-dom'`
66
+ : `const ReactDom = require('react-dom')`;
67
+ const originalContents = tree.read(filePath, 'utf-8');
68
+ const updatedImports = tsquery_1.tsquery.replace(originalContents, ':matches(ImportDeclaration, VariableStatement):has(Identifier[name="unmount"]):has(StringLiteral[value="cypress/react"], StringLiteral[value="cypress/react18"])', (node) => {
69
+ return `${node.getText().replace('unmount', 'getContainerEl')}
70
+ ${reactDomImport}`;
71
+ });
72
+ const updatedUnmountApi = tsquery_1.tsquery.replace(updatedImports, 'ExpressionStatement > CallExpression:has(Identifier[name="unmount"])', (node) => {
73
+ if (node.expression.getText() === 'unmount') {
74
+ return `cy.then(() => ReactDom.unmountComponentAtNode(getContainerEl()))`;
75
+ }
76
+ });
77
+ tree.write(filePath, updatedUnmountApi);
78
+ }
79
+ exports.updateUnmountUsage = updateUnmountUsage;
80
+ function updateProviderUsage(tree, filePath) {
81
+ var _a;
82
+ const originalContents = tree.read(filePath, 'utf-8');
83
+ const isTestBedImported = ((_a = tsquery_1.tsquery.query(originalContents, ':matches(ImportDeclaration, VariableStatement):has(Identifier[name="TestBed"]):has(StringLiteral[value="@angular/core/testing"])')) === null || _a === void 0 ? void 0 : _a.length) > 0;
84
+ let updatedProviders = tsquery_1.tsquery.replace(originalContents, 'CallExpression:has(PropertyAccessExpression:has(Identifier[name="mount"]))', (node) => {
85
+ var _a, _b, _c, _d;
86
+ const expressionName = node.expression.getText();
87
+ if (expressionName === 'cy.mount' && ((_a = node === null || node === void 0 ? void 0 : node.arguments) === null || _a === void 0 ? void 0 : _a.length) > 1) {
88
+ const component = node.arguments[0].getText();
89
+ if (ts.isObjectLiteralExpression(node.arguments[1])) {
90
+ const providers = (_d = (_c = (_b = node.arguments[1]) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.find((p) => { var _a; return ((_a = p.name) === null || _a === void 0 ? void 0 : _a.getText()) === 'providers'; })) === null || _d === void 0 ? void 0 : _d.getText();
91
+ const noProviders = tsquery_1.tsquery.replace(node.getText(), 'PropertyAssignment:has(Identifier[name="providers"])', (n) => {
92
+ // set it to undefined so we don't run into a hanging comma causing invalid syntax
93
+ return 'providers: undefined';
94
+ });
95
+ return `TestBed.overrideComponent(${component}, { add: { ${providers} }});\n${noProviders}`;
96
+ }
97
+ else {
98
+ return `TestBed.overrideComponent(${component}, {add: { providers: ${node.arguments[1].getText()}.providers}});\n${node.getText()}`;
99
+ }
100
+ }
101
+ });
102
+ tree.write(filePath, `${isTestBedImported
103
+ ? ''
104
+ : "import {TestBed} from '@angular/core/testing';\n"}${updatedProviders}`);
105
+ }
106
+ exports.updateProviderUsage = updateProviderUsage;
107
+ function getFramework(contents) {
108
+ if (contents.includes('cypress/react') || contents.includes('@nrwl/react')) {
109
+ return 'react';
110
+ }
111
+ if (contents.includes('cypress/angular') ||
112
+ contents.includes('@nrwl/angular')) {
113
+ return 'angular';
114
+ }
115
+ return null;
116
+ }
117
+ exports.default = updateToCypress11;
118
+ //# sourceMappingURL=cypress-11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress-11.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/migrations/update-15-1-0/cypress-11.ts"],"names":[],"mappings":";;;;AAAA,uDAAyD;AACzD,uCAOoB;AACpB,6FAA0F;AAC1F,uDAAoD;AACpD,+BAA+B;AAC/B,iCAAiC;AAEjC,iEAAsE;AACtE,mDAAsD;AAEtD,SAAsB,iBAAiB,CAAC,IAAU;;QAChD,MAAM,gBAAgB,GAAG,IAAA,yCAAuB,GAAE,CAAC;QACnD,IAAI,gBAAgB,GAAG,EAAE,EAAE;YACzB,OAAO;SACR;QAED,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE;YACtD,IACE,OAAO,CAAC,WAAW,KAAK,WAAW;gBACnC,CAAC,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAC9D;gBACA,OAAO;aACR;YACD,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAChD,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,aAAa,CAAC,IAAI,EAClB,SAAS,EACT,SAAS,EACT,aAAa,CACd,CAAC;YACF,MAAM,SAAS,GAAG,YAAY,CAC5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ACH,CAAC,CACF,CAAC;IACF,IAAI,CAAC,KAAK,CACR,QAAQ,EACR,GACE,iBAAiB;QACf,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kDACN,GAAG,gBAAgB,EAAE,CACtB,CAAC;AACJ,CAAC;AA3CD,kDA2CC;AAED,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QAC1E,OAAO,OAAO,CAAC;KAChB;IACD,IACE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACpC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAClC;QACA,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Node } from 'typescript';
2
+ export declare function isAlreadyCommented(node: Node): boolean;
3
+ export declare const BANNED_COMMANDS: string[];