@nrwl/cypress 14.4.3 → 14.5.0-beta.2

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 (55) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/generators.json +22 -0
  3. package/index.d.ts +2 -0
  4. package/index.js +5 -1
  5. package/index.js.map +1 -1
  6. package/package.json +9 -8
  7. package/plugins/cypress-preset.d.ts +34 -0
  8. package/plugins/cypress-preset.js +39 -0
  9. package/plugins/cypress-preset.js.map +1 -0
  10. package/src/executors/cypress/cypress.impl.d.ts +1 -1
  11. package/src/executors/cypress/cypress.impl.js +11 -1
  12. package/src/executors/cypress/cypress.impl.js.map +1 -1
  13. package/src/generators/cypress-component-project/cypress-component-project.d.ts +3 -0
  14. package/src/generators/cypress-component-project/cypress-component-project.js +48 -0
  15. package/src/generators/cypress-component-project/cypress-component-project.js.map +1 -0
  16. package/src/generators/cypress-component-project/files/cypress/fixtures/example.json +5 -0
  17. package/src/generators/cypress-component-project/files/cypress/support/commands.ts__ext__ +33 -0
  18. package/src/generators/cypress-component-project/files/cypress/support/component-index.html +13 -0
  19. package/src/generators/cypress-component-project/files/cypress/support/component.ts__ext__ +17 -0
  20. package/src/generators/cypress-component-project/files/cypress.config.ts__ext__ +3 -0
  21. package/src/generators/cypress-component-project/files/tsconfig.cy.json +16 -0
  22. package/src/generators/cypress-component-project/schema.d.ts +4 -0
  23. package/src/generators/cypress-component-project/schema.json +25 -0
  24. package/src/generators/cypress-project/cypress-project.js +20 -11
  25. package/src/generators/cypress-project/cypress-project.js.map +1 -1
  26. package/src/generators/cypress-project/files/v10-and-after/cypress.config.ts__tmpl__ +6 -0
  27. package/src/generators/cypress-project/files/{src/integration/app.spec.ts__tmpl__ → v10-and-after/src/e2e/app.cy.ts__tmpl__} +0 -0
  28. package/src/generators/cypress-project/files/{src → v10-and-after/src}/fixtures/example.json__tmpl__ +0 -0
  29. package/src/generators/cypress-project/files/{src → v10-and-after/src}/support/app.po.ts__tmpl__ +0 -0
  30. package/src/generators/cypress-project/files/{src → v10-and-after/src}/support/commands.ts__tmpl__ +0 -0
  31. package/src/generators/cypress-project/files/{src/support/index.ts__tmpl__ → v10-and-after/src/support/e2e.ts__tmpl__} +0 -0
  32. package/src/generators/cypress-project/files/v10-and-after/tsconfig.json +10 -0
  33. package/src/generators/cypress-project/files/{cypress.json → v9-and-under/cypress.json} +0 -0
  34. package/src/generators/cypress-project/files/v9-and-under/src/fixtures/example.json__tmpl__ +4 -0
  35. package/src/generators/cypress-project/files/v9-and-under/src/integration/app.spec.ts__tmpl__ +13 -0
  36. package/src/generators/cypress-project/files/{src → v9-and-under/src}/plugins/index.js +0 -0
  37. package/src/generators/cypress-project/files/v9-and-under/src/support/app.po.ts__tmpl__ +1 -0
  38. package/src/generators/cypress-project/files/v9-and-under/src/support/commands.ts__tmpl__ +33 -0
  39. package/src/generators/cypress-project/files/v9-and-under/src/support/index.ts__tmpl__ +17 -0
  40. package/src/generators/cypress-project/files/{tsconfig.json → v9-and-under/tsconfig.json} +1 -1
  41. package/src/generators/migrate-to-cypress-ten/conversion.util.d.ts +27 -0
  42. package/src/generators/migrate-to-cypress-ten/conversion.util.js +204 -0
  43. package/src/generators/migrate-to-cypress-ten/conversion.util.js.map +1 -0
  44. package/src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten.d.ts +3 -0
  45. package/src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten.js +57 -0
  46. package/src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten.js.map +1 -0
  47. package/src/generators/migrate-to-cypress-ten/schema.json +15 -0
  48. package/src/plugins/preprocessor.js +0 -1
  49. package/src/plugins/preprocessor.js.map +1 -1
  50. package/src/utils/cypress-version.d.ts +4 -0
  51. package/src/utils/cypress-version.js +11 -1
  52. package/src/utils/cypress-version.js.map +1 -1
  53. package/src/utils/versions.d.ts +3 -1
  54. package/src/utils/versions.js +4 -2
  55. package/src/utils/versions.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [14.4.3](https://github.com/nrwl/nx/compare/14.4.2...14.4.3) (2022-07-16)
6
+ # [14.5.0-beta.2](https://github.com/nrwl/nx/compare/14.4.2...14.5.0-beta.2) (2022-07-18)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/cypress
package/generators.json CHANGED
@@ -13,6 +13,16 @@
13
13
  "factory": "./src/generators/cypress-project/cypress-project#cypressProjectSchematic",
14
14
  "schema": "./src/generators/cypress-project/schema.json",
15
15
  "description": "Add a Cypress E2E Project."
16
+ },
17
+ "cypress-component-project": {
18
+ "factory": "./src/generators/cypress-component-project/cypress-component-project#cypressComponentProject",
19
+ "schema": "./src/generators/cypress-component-project/schema.json",
20
+ "description": "Set up Cypress Component Test for a project"
21
+ },
22
+ "migrate-to-cypress-10": {
23
+ "factory": "./src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten#migrateCypressProject",
24
+ "schema": "./src/generators/migrate-to-cypress-ten/schema.json",
25
+ "description": "Migrate existing Cypress e2e projects to Cypress v10"
16
26
  }
17
27
  },
18
28
  "generators": {
@@ -28,6 +38,18 @@
28
38
  "schema": "./src/generators/cypress-project/schema.json",
29
39
  "description": "Add a Cypress E2E Project.",
30
40
  "hidden": true
41
+ },
42
+ "cypress-component-project": {
43
+ "factory": "./src/generators/cypress-component-project/cypress-component-project#cypressComponentProject",
44
+ "schema": "./src/generators/cypress-component-project/schema.json",
45
+ "description": "Set up Cypress Component Test for a project",
46
+ "hidden": true
47
+ },
48
+ "migrate-to-cypress-10": {
49
+ "factory": "./src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten#migrateCypressProject",
50
+ "schema": "./src/generators/migrate-to-cypress-ten/schema.json",
51
+ "description": "Migrate existing Cypress e2e projects to Cypress v10",
52
+ "hidden": true
31
53
  }
32
54
  }
33
55
  }
package/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { cypressProjectGenerator } from './src/generators/cypress-project/cypress-project';
2
2
  export { cypressInitGenerator } from './src/generators/init/init';
3
3
  export { conversionGenerator } from './src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint';
4
+ export { cypressComponentProject } from './src/generators/cypress-component-project/cypress-component-project';
5
+ export { migrateCypressProject } from './src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten';
package/index.js CHANGED
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.conversionGenerator = exports.cypressInitGenerator = exports.cypressProjectGenerator = void 0;
3
+ exports.migrateCypressProject = exports.cypressComponentProject = exports.conversionGenerator = exports.cypressInitGenerator = exports.cypressProjectGenerator = void 0;
4
4
  var cypress_project_1 = require("./src/generators/cypress-project/cypress-project");
5
5
  Object.defineProperty(exports, "cypressProjectGenerator", { enumerable: true, get: function () { return cypress_project_1.cypressProjectGenerator; } });
6
6
  var init_1 = require("./src/generators/init/init");
7
7
  Object.defineProperty(exports, "cypressInitGenerator", { enumerable: true, get: function () { return init_1.cypressInitGenerator; } });
8
8
  var convert_tslint_to_eslint_1 = require("./src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint");
9
9
  Object.defineProperty(exports, "conversionGenerator", { enumerable: true, get: function () { return convert_tslint_to_eslint_1.conversionGenerator; } });
10
+ var cypress_component_project_1 = require("./src/generators/cypress-component-project/cypress-component-project");
11
+ Object.defineProperty(exports, "cypressComponentProject", { enumerable: true, get: function () { return cypress_component_project_1.cypressComponentProject; } });
12
+ var migrate_to_cypress_ten_1 = require("./src/generators/migrate-to-cypress-ten/migrate-to-cypress-ten");
13
+ Object.defineProperty(exports, "migrateCypressProject", { enumerable: true, get: function () { return migrate_to_cypress_ten_1.migrateCypressProject; } });
10
14
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/cypress/index.ts"],"names":[],"mappings":";;;AAAA,oFAA2F;AAAlF,0HAAA,uBAAuB,OAAA;AAChC,mDAAkE;AAAzD,4GAAA,oBAAoB,OAAA;AAC7B,+GAAyG;AAAhG,+HAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/cypress/index.ts"],"names":[],"mappings":";;;AAAA,oFAA2F;AAAlF,0HAAA,uBAAuB,OAAA;AAChC,mDAAkE;AAAzD,4GAAA,oBAAoB,OAAA;AAC7B,+GAAyG;AAAhG,+HAAA,mBAAmB,OAAA;AAC5B,kHAA+G;AAAtG,oIAAA,uBAAuB,OAAA;AAChC,yGAAuG;AAA9F,+HAAA,qBAAqB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/cypress",
3
- "version": "14.4.3",
3
+ "version": "14.5.0-beta.2",
4
4
  "description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,15 +35,16 @@
35
35
  "dependencies": {
36
36
  "@babel/core": "^7.0.1",
37
37
  "@babel/preset-env": "^7.0.0",
38
- "@cypress/webpack-preprocessor": "^5.9.1",
39
- "@nrwl/devkit": "14.4.3",
40
- "@nrwl/linter": "14.4.3",
41
- "@nrwl/workspace": "14.4.3",
38
+ "@cypress/webpack-preprocessor": "^5.12.0",
39
+ "@nrwl/devkit": "14.5.0-beta.2",
40
+ "@nrwl/linter": "14.5.0-beta.2",
41
+ "@nrwl/workspace": "14.5.0-beta.2",
42
+ "@phenomnomnominal/tsquery": "4.1.1",
42
43
  "babel-loader": "^8.0.2",
43
44
  "chalk": "4.1.0",
44
45
  "dotenv": "~10.0.0",
45
46
  "enhanced-resolve": "^5.8.3",
46
- "fork-ts-checker-webpack-plugin": "6.2.10",
47
+ "fork-ts-checker-webpack-plugin": "7.2.13",
47
48
  "rxjs": "^6.5.4",
48
49
  "ts-loader": "^9.2.6",
49
50
  "tsconfig-paths": "^3.9.0",
@@ -53,12 +54,12 @@
53
54
  "webpack-node-externals": "^3.0.0"
54
55
  },
55
56
  "peerDependencies": {
56
- "cypress": ">= 3 < 10"
57
+ "cypress": ">= 3 < 11"
57
58
  },
58
59
  "peerDependenciesMeta": {
59
60
  "cypress": {
60
61
  "optional": true
61
62
  }
62
63
  },
63
- "gitHead": "9f7df39875d04baa2e8b8f8f12796dea6b38752a"
64
+ "gitHead": "38a2d95d9d654c89f58ed6700ec7b6cc01ddf74b"
64
65
  }
@@ -0,0 +1,34 @@
1
+ interface BaseCypressPreset {
2
+ videosFolder: string;
3
+ screenshotsFolder: string;
4
+ video: boolean;
5
+ chromeWebSecurity: boolean;
6
+ }
7
+ export declare function nxBaseCypressPreset(pathToConfig: string): BaseCypressPreset;
8
+ /**
9
+ * nx E2E Preset for Cypress
10
+ * @description
11
+ * this preset contains the base configuration
12
+ * for your e2e tests that nx recommends.
13
+ * you can easily extend this within your cypress config via spreading the preset
14
+ * @example
15
+ * export default defineConfig({
16
+ * e2e: {
17
+ * ...nxE2EPreset(__dirname)
18
+ * // add your own config here
19
+ * }
20
+ * })
21
+ *
22
+ * @param pathToConfig will be used to construct the output paths for videos and screenshots
23
+ */
24
+ export declare function nxE2EPreset(pathToConfig: string): {
25
+ fileServerFolder: string;
26
+ supportFile: string;
27
+ specPattern: string;
28
+ fixturesFolder: string;
29
+ videosFolder: string;
30
+ screenshotsFolder: string;
31
+ video: boolean;
32
+ chromeWebSecurity: boolean;
33
+ };
34
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nxE2EPreset = exports.nxBaseCypressPreset = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const path_1 = require("path");
6
+ function nxBaseCypressPreset(pathToConfig) {
7
+ const projectPath = (0, path_1.relative)(devkit_1.workspaceRoot, pathToConfig);
8
+ const offset = (0, path_1.relative)(pathToConfig, devkit_1.workspaceRoot);
9
+ const videosFolder = (0, path_1.join)(offset, 'dist', 'cypress', projectPath, 'videos');
10
+ const screenshotsFolder = (0, path_1.join)(offset, 'dist', 'cypress', projectPath, 'screenshots');
11
+ return {
12
+ videosFolder,
13
+ screenshotsFolder,
14
+ video: true,
15
+ chromeWebSecurity: false,
16
+ };
17
+ }
18
+ exports.nxBaseCypressPreset = nxBaseCypressPreset;
19
+ /**
20
+ * nx E2E Preset for Cypress
21
+ * @description
22
+ * this preset contains the base configuration
23
+ * for your e2e tests that nx recommends.
24
+ * you can easily extend this within your cypress config via spreading the preset
25
+ * @example
26
+ * export default defineConfig({
27
+ * e2e: {
28
+ * ...nxE2EPreset(__dirname)
29
+ * // add your own config here
30
+ * }
31
+ * })
32
+ *
33
+ * @param pathToConfig will be used to construct the output paths for videos and screenshots
34
+ */
35
+ function nxE2EPreset(pathToConfig) {
36
+ return Object.assign(Object.assign({}, nxBaseCypressPreset(pathToConfig)), { fileServerFolder: '.', supportFile: 'src/support/e2e.ts', specPattern: 'src/**/*.cy.{js,jsx,ts,tsx}', fixturesFolder: 'src/fixtures' });
37
+ }
38
+ exports.nxE2EPreset = nxE2EPreset;
39
+ //# sourceMappingURL=cypress-preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress-preset.js","sourceRoot":"","sources":["../../../../packages/cypress/plugins/cypress-preset.ts"],"names":[],"mappings":";;;AAAA,yCAA6C;AAC7C,+BAAsC;AAStC,SAAgB,mBAAmB,CAAC,YAAoB;IACtD,MAAM,WAAW,GAAG,IAAA,eAAQ,EAAC,sBAAa,EAAE,YAAY,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,YAAY,EAAE,sBAAa,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC5E,MAAM,iBAAiB,GAAG,IAAA,WAAI,EAC5B,MAAM,EACN,MAAM,EACN,SAAS,EACT,WAAW,EACX,aAAa,CACd,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,iBAAiB;QACjB,KAAK,EAAE,IAAI;QACX,iBAAiB,EAAE,KAAK;KACzB,CAAC;AACJ,CAAC;AAlBD,kDAkBC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,WAAW,CAAC,YAAoB;IAC9C,uCACK,mBAAmB,CAAC,YAAY,CAAC,KACpC,gBAAgB,EAAE,GAAG,EACrB,WAAW,EAAE,oBAAoB,EACjC,WAAW,EAAE,6BAA6B,EAC1C,cAAc,EAAE,cAAc,IAC9B;AACJ,CAAC;AARD,kCAQC"}
@@ -1,5 +1,5 @@
1
- import 'dotenv/config';
2
1
  import { ExecutorContext } from '@nrwl/devkit';
2
+ import 'dotenv/config';
3
3
  export declare type Json = {
4
4
  [k: string]: any;
5
5
  };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
4
5
  require("dotenv/config");
5
6
  const path_1 = require("path");
6
7
  const cypress_version_1 = require("../../utils/cypress-version");
7
- const devkit_1 = require("@nrwl/devkit");
8
8
  const Cypress = require('cypress'); // @NOTE: Importing via ES6 messes the whole test dependencies.
9
9
  function cypressExecutor(options, context) {
10
10
  var e_1, _a;
@@ -47,6 +47,7 @@ function normalizeOptions(options, context) {
47
47
  }
48
48
  checkSupportedBrowser(options);
49
49
  warnDeprecatedHeadless(options);
50
+ warnDeprecatedCypressVersion();
50
51
  return options;
51
52
  }
52
53
  function checkSupportedBrowser({ browser }) {
@@ -85,6 +86,15 @@ function warnDeprecatedHeadless({ headless }) {
85
86
  devkit_1.logger.warn(deprecatedMsg);
86
87
  }
87
88
  }
89
+ function warnDeprecatedCypressVersion() {
90
+ if ((0, cypress_version_1.installedCypressVersion)() < 10) {
91
+ devkit_1.logger.warn((0, devkit_1.stripIndents) `
92
+ NOTE:
93
+ Support for Cypress versions < 10 is deprecated. Please upgrade to at least Cypress version 10.
94
+ A generator to migrate from v8 to v10 is provided. See https://nx.dev/cypress/v10-migration-guide
95
+ `);
96
+ }
97
+ }
88
98
  function startDevServer(opts, context) {
89
99
  return tslib_1.__asyncGenerator(this, arguments, function* startDevServer_1() {
90
100
  var e_2, _a;
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/executors/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,+BAA+C;AAC/C,iEAAsE;AACtE,yCAOsB;AAEtB,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,+DAA+D;AA8BnG,SAA8B,eAAe,CAC3C,OAA+B,EAC/B,OAAwB;;;QAExB,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAE7C,IAAI,OAAO,CAAC;;YACZ,KAA4B,IAAA,KAAA,sBAAA,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,IAAA;gBAAjD,MAAM,OAAO,WAAA,CAAA;gBACtB,IAAI;oBACF,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBAC7C,IAAI,CAAC,OAAO,CAAC,KAAK;wBAAE,MAAM;iBAC3B;gBAAC,OAAO,CAAC,EAAE;oBACV,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;oBACxB,OAAO,GAAG,KAAK,CAAC;oBAChB,IAAI,CAAC,OAAO,CAAC,KAAK;wBAAE,MAAM;iBAC3B;aACF;;;;;;;;;QAED,OAAO,EAAE,OAAO,EAAE,CAAC;;CACpB;AAnBD,kCAmBC;AAED,SAAS,gBAAgB,CACvB,OAA+B,EAC/B,OAAwB;IAExB,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,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AAG,MAAA,IAAI,CAAC,SAAS,0CAAE,QAAQ,EAAE,CAAC;QAC/C,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3B,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE/C,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SAClC;QAED,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;SAChD;QAED,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEvC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK;YAC9B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAE1B;;;;WAIG;QACH,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;;CAChD"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { CypressComponentProjectSchema } from './schema';
3
+ export declare function cypressComponentProject(tree: Tree, options: CypressComponentProjectSchema): Promise<() => void>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cypressComponentProject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ const cypress_version_1 = require("../../utils/cypress-version");
7
+ const versions_1 = require("../../utils/versions");
8
+ function cypressComponentProject(tree, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const cyVersion = (0, cypress_version_1.installedCypressVersion)();
11
+ if (cyVersion && cyVersion < 10) {
12
+ throw new Error('Cypress version of 10 or higher is required to use component testing. See the migration guide to upgrade. https://nx.dev/cypress/v10-migration-guide');
13
+ }
14
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
15
+ const installDepsTask = updateDeps(tree);
16
+ addProjectFiles(tree, projectConfig, options);
17
+ addTargetToProject(tree, projectConfig, options);
18
+ if (!options.skipFormat) {
19
+ yield (0, devkit_1.formatFiles)(tree);
20
+ }
21
+ return () => {
22
+ installDepsTask();
23
+ };
24
+ });
25
+ }
26
+ exports.cypressComponentProject = cypressComponentProject;
27
+ function updateDeps(tree) {
28
+ const devDeps = {
29
+ '@cypress/webpack-dev-server': versions_1.cypressWebpackVersion,
30
+ 'html-webpack-plugin': versions_1.webpackHttpPluginVersion,
31
+ cypress: versions_1.cypressVersion,
32
+ };
33
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDeps);
34
+ }
35
+ function addProjectFiles(tree, projectConfig, options) {
36
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), projectConfig.root, Object.assign(Object.assign({}, options), { projectRoot: projectConfig.root, offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectConfig.root), ext: '' }));
37
+ }
38
+ function addTargetToProject(tree, projectConfig, options) {
39
+ projectConfig.targets['component-test'] = {
40
+ executor: '@nrwl/cypress:cypress',
41
+ options: {
42
+ cypressConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts'),
43
+ testingType: 'component',
44
+ },
45
+ };
46
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
47
+ }
48
+ //# sourceMappingURL=cypress-component-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cypress-component-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-component-project/cypress-component-project.ts"],"names":[],"mappings":";;;;AAAA,yCAUsB;AACtB,iEAAsE;AAEtE,mDAI8B;AAG9B,SAAsB,uBAAuB,CAC3C,IAAU,EACV,OAAsC;;QAEtC,MAAM,SAAS,GAAG,IAAA,yCAAuB,GAAE,CAAC;QAC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C,QAAQ,EAAE,uBAAuB;QACjC,OAAO,EAAE;YACP,aAAa,EAAE,IAAA,0BAAiB,EAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC;YACzE,WAAW,EAAE,WAAW;SACzB;KACF,CAAC;IAEF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,33 @@
1
+ // ***********************************************
2
+ // This example commands.ts shows you how to
3
+ // create various custom commands and overwrite
4
+ // existing commands.
5
+ //
6
+ // For more comprehensive examples of custom
7
+ // commands please read more here:
8
+ // https://on.cypress.io/custom-commands
9
+ // ***********************************************
10
+
11
+ // eslint-disable-next-line @typescript-eslint/no-namespace
12
+ declare namespace Cypress {
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ interface Chainable<Subject> {
15
+ login(email: string, password: string): void;
16
+ }
17
+ }
18
+ //
19
+ // -- This is a parent command --
20
+ Cypress.Commands.add('login', (email, password) => {
21
+ console.log('Custom command example: Login', email, password);
22
+ });
23
+ //
24
+ // -- This is a child command --
25
+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
26
+ //
27
+ //
28
+ // -- This is a dual command --
29
+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
30
+ //
31
+ //
32
+ // -- This will overwrite an existing command --
33
+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title><%= project %> Components App</title>
8
+
9
+ </head>
10
+ <body>
11
+ <div data-cy-root></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1,17 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.ts using ES2015 syntax:
17
+ import './commands';
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from 'cypress';
2
+
3
+ export default defineConfig({});
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["cypress", "node"]
7
+ },
8
+ "include": [
9
+ "cypress.config.ts",
10
+ "**/*.cy.ts",
11
+ "**/*.cy.tsx",
12
+ "**/*.cy.js",
13
+ "**/*.cy.jsx",
14
+ "**/*.d.ts"
15
+ ]
16
+ }
@@ -0,0 +1,4 @@
1
+ export interface CypressComponentProjectSchema {
2
+ project: string;
3
+ skipFormat: boolean;
4
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxCypressComponentProject",
4
+ "cli": "nx",
5
+ "title": "Set up Cypress component testing for a project",
6
+ "description": "Set up Cypress component test for a project.",
7
+ "type": "object",
8
+ "examples": [
9
+ {
10
+ "command": "nx g @nrwl/cypress:cypress-component-project --project=my-cool-lib ",
11
+ "description": "Add cypress component testing to an existing project named my-cool-lib"
12
+ }
13
+ ],
14
+ "properties": {
15
+ "project": {
16
+ "type": "string",
17
+ "description": "The name of the project to add cypress component testing to",
18
+ "$default": {
19
+ "$source": "projectName"
20
+ },
21
+ "x-prompt": "What project should we add Cypress component testing to?"
22
+ }
23
+ },
24
+ "required": ["project"]
25
+ }
@@ -7,21 +7,27 @@ const linter_1 = require("@nrwl/linter");
7
7
  const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
8
8
  const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
9
9
  const path_1 = require("path");
10
- const versions_1 = require("../../utils/versions");
11
- const project_name_1 = require("../../utils/project-name");
12
10
  const cypress_version_1 = require("../../utils/cypress-version");
11
+ const project_name_1 = require("../../utils/project-name");
12
+ const versions_1 = require("../../utils/versions");
13
13
  function createFiles(tree, options) {
14
- (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), options.projectRoot, Object.assign(Object.assign({ tmpl: '' }, options), { project: options.project || 'Project', ext: options.js ? 'js' : 'ts', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, typescript_1.getRelativePathToRootTsConfig)(tree, options.projectRoot) }));
14
+ // if not installed or >v10 use v10 folder
15
+ // else use v9 folder
15
16
  const cypressVersion = (0, cypress_version_1.installedCypressVersion)();
16
- if (!cypressVersion || cypressVersion >= 7) {
17
- tree.delete((0, path_1.join)(options.projectRoot, 'src/plugins/index.js'));
18
- }
19
- else {
17
+ const cypressFiles = cypressVersion && cypressVersion < 10 ? 'v9-and-under' : 'v10-and-after';
18
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files', cypressFiles), options.projectRoot, Object.assign(Object.assign({ tmpl: '' }, options), { project: options.project || 'Project', ext: options.js ? 'js' : 'ts', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, typescript_1.getRelativePathToRootTsConfig)(tree, options.projectRoot) }));
19
+ if (cypressVersion && cypressVersion < 7) {
20
20
  (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.projectRoot, 'cypress.json'), (json) => {
21
21
  json.pluginsFile = './src/plugins/index';
22
22
  return json;
23
23
  });
24
24
  }
25
+ else if (cypressVersion < 10) {
26
+ const pluginPath = (0, path_1.join)(options.projectRoot, 'src/plugins/index.js');
27
+ if (tree.exists(pluginPath)) {
28
+ tree.delete(pluginPath);
29
+ }
30
+ }
25
31
  if (options.js) {
26
32
  (0, devkit_1.toJS)(tree);
27
33
  }
@@ -29,6 +35,8 @@ function createFiles(tree, options) {
29
35
  function addProject(tree, options) {
30
36
  var _a, _b, _c, _d;
31
37
  let e2eProjectConfig;
38
+ const detectedCypressVersion = (_a = (0, cypress_version_1.installedCypressVersion)()) !== null && _a !== void 0 ? _a : versions_1.cypressVersion;
39
+ const cypressConfig = detectedCypressVersion < 10 ? 'cypress.json' : 'cypress.config.ts';
32
40
  if (options.baseUrl) {
33
41
  e2eProjectConfig = {
34
42
  root: options.projectRoot,
@@ -38,8 +46,9 @@ function addProject(tree, options) {
38
46
  e2e: {
39
47
  executor: '@nrwl/cypress:cypress',
40
48
  options: {
41
- cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, 'cypress.json'),
49
+ cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, cypressConfig),
42
50
  baseUrl: options.baseUrl,
51
+ testingType: 'e2e',
43
52
  },
44
53
  },
45
54
  },
@@ -55,7 +64,7 @@ function addProject(tree, options) {
55
64
  "${options.project}:serve" as the devServerTarget. But you may need to define this target within the project, "${options.project}".
56
65
  `);
57
66
  }
58
- const devServerTarget = ((_a = project.targets) === null || _a === void 0 ? void 0 : _a.serve) && ((_c = (_b = project.targets) === null || _b === void 0 ? void 0 : _b.serve) === null || _c === void 0 ? void 0 : _c.defaultConfiguration)
67
+ const devServerTarget = ((_b = project.targets) === null || _b === void 0 ? void 0 : _b.serve) && ((_d = (_c = project.targets) === null || _c === void 0 ? void 0 : _c.serve) === null || _d === void 0 ? void 0 : _d.defaultConfiguration)
59
68
  ? `${options.project}:serve:${project.targets.serve.defaultConfiguration}`
60
69
  : `${options.project}:serve`;
61
70
  e2eProjectConfig = {
@@ -66,8 +75,9 @@ function addProject(tree, options) {
66
75
  e2e: {
67
76
  executor: '@nrwl/cypress:cypress',
68
77
  options: {
69
- cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, 'cypress.json'),
78
+ cypressConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, cypressConfig),
70
79
  devServerTarget,
80
+ testingType: 'e2e',
71
81
  },
72
82
  configurations: {
73
83
  production: {
@@ -83,7 +93,6 @@ function addProject(tree, options) {
83
93
  else {
84
94
  throw new Error(`Either project or baseUrl should be specified.`);
85
95
  }
86
- const detectedCypressVersion = (_d = (0, cypress_version_1.installedCypressVersion)()) !== null && _d !== void 0 ? _d : versions_1.cypressVersion;
87
96
  if (detectedCypressVersion < 7) {
88
97
  e2eProjectConfig.targets.e2e.options.tsConfig = (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json');
89
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cypress-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-project/cypress-project.ts"],"names":[],"mappings":";;;;AAAA,yCAiBsB;AACtB,yCAA4D;AAC5D,2FAAqF;AACrF,yEAAyF;AAEzF,+BAA4B;AAG5B,mDAG8B;AAC9B,2DAA0D;AAC1D,iEAAsE;AAOtE,SAAS,WAAW,CAAC,IAAU,EAAE,OAA6B;IAC5D,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,gCACjE,IAAI,EAAE,EAAE,IACL,OAAO,KACV,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,SAAS,EACrC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAC7B,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,EACnD,gBAAgB,EAAE,IAAA,0CAA6B,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,IAC1E,CAAC;IAEH,MAAM,cAAc,GAAG,IAAA,yCAAuB,GAAE,CAAC;IACjD,I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;QACnD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AATD,0DASC;AAED,SAAS,gBAAgB,CAAC,IAAU,EAAE,OAAe;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAA,6BAAc,EAChC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAC1E,CAAC;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS;QACnC,CAAC,CAAC,IAAA,0BAAiB,EACf,OAAO,EACP,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EACjC,OAAO,CAAC,IAAI,CACb;QACH,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAM,CAAC,MAAM,CAAC;IACjD,uCACK,OAAO,KACV,WAAW;QACX,WAAW,IACX;AACJ,CAAC;AAED,kBAAe,uBAAuB,CAAC;AAC1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,CAAC"}
1
+ {"version":3,"file":"cypress-project.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/cypress-project/cypress-project.ts"],"names":[],"mappings":";;;;AAAA,yCAiBsB;AACtB,yCAA4D;AAC5D,2FAAqF;AACrF,yEAAyF;AAEzF,+BAA4B;AAC5B,iEAAsE;AACtE,2DAA0D;AAC1D,mDAG8B;AAS9B,SAAS,WAAW,CAAC,IAAU,EAAE,OAA6B;IAC5D,0CAA0C;IAC1C,qBAA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G,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAC1E,CAAC;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS;QACnC,CAAC,CAAC,IAAA,0BAAiB,EACf,OAAO,EACP,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EACjC,OAAO,CAAC,IAAI,CACb;QACH,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAM,CAAC,MAAM,CAAC;IACjD,uCACK,OAAO,KACV,WAAW;QACX,WAAW,IACX;AACJ,CAAC;AAED,kBAAe,uBAAuB,CAAC;AAC1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'cypress';
2
+ import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
3
+
4
+ export default defineConfig({
5
+ e2e: nxE2EPreset(__dirname)
6
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "<%= rootTsConfigPath %>",
3
+ "compilerOptions": {
4
+ "sourceMap": false,
5
+ "outDir": "<%= offsetFromRoot %>dist/out-tsc",
6
+ "allowJs": true,
7
+ "types": ["cypress", "node"]
8
+ },
9
+ "include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io"
4
+ }
@@ -0,0 +1,13 @@
1
+ import { getGreeting } from '../support/app.po';
2
+
3
+ describe('<%= project %>', () => {
4
+ beforeEach(() => cy.visit('/'));
5
+
6
+ it('should display welcome message', () => {
7
+ // Custom command example, see `../support/commands.ts` file
8
+ cy.login('my-email@something.com', 'myPassword');
9
+
10
+ // Function helper example, see `../support/app.po.ts` file
11
+ getGreeting().contains('Welcome <%= project %>');
12
+ });
13
+ });
@@ -0,0 +1 @@
1
+ export const getGreeting = () => cy.get('h1');
@@ -0,0 +1,33 @@
1
+ // ***********************************************
2
+ // This example commands.js shows you how to
3
+ // create various custom commands and overwrite
4
+ // existing commands.
5
+ //
6
+ // For more comprehensive examples of custom
7
+ // commands please read more here:
8
+ // https://on.cypress.io/custom-commands
9
+ // ***********************************************
10
+ <% if (linter === 'eslint') { %>
11
+ // eslint-disable-next-line @typescript-eslint/no-namespace<% } %>
12
+ declare namespace Cypress {<% if (linter === 'eslint') { %>
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars<% } %>
14
+ interface Chainable<Subject> {
15
+ login(email: string, password: string): void;
16
+ }
17
+ }
18
+ //
19
+ // -- This is a parent command --
20
+ Cypress.Commands.add('login', (email, password) => {
21
+ console.log('Custom command example: Login', email, password);
22
+ });
23
+ //
24
+ // -- This is a child command --
25
+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
26
+ //
27
+ //
28
+ // -- This is a dual command --
29
+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
30
+ //
31
+ //
32
+ // -- This will overwrite an existing command --
33
+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
@@ -0,0 +1,17 @@
1
+ // ***********************************************************
2
+ // This example support/index.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.ts using ES2015 syntax:
17
+ import './commands';
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "<%= rootTsConfigPath %>",
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
3
  "compilerOptions": {
4
4
  "sourceMap": false,
5
5
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
@@ -0,0 +1,27 @@
1
+ import { ProjectConfiguration, Tree } from '@nrwl/devkit';
2
+ export declare function findCypressConfigs(tree: Tree, projectConfig: ProjectConfiguration, target: string, config: string): {
3
+ cypressConfigPathJson: string;
4
+ cypressConfigPathTs: string;
5
+ };
6
+ /**
7
+ * update the existing cypress.json config to the new cypress.config.ts structure.
8
+ * return both the old and new configs
9
+ */
10
+ export declare function createNewCypressConfig(tree: Tree, projectConfig: ProjectConfiguration, cypressConfigPathJson: string): {
11
+ cypressConfigTs: Record<string, any>;
12
+ cypressConfigJson: Record<string, any>;
13
+ };
14
+ export declare function createSupportFileImport(oldSupportFilePath: string, newSupportFilePath: string, projectSourceRoot: string): {
15
+ oldImportPathLeaf: string;
16
+ newImportPathLeaf: string;
17
+ };
18
+ export declare function updateProjectPaths(tree: Tree, projectConfig: ProjectConfiguration, { cypressConfigTs, cypressConfigJson, }: {
19
+ cypressConfigTs: Record<string, any>;
20
+ cypressConfigJson: Record<string, any>;
21
+ }): void;
22
+ export declare function updateImports(tree: Tree, filePath: string, oldImportPath: string, newImportPath: string): void;
23
+ export declare function writeNewConfig(tree: Tree, cypressConfigPathTs: string, cypressConfigs: {
24
+ cypressConfigTs: Record<string, any>;
25
+ cypressConfigJson: Record<string, any>;
26
+ }): void;
27
+ export declare function addConfigToTsConfig(tree: Tree, tsconfigPath: string, cypressConfigPath: string): void;
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addConfigToTsConfig = exports.writeNewConfig = exports.updateImports = exports.updateProjectPaths = exports.createSupportFileImport = exports.createNewCypressConfig = exports.findCypressConfigs = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
7
+ const path_1 = require("path");
8
+ const typescript_1 = require("typescript");
9
+ const validFilesEndingsToUpdate = [
10
+ '.js',
11
+ '.jsx',
12
+ '.ts',
13
+ '.tsx',
14
+ '.mjs',
15
+ '.cjs',
16
+ ];
17
+ function findCypressConfigs(tree, projectConfig, target, config) {
18
+ var _a, _b, _c, _d, _e, _f, _g;
19
+ const cypressConfigPathJson = ((_c = (_b = (_a = projectConfig.targets[target]) === null || _a === void 0 ? void 0 : _a.configurations) === null || _b === void 0 ? void 0 : _b[config]) === null || _c === void 0 ? void 0 : _c.cypressConfig) ||
20
+ // make sure it's a json file, since it could have been updated to ts file from previous configuration migration
21
+ (((_e = (_d = projectConfig.targets[target]) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.cypressConfig.endsWith('json'))
22
+ ? (_g = (_f = projectConfig.targets[target]) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.cypressConfig
23
+ : (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.json'));
24
+ const cypressConfigPathTs = (0, devkit_1.joinPathFragments)(projectConfig.root,
25
+ // create matching ts config for custom cypress config if present
26
+ cypressConfigPathJson.endsWith('cypress.json')
27
+ ? 'cypress.config.ts' //default
28
+ : `${(0, path_1.basename)(cypressConfigPathJson, (0, path_1.extname)(cypressConfigPathJson))}.config.ts`);
29
+ return {
30
+ cypressConfigPathJson,
31
+ cypressConfigPathTs,
32
+ };
33
+ }
34
+ exports.findCypressConfigs = findCypressConfigs;
35
+ /**
36
+ * update the existing cypress.json config to the new cypress.config.ts structure.
37
+ * return both the old and new configs
38
+ */
39
+ function createNewCypressConfig(tree, projectConfig, cypressConfigPathJson) {
40
+ const cypressConfigJson = (0, devkit_1.readJson)(tree, cypressConfigPathJson);
41
+ const { modifyObstructiveCode = null, // no longer needed in configs
42
+ integrationFolder = 'src/e2e', // provide the new defaults if the value isn't present
43
+ supportFile = 'src/support/e2e.ts' } = cypressConfigJson, restOfConfig = tslib_1.__rest(cypressConfigJson, ["modifyObstructiveCode", "integrationFolder", "supportFile"]);
44
+ const newIntegrationFolder = tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'integration'))
45
+ ? 'src/e2e'
46
+ : integrationFolder;
47
+ const cypressConfigTs = {
48
+ e2e: Object.assign(Object.assign({}, restOfConfig), { specPattern: `${newIntegrationFolder}/**/*.cy.{js,jsx,ts,tsx}`,
49
+ // if supportFile is defined (can be false if not using it) and in the default location (or in the new default location),
50
+ // then use the new default location.
51
+ // otherwise we will use the existing folder location/falsey value
52
+ supportFile: (supportFile &&
53
+ tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'index.ts'))) ||
54
+ tree.exists((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'e2e.ts'))
55
+ ? 'src/support/e2e.ts'
56
+ : supportFile,
57
+ // if the default location is used then will update to the new location otherwise keep the custom location
58
+ // this is used down the line, but won't be in the final config file since it's a deprecated option
59
+ integrationFolder: newIntegrationFolder }),
60
+ };
61
+ return { cypressConfigTs, cypressConfigJson };
62
+ }
63
+ exports.createNewCypressConfig = createNewCypressConfig;
64
+ function createSupportFileImport(oldSupportFilePath, newSupportFilePath, projectSourceRoot) {
65
+ // need to get the new import path for the support file.
66
+ // before it was "<relative path>/support/index.ts" and the new path will be "<relative path>/support/e2e.ts"
67
+ // i.e. take ../support => ../support/e2e.ts
68
+ // 1. take apps/app-e2e/support/index.ts => support (this cant have a / in it. must grab the leaf for tsquery)
69
+ // 2. if the leaf value is index.ts then grab the parent directory (i.e. so we have support/index.ts => support)
70
+ // 3. take apps/app-e2e/support/e2e.ts => support/e2e
71
+ // apps/app-e2e/support/e2e.ts => support/e2e
72
+ const newFileExt = (0, path_1.extname)(newSupportFilePath);
73
+ const newImportPathLeaf = (0, path_1.relative)(projectSourceRoot, newSupportFilePath).replace(newFileExt, '');
74
+ // apps/app-e2e/support/index.ts => support/index
75
+ const oldFileExt = (0, path_1.extname)(oldSupportFilePath);
76
+ const oldImportPathLeaf = (0, path_1.relative)(projectSourceRoot, oldSupportFilePath).replace(oldFileExt, '');
77
+ // support/index => support
78
+ const oldRelativeImportPath = (0, path_1.basename)(oldImportPathLeaf, oldFileExt);
79
+ return {
80
+ newImportPathLeaf,
81
+ // don't import from 'support/index' it's just 'support'
82
+ oldImportPathLeaf: oldRelativeImportPath === 'index'
83
+ ? (0, path_1.dirname)(oldImportPathLeaf)
84
+ : oldImportPathLeaf,
85
+ };
86
+ }
87
+ exports.createSupportFileImport = createSupportFileImport;
88
+ function updateProjectPaths(tree, projectConfig, { cypressConfigTs, cypressConfigJson, }) {
89
+ const { integrationFolder, supportFile } = cypressConfigTs['e2e'];
90
+ const oldIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, cypressConfigJson.integrationFolder);
91
+ const newIntegrationFolder = (0, devkit_1.joinPathFragments)(projectConfig.root, integrationFolder);
92
+ let newSupportFile;
93
+ let oldSupportFile;
94
+ let oldImportLeafPath;
95
+ let newImportLeafPath;
96
+ let shouldUpdateSupportFileImports = false;
97
+ // supportFile can be falsey or a string path to the file
98
+ if (cypressConfigJson.supportFile) {
99
+ // we need to check the test files to see if
100
+ // support file import is used and then update it if so
101
+ shouldUpdateSupportFileImports = true;
102
+ oldSupportFile = (0, devkit_1.joinPathFragments)(projectConfig.root, cypressConfigJson.supportFile);
103
+ newSupportFile = (0, devkit_1.joinPathFragments)(projectConfig.root, supportFile);
104
+ // oldSupportFile might have already been updated
105
+ // to the new default location so must be guarded for
106
+ if (oldSupportFile !== newSupportFile && tree.exists(oldSupportFile)) {
107
+ tree.rename(oldSupportFile, newSupportFile);
108
+ }
109
+ }
110
+ else {
111
+ shouldUpdateSupportFileImports = false;
112
+ newSupportFile = supportFile;
113
+ // rename the default support file even if not in use to keep the system in sync with cypress v10
114
+ const defaultSupportFile = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'index.ts');
115
+ if (tree.exists(defaultSupportFile)) {
116
+ const newSupportDefaultPath = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'e2e.ts');
117
+ if (defaultSupportFile !== newSupportDefaultPath &&
118
+ tree.exists(defaultSupportFile)) {
119
+ tree.rename(defaultSupportFile, newSupportDefaultPath);
120
+ }
121
+ }
122
+ }
123
+ if (shouldUpdateSupportFileImports) {
124
+ const newImportPaths = createSupportFileImport(oldSupportFile, newSupportFile, projectConfig.sourceRoot);
125
+ oldImportLeafPath = newImportPaths.oldImportPathLeaf;
126
+ newImportLeafPath = newImportPaths.newImportPathLeaf;
127
+ }
128
+ // tree.rename doesn't work on directories must update each file within
129
+ // the directory to the new directory
130
+ (0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.sourceRoot, (path) => {
131
+ if (!path.includes(oldIntegrationFolder)) {
132
+ return;
133
+ }
134
+ const fileName = (0, path_1.basename)(path);
135
+ let newPath = path.replace(oldIntegrationFolder, newIntegrationFolder);
136
+ if (fileName.includes('.spec.')) {
137
+ newPath = newPath.replace('.spec.', '.cy.');
138
+ }
139
+ if (newPath !== path && tree.exists(path)) {
140
+ tree.rename(path, newPath);
141
+ }
142
+ // if they weren't using the supportFile then there is no need to update the imports.
143
+ if (shouldUpdateSupportFileImports &&
144
+ validFilesEndingsToUpdate.some((e) => path.endsWith(e))) {
145
+ updateImports(tree, newPath, oldImportLeafPath, newImportLeafPath);
146
+ }
147
+ });
148
+ if (tree.children(oldIntegrationFolder).length === 0) {
149
+ tree.delete(oldIntegrationFolder);
150
+ }
151
+ }
152
+ exports.updateProjectPaths = updateProjectPaths;
153
+ function updateImports(tree, filePath, oldImportPath, newImportPath) {
154
+ const endOfImportSelector = `StringLiteral[value=/${oldImportPath}$/]`;
155
+ const fileContent = tree.read(filePath, 'utf-8');
156
+ const newContent = tsquery_1.tsquery.replace(fileContent, endOfImportSelector, (node) => {
157
+ // if node.parent is an CallExpression require() ||ImportDeclaration
158
+ if ((node === null || node === void 0 ? void 0 : node.parent) &&
159
+ ((0, typescript_1.isCallExpression)(node.parent) ||
160
+ (0, typescript_1.isImportDeclaration)(node.parent) ||
161
+ (0, typescript_1.isExportDeclaration)(node.parent))) {
162
+ return `'${node.text.replace(oldImportPath, newImportPath)}'`;
163
+ }
164
+ return node.text;
165
+ });
166
+ tree.write(filePath, newContent);
167
+ }
168
+ exports.updateImports = updateImports;
169
+ function writeNewConfig(tree, cypressConfigPathTs, cypressConfigs) {
170
+ // remove deprecated configs options
171
+ const _a = cypressConfigs.cypressConfigTs.e2e, { pluginsFile = false, integrationFolder = '' } = _a, restOfConfig = tslib_1.__rest(_a, ["pluginsFile", "integrationFolder"]);
172
+ const pluginImport = pluginsFile
173
+ ? `import setupNodeEvents from '${pluginsFile}';`
174
+ : '';
175
+ const convertedConfig = JSON.stringify(restOfConfig, null, 2);
176
+ tree.write(cypressConfigPathTs, (0, devkit_1.stripIndents) `
177
+ import { defineConfig } from 'cypress'
178
+ import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
179
+ ${pluginImport}
180
+
181
+ const cypressJsonConfig = ${convertedConfig}
182
+ export default defineConfig({
183
+ e2e: {
184
+ ...nxE2EPreset(__dirname),
185
+ ...cypressJsonConfig,
186
+ ${pluginsFile ? 'setupNodeEvents' : ''}
187
+ }
188
+ })
189
+ `);
190
+ }
191
+ exports.writeNewConfig = writeNewConfig;
192
+ function addConfigToTsConfig(tree, tsconfigPath, cypressConfigPath) {
193
+ if (tree.exists(tsconfigPath)) {
194
+ (0, devkit_1.updateJson)(tree, tsconfigPath, (json) => {
195
+ json.include = Array.from(new Set([
196
+ ...(json.include || []),
197
+ (0, path_1.relative)((0, path_1.dirname)(tsconfigPath), cypressConfigPath),
198
+ ]));
199
+ return json;
200
+ }, { expectComments: true });
201
+ }
202
+ }
203
+ exports.addConfigToTsConfig = addConfigToTsConfig;
204
+ //# sourceMappingURL=conversion.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion.util.js","sourceRoot":"","sources":["../../../../../../packages/cypress/src/generators/migrate-to-cypress-ten/conversion.util.ts"],"names":[],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,IAAI,CACvB,IAAI,GAAG,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;gBACvB,IAAA,eAAQ,EAAC,IAAA,cAAO,EAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;aACnD,CAAC,CACH,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC,EACD,EAAE,cAAc,EAAE,IAAI,EAAE,CACzB,CAAC;KACH;AACH,CAAC;AArBD,kDAqBC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export declare function migrateCypressProject(tree: Tree): Promise<() => void>;
3
+ export default migrateCypressProject;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateCypressProject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cypress_version_1 = require("@nrwl/cypress/src/utils/cypress-version");
6
+ const devkit_1 = require("@nrwl/devkit");
7
+ const executor_options_utils_1 = require("@nrwl/workspace/src/utilities/executor-options-utils");
8
+ const versions_1 = require("../../utils/versions");
9
+ const conversion_util_1 = require("./conversion.util");
10
+ function migrateCypressProject(tree) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ (0, cypress_version_1.assertMinimumCypressVersion)(8);
13
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (currentValue, projectName, target, configuration) => {
14
+ var _a, _b, _c, _d, _e, _f;
15
+ try {
16
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
17
+ const { cypressConfigPathJson, cypressConfigPathTs } = (0, conversion_util_1.findCypressConfigs)(tree, projectConfig, target, configuration);
18
+ // a matching cypress ts file hasn't been made yet. need to migrate.
19
+ if (tree.exists(cypressConfigPathJson) &&
20
+ !tree.exists(cypressConfigPathTs)) {
21
+ const cypressConfigs = (0, conversion_util_1.createNewCypressConfig)(tree, projectConfig, cypressConfigPathJson);
22
+ (0, conversion_util_1.updateProjectPaths)(tree, projectConfig, cypressConfigs);
23
+ (0, conversion_util_1.writeNewConfig)(tree, cypressConfigPathTs, cypressConfigs);
24
+ (0, conversion_util_1.addConfigToTsConfig)(tree, ((_c = (_b = (_a = projectConfig.targets) === null || _a === void 0 ? void 0 : _a[target]) === null || _b === void 0 ? void 0 : _b.configurations) === null || _c === void 0 ? void 0 : _c.tsConfig) ||
25
+ ((_f = (_e = (_d = projectConfig.targets) === null || _d === void 0 ? void 0 : _d[target]) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.tsConfig) ||
26
+ (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json'), cypressConfigPathTs);
27
+ tree.delete(cypressConfigPathJson);
28
+ }
29
+ // ts file has been made and matching json file has been removed only need to update the project config
30
+ if (!tree.exists(cypressConfigPathJson) &&
31
+ tree.exists(cypressConfigPathTs)) {
32
+ projectConfig.targets[target].options = Object.assign(Object.assign({}, projectConfig.targets[target].options), { cypressConfig: cypressConfigPathTs, testingType: 'e2e' });
33
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
34
+ }
35
+ }
36
+ catch (e) {
37
+ devkit_1.logger.error((0, devkit_1.stripIndents) `
38
+ NX There was an error converting ${projectName}:${target}.
39
+ You can manually update the project by following the migration guide if need be.
40
+ https://nx.dev/cypress/v10-migration-guide
41
+ `);
42
+ throw e;
43
+ }
44
+ });
45
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
46
+ json.devDependencies['cypress'] = versions_1.cypressVersion;
47
+ return json;
48
+ });
49
+ yield (0, devkit_1.formatFiles)(tree);
50
+ return () => {
51
+ (0, devkit_1.installPackagesTask)(tree);
52
+ };
53
+ });
54
+ }
55
+ exports.migrateCypressProject = migrateCypressProject;
56
+ exports.default = migrateCypressProject;
57
+ //# sourceMappingURL=migrate-to-cypress-ten.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-to-cypress-ten.js","sourceRoot":"","sources":["../../../../../../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AAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;iBACpC;gBACD,uGAAuG;gBACvG,IACE,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC;oBACnC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAChC;oBACA,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,mCAChC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,KACxC,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,KAAK,GACnB,CAAC;oBAEF,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;iBAC9D;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,eAAM,CAAC,KAAK,CAAC,IAAA,qBAAY,EAAA;mCACE,WAAW,IAAI,MAAM;;;GAGrD,CAAC,CAAC;gBACG,MAAM,CAAC,CAAC;aACT;QACH,CAAC,CACF,CAAC;QAEF,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,yBAAc,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACxB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AArED,sDAqEC;AAED,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxCypressMigrateToTen",
4
+ "cli": "nx",
5
+ "title": "Migrate e2e project to Cypress 10",
6
+ "description": "Migrate Cypress e2e project from v8/v9 to Cypress v10.",
7
+ "type": "object",
8
+ "examples": [
9
+ {
10
+ "command": "nx g @nrwl/cypress:migrate-to-cypress-10",
11
+ "description": "Migrate existing cypress projects to Cypress v10"
12
+ }
13
+ ],
14
+ "properties": {}
15
+ }
@@ -58,7 +58,6 @@ function getWebpackConfig(config) {
58
58
  plugins: [
59
59
  new ForkTsCheckerWebpackPlugin({
60
60
  typescript: {
61
- enabled: true,
62
61
  configFile: config.env.tsConfig,
63
62
  },
64
63
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"preprocessor.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/preprocessor.ts"],"names":[],"mappings":";;;;AAAA,oDAAoD;AACpD,iFAAoE;AACpE,6EAA8E;AAC9E,yCAA4C;AAC5C,6EAAkF;AAClF,wDAAyD;AAEzD;;GAEG;AACH,SAAgB,oBAAoB,CAClC,MAAW,EACX,sBAAoD;IAEpD,IAAI,IAAA,yCAAuB,GAAE,IAAI,CAAC,EAAE;QAClC,OAAO,CAAC,GAAG,CAAC,IAAA,qBAAY,EAAA;;4GAEgF,CAAC,CAAC;KAC3G;IAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;KACH;IAED,OAAO,CAAO,IAAI,EAAE,EAAE;QACpB,MAAM,cAAc,GAAG,sBAAsB;YAC3C,CAAC,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAA,CAAC;AACJ,CAAC;AAtBD,oDAsBC;AAED,SAAgB,gBAAgB,CAAC,MAAW;IAC1C,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1D,OAAO;QACL,OAAO,EAAE;YACP,UAAU;YACV,OAAO,EAAE;gBACP,IAAI,mDAAmB,CAAC;oBACtB,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;oBAC/B,UAAU;iBACX,CAAC;aACH;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;oBACpC,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE;wBACP,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;wBAC/B,mDAAmD;wBACnD,oBAAoB,EAAE,IAAI;wBAC1B,aAAa,EAAE,IAAI;qBACpB;iBACF;aACF;SACF;QACD,OAAO,EAAE;YACP,IAAI,0BAA0B,CAAC;gBAC7B,UAAU,EAAE;oBACV,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;iBAChC;aACF,CAAC;SACH;QACD,SAAS,EAAE,CAAC,aAAa,EAAE,CAAC;KAC7B,CAAC;AACJ,CAAC;AArCD,4CAqCC"}
1
+ {"version":3,"file":"preprocessor.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/plugins/preprocessor.ts"],"names":[],"mappings":";;;;AAAA,oDAAoD;AACpD,iFAAoE;AACpE,6EAA8E;AAC9E,yCAA4C;AAC5C,6EAAkF;AAClF,wDAAyD;AAEzD;;GAEG;AACH,SAAgB,oBAAoB,CAClC,MAAW,EACX,sBAAoD;IAEpD,IAAI,IAAA,yCAAuB,GAAE,IAAI,CAAC,EAAE;QAClC,OAAO,CAAC,GAAG,CAAC,IAAA,qBAAY,EAAA;;4GAEgF,CAAC,CAAC;KAC3G;IAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;QACxB,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;KACH;IAED,OAAO,CAAO,IAAI,EAAE,EAAE;QACpB,MAAM,cAAc,GAAG,sBAAsB;YAC3C,CAAC,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAA,CAAC;AACJ,CAAC;AAtBD,oDAsBC;AAED,SAAgB,gBAAgB,CAAC,MAAW;IAC1C,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1D,OAAO;QACL,OAAO,EAAE;YACP,UAAU;YACV,OAAO,EAAE;gBACP,IAAI,mDAAmB,CAAC;oBACtB,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;oBAC/B,UAAU;iBACX,CAAC;aACH;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;oBACpC,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE;wBACP,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;wBAC/B,mDAAmD;wBACnD,oBAAoB,EAAE,IAAI;wBAC1B,aAAa,EAAE,IAAI;qBACpB;iBACF;aACF;SACF;QACD,OAAO,EAAE;YACP,IAAI,0BAA0B,CAAC;gBAC7B,UAAU,EAAE;oBACV,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ;iBAChC;aACF,CAAC;SACH;QACD,SAAS,EAAE,CAAC,aAAa,EAAE,CAAC;KAC7B,CAAC;AACJ,CAAC;AApCD,4CAoCC"}
@@ -1 +1,5 @@
1
1
  export declare function installedCypressVersion(): number;
2
+ /**
3
+ * will not throw if cypress is not installed
4
+ */
5
+ export declare function assertMinimumCypressVersion(minVersion: number): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installedCypressVersion = void 0;
3
+ exports.assertMinimumCypressVersion = exports.installedCypressVersion = void 0;
4
4
  let cypressPackageJson;
5
5
  let loadedCypress = false;
6
6
  function installedCypressVersion() {
@@ -21,4 +21,14 @@ function installedCypressVersion() {
21
21
  return +majorVersion;
22
22
  }
23
23
  exports.installedCypressVersion = installedCypressVersion;
24
+ /**
25
+ * will not throw if cypress is not installed
26
+ */
27
+ function assertMinimumCypressVersion(minVersion) {
28
+ const version = installedCypressVersion();
29
+ if (version && version < minVersion) {
30
+ throw new Error(`Cypress version of ${minVersion} or higher is not installed. Expected Cypress v${minVersion}+, found Cypress v${version} instead.`);
31
+ }
32
+ }
33
+ exports.assertMinimumCypressVersion = assertMinimumCypressVersion;
24
34
  //# sourceMappingURL=cypress-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cypress-version.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/cypress-version.ts"],"names":[],"mappings":";;;AAAA,IAAI,kBAAkB,CAAC;AACvB,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,SAAgB,uBAAuB;IACrC,IAAI,CAAC,aAAa,EAAE;QAClB,IAAI;YACF,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;SACtD;QAAC,WAAM,GAAE;KACX;IAED,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,CAAC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,YAAY,CAAC;AACvB,CAAC;AAhBD,0DAgBC"}
1
+ {"version":3,"file":"cypress-version.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/cypress-version.ts"],"names":[],"mappings":";;;AAAA,IAAI,kBAAkB,CAAC;AACvB,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,SAAgB,uBAAuB;IACrC,IAAI,CAAC,aAAa,EAAE;QAClB,IAAI;YACF,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;SACtD;QAAC,WAAM,GAAE;KACX;IAED,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,CAAC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,YAAY,CAAC;AACvB,CAAC;AAhBD,0DAgBC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,UAAkB;IAC5D,MAAM,OAAO,GAAG,uBAAuB,EAAE,CAAC;IAC1C,IAAI,OAAO,IAAI,OAAO,GAAG,UAAU,EAAE;QACnC,MAAM,IAAI,KAAK,CACb,sBAAsB,UAAU,kDAAkD,UAAU,qBAAqB,OAAO,WAAW,CACpI,CAAC;KACH;AACH,CAAC;AAPD,kEAOC"}
@@ -1,4 +1,6 @@
1
1
  export declare const nxVersion: any;
2
- export declare const cypressVersion = "^9.1.0";
3
2
  export declare const eslintPluginCypressVersion = "^2.10.3";
4
3
  export declare const typesNodeVersion = "16.11.7";
4
+ export declare const cypressVersion = "^10.2.0";
5
+ export declare const cypressWebpackVersion = "^2.0.0";
6
+ export declare const webpackHttpPluginVersion = "^5.5.0";
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typesNodeVersion = exports.eslintPluginCypressVersion = exports.cypressVersion = exports.nxVersion = void 0;
3
+ exports.webpackHttpPluginVersion = exports.cypressWebpackVersion = exports.cypressVersion = exports.typesNodeVersion = exports.eslintPluginCypressVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.cypressVersion = '^9.1.0';
6
5
  exports.eslintPluginCypressVersion = '^2.10.3';
7
6
  exports.typesNodeVersion = '16.11.7';
7
+ exports.cypressVersion = '^10.2.0';
8
+ exports.cypressWebpackVersion = '^2.0.0';
9
+ exports.webpackHttpPluginVersion = '^5.5.0';
8
10
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAClD,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,0BAA0B,GAAG,SAAS,CAAC;AACvC,QAAA,gBAAgB,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/cypress/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAClD,QAAA,0BAA0B,GAAG,SAAS,CAAC;AACvC,QAAA,gBAAgB,GAAG,SAAS,CAAC;AAC7B,QAAA,cAAc,GAAG,SAAS,CAAC;AAC3B,QAAA,qBAAqB,GAAG,QAAQ,CAAC;AACjC,QAAA,wBAAwB,GAAG,QAAQ,CAAC"}