@nx/cypress 18.0.4 → 18.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "18.0.4",
3
+ "version": "18.0.6",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
6
6
  "repository": {
@@ -34,14 +34,14 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "18.0.4",
38
- "@nx/eslint": "18.0.4",
39
- "@nx/js": "18.0.4",
37
+ "@nx/devkit": "18.0.6",
38
+ "@nx/eslint": "18.0.6",
39
+ "@nx/js": "18.0.6",
40
40
  "@phenomnomnominal/tsquery": "~5.0.1",
41
41
  "detect-port": "^1.5.1",
42
42
  "semver": "^7.5.3",
43
43
  "tslib": "^2.3.0",
44
- "@nrwl/cypress": "18.0.4"
44
+ "@nrwl/cypress": "18.0.6"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "cypress": ">= 3 < 14"
@@ -61,12 +61,21 @@ function startWebServer(webServerCommand) {
61
61
  */
62
62
  function nxE2EPreset(pathToConfig, options) {
63
63
  const basePath = options?.cypressDir || 'src';
64
+ const dir = (0, path_1.dirname)(pathToConfig);
65
+ let supportFile = undefined;
66
+ for (const f of ['e2e.ts', 'e2e.js']) {
67
+ const candidate = (0, path_1.join)(dir, basePath, 'support', f);
68
+ if ((0, fs_1.existsSync)(candidate)) {
69
+ supportFile = candidate;
70
+ break;
71
+ }
72
+ }
64
73
  const baseConfig /*Cypress.EndToEndConfigOptions & {
65
74
  [NX_PLUGIN_OPTIONS]: unknown;
66
75
  }*/ = {
67
76
  ...nxBaseCypressPreset(pathToConfig),
68
77
  fileServerFolder: '.',
69
- supportFile: `${basePath}/support/e2e.{js,ts}`,
78
+ supportFile,
70
79
  specPattern: `${basePath}/**/*.cy.{js,jsx,ts,tsx}`,
71
80
  fixturesFolder: `${basePath}/fixtures`,
72
81
  [constants_1.NX_PLUGIN_OPTIONS]: {
@@ -17,15 +17,18 @@ function configurationGenerator(tree, options) {
17
17
  exports.configurationGenerator = configurationGenerator;
18
18
  async function configurationGeneratorInternal(tree, options) {
19
19
  const opts = normalizeOptions(tree, options);
20
+ opts.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
20
21
  const tasks = [];
21
22
  if (!(0, cypress_version_1.installedCypressVersion)()) {
22
23
  tasks.push(await (0, js_1.initGenerator)(tree, { ...options, skipFormat: true }));
23
24
  tasks.push(await (0, init_1.default)(tree, {
24
25
  ...opts,
25
26
  skipFormat: true,
26
- addPlugin: options.addPlugin,
27
27
  }));
28
28
  }
29
+ else if (opts.addPlugin) {
30
+ (0, init_1.addPlugin)(tree);
31
+ }
29
32
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
30
33
  const nxJson = (0, devkit_1.readNxJson)(tree);
31
34
  const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
@@ -78,7 +81,6 @@ In this case you need to provide a devServerTarget,'<projectName>:<targetName>[:
78
81
  }
79
82
  return {
80
83
  ...options,
81
- addPlugin: options.addPlugin ?? process.env.NX_ADD_PLUGINS !== 'false',
82
84
  bundler: options.bundler ?? 'webpack',
83
85
  rootProject: options.rootProject ?? projectConfig.root === '.',
84
86
  linter: options.linter ?? eslint_1.Linter.EsLint,
@@ -128,11 +130,12 @@ async function addFiles(tree, options, projectGraph, hasPlugin) {
128
130
  const devServerProjectConfig = (0, devkit_1.readProjectConfiguration)(tree, parsedTarget.project);
129
131
  // Add production e2e target if serve target is found
130
132
  if (parsedTarget.configuration !== 'production' &&
131
- devServerProjectConfig.targets[parsedTarget.target]?.configurations?.['production']) {
133
+ devServerProjectConfig?.targets?.[parsedTarget.target]
134
+ ?.configurations?.['production']) {
132
135
  webServerCommands.production = `nx run ${parsedTarget.project}:${parsedTarget.target}:production`;
133
136
  }
134
137
  // Add ci/static e2e target if serve target is found
135
- if (devServerProjectConfig.targets?.['serve-static']) {
138
+ if (devServerProjectConfig?.targets?.['serve-static']) {
136
139
  ciWebServerCommand = `nx run ${parsedTarget.project}:serve-static`;
137
140
  }
138
141
  }
@@ -165,6 +168,7 @@ async function addFiles(tree, options, projectGraph, hasPlugin) {
165
168
  function addTarget(tree, opts) {
166
169
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.project);
167
170
  const cyVersion = (0, cypress_version_1.installedCypressVersion)();
171
+ projectConfig.targets ??= {};
168
172
  projectConfig.targets.e2e = {
169
173
  executor: '@nx/cypress:cypress',
170
174
  options: {
@@ -201,6 +201,7 @@ async function normalizeOptions(host, options) {
201
201
  });
202
202
  options.linter = options.linter || eslint_1.Linter.EsLint;
203
203
  options.bundler = options.bundler || 'webpack';
204
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
204
205
  return {
205
206
  ...options,
206
207
  // other generators depend on the rootProject flag down stream
@@ -1,5 +1,6 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
+ export declare function addPlugin(tree: Tree): void;
3
4
  export declare function cypressInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
4
5
  export declare function cypressInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
5
6
  export default cypressInitGenerator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cypressInitGeneratorInternal = exports.cypressInitGenerator = void 0;
3
+ exports.cypressInitGeneratorInternal = exports.cypressInitGenerator = exports.addPlugin = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
6
6
  const plugin_1 = require("../../plugins/plugin");
@@ -49,6 +49,7 @@ function addPlugin(tree) {
49
49
  });
50
50
  (0, devkit_1.updateNxJson)(tree, nxJson);
51
51
  }
52
+ exports.addPlugin = addPlugin;
52
53
  function updateProductionFileset(tree) {
53
54
  const nxJson = (0, devkit_1.readNxJson)(tree);
54
55
  const productionFileset = nxJson.namedInputs?.production;
@@ -2,7 +2,7 @@ export declare const nxVersion: any;
2
2
  export declare const eslintPluginCypressVersion = "^2.13.4";
3
3
  export declare const typesNodeVersion = "18.16.9";
4
4
  export declare const cypressViteDevServerVersion = "^2.2.1";
5
- export declare const cypressVersion = "^13.0.0";
5
+ export declare const cypressVersion = "13.6.4";
6
6
  export declare const cypressWebpackVersion = "^2.0.0";
7
7
  export declare const webpackHttpPluginVersion = "^5.5.0";
8
8
  export declare const viteVersion = "~5.0.0";
@@ -5,7 +5,7 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.eslintPluginCypressVersion = '^2.13.4';
6
6
  exports.typesNodeVersion = '18.16.9';
7
7
  exports.cypressViteDevServerVersion = '^2.2.1';
8
- exports.cypressVersion = '^13.0.0';
8
+ exports.cypressVersion = '13.6.4';
9
9
  exports.cypressWebpackVersion = '^2.0.0';
10
10
  exports.webpackHttpPluginVersion = '^5.5.0';
11
11
  exports.viteVersion = '~5.0.0';