@nx/playwright 23.0.0-beta.2 → 23.0.0-beta.20

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 (65) hide show
  1. package/{index.d.ts → dist/index.d.ts} +0 -1
  2. package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
  3. package/{preset.d.ts → dist/preset.d.ts} +0 -1
  4. package/{src → dist/src}/executors/merge-reports/merge-reports.impl.d.ts +0 -1
  5. package/{src → dist/src}/executors/merge-reports/merge-reports.impl.js +8 -2
  6. package/{src → dist/src}/executors/playwright/playwright.impl.d.ts +0 -1
  7. package/{src → dist/src}/executors/playwright/playwright.impl.js +2 -0
  8. package/{src → dist/src}/executors/playwright/schema.json +1 -0
  9. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  10. package/{src → dist/src}/generators/configuration/configuration.js +55 -27
  11. package/{src/generators/configuration/files/playwright.config.ts.template → dist/src/generators/configuration/files/playwright.config.mts.template} +10 -3
  12. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
  13. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +5 -3
  14. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  15. package/{src → dist/src}/generators/init/init.js +5 -3
  16. package/{src → dist/src}/generators/init/schema.json +1 -1
  17. package/dist/src/migrations/update-19-6-0/use-serve-static-preview-for-command.d.ts +1 -0
  18. package/dist/src/migrations/update-19-6-0/use-serve-static-preview-for-command.js +2 -0
  19. package/{src → dist/src}/plugins/plugin.d.ts +0 -1
  20. package/{src → dist/src}/plugins/plugin.js +56 -28
  21. package/{src → dist/src}/utils/add-linter.d.ts +0 -1
  22. package/{src → dist/src}/utils/add-linter.js +12 -14
  23. package/dist/src/utils/assert-supported-playwright-version.d.ts +2 -0
  24. package/dist/src/utils/assert-supported-playwright-version.js +8 -0
  25. package/dist/src/utils/deprecation.d.ts +3 -0
  26. package/dist/src/utils/deprecation.js +16 -0
  27. package/{src → dist/src}/utils/preset.d.ts +4 -2
  28. package/{src → dist/src}/utils/preset.js +15 -3
  29. package/{src → dist/src}/utils/reporters.d.ts +0 -1
  30. package/dist/src/utils/versions.d.ts +5 -0
  31. package/dist/src/utils/versions.js +9 -0
  32. package/executors.json +4 -4
  33. package/generators.json +6 -6
  34. package/package.json +61 -34
  35. package/index.d.ts.map +0 -1
  36. package/plugin.d.ts.map +0 -1
  37. package/preset.d.ts.map +0 -1
  38. package/src/executors/merge-reports/merge-reports.impl.d.ts.map +0 -1
  39. package/src/executors/playwright/playwright.impl.d.ts.map +0 -1
  40. package/src/generators/configuration/configuration.d.ts.map +0 -1
  41. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
  42. package/src/generators/init/init.d.ts.map +0 -1
  43. package/src/migrations/update-19-6-0/use-serve-static-preview-for-command.d.ts +0 -1
  44. package/src/migrations/update-19-6-0/use-serve-static-preview-for-command.d.ts.map +0 -1
  45. package/src/migrations/update-19-6-0/use-serve-static-preview-for-command.js +0 -0
  46. package/src/plugins/plugin.d.ts.map +0 -1
  47. package/src/utils/add-linter.d.ts.map +0 -1
  48. package/src/utils/preset.d.ts.map +0 -1
  49. package/src/utils/reporters.d.ts.map +0 -1
  50. package/src/utils/versions.d.ts +0 -4
  51. package/src/utils/versions.d.ts.map +0 -1
  52. package/src/utils/versions.js +0 -6
  53. /package/{LICENSE → dist/LICENSE} +0 -0
  54. /package/{PLUGIN.md → dist/PLUGIN.md} +0 -0
  55. /package/{index.js → dist/index.js} +0 -0
  56. /package/{plugin.js → dist/plugin.js} +0 -0
  57. /package/{preset.js → dist/preset.js} +0 -0
  58. /package/{src → dist/src}/executors/merge-reports/schema.d.ts +0 -0
  59. /package/{src → dist/src}/executors/merge-reports/schema.json +0 -0
  60. /package/{src → dist/src}/generators/configuration/files/__directory__/example.spec.ts.template +0 -0
  61. /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
  62. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  63. /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
  64. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  65. /package/{src → dist/src}/utils/reporters.js +0 -0
@@ -1,4 +1,3 @@
1
1
  export { playwrightExecutor, PlaywrightExecutorSchema, } from './src/executors/playwright/playwright.impl';
2
2
  export { initGenerator } from './src/generators/init/init';
3
3
  export { configurationGenerator } from './src/generators/configuration/configuration';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { createNodes, createNodesV2, PlaywrightPluginOptions, } from './src/plugins/plugin';
2
- //# sourceMappingURL=plugin.d.ts.map
@@ -1,2 +1 @@
1
1
  export * from './src/utils/preset';
2
- //# sourceMappingURL=preset.d.ts.map
@@ -4,4 +4,3 @@ export declare function mergeReportsExecutor(options: Schema, context: ExecutorC
4
4
  success: boolean;
5
5
  }>;
6
6
  export default mergeReportsExecutor;
7
- //# sourceMappingURL=merge-reports.impl.d.ts.map
@@ -1,17 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mergeReportsExecutor = mergeReportsExecutor;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
6
6
  const node_child_process_1 = require("node:child_process");
7
7
  const node_fs_1 = require("node:fs");
8
8
  const node_path_1 = require("node:path");
9
+ const semver_1 = require("semver");
9
10
  const reporters_1 = require("../../utils/reporters");
11
+ const versions_1 = require("../../utils/versions");
10
12
  async function mergeReportsExecutor(options, context) {
13
+ const installed = (0, internal_1.getInstalledPackageVersion)('@playwright/test');
14
+ if (installed && (0, semver_1.lt)(installed, versions_1.minPlaywrightVersionForBlobReports)) {
15
+ throw new Error(`The "@nx/playwright:merge-reports" executor requires "@playwright/test" version ${versions_1.minPlaywrightVersionForBlobReports} or greater (the version that introduced the "blob" reporter and the "merge-reports" CLI). You are currently using version ${installed}.`);
16
+ }
11
17
  const { config, expectedSuites } = options;
12
18
  const projectRoot = (0, node_path_1.join)(context.root, context.projectsConfigurations.projects[context.projectName].root);
13
19
  const configPath = (0, node_path_1.join)(projectRoot, config);
14
- const playwrightConfig = await (0, config_utils_1.loadConfigFile)(configPath);
20
+ const playwrightConfig = await (0, internal_1.loadConfigFile)(configPath);
15
21
  const reporterOutputs = (0, reporters_1.getReporterOutputs)(playwrightConfig);
16
22
  const blobReporterOutput = reporterOutputs.find(([reporter]) => reporter === 'blob');
17
23
  if (!blobReporterOutput) {
@@ -37,4 +37,3 @@ export declare function playwrightExecutor(options: PlaywrightExecutorSchema, co
37
37
  success: boolean;
38
38
  }>;
39
39
  export default playwrightExecutor;
40
- //# sourceMappingURL=playwright.impl.d.ts.map
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.playwrightExecutor = playwrightExecutor;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const child_process_1 = require("child_process");
6
+ const deprecation_1 = require("../../utils/deprecation");
6
7
  async function playwrightExecutor(options, context) {
8
+ (0, deprecation_1.warnPlaywrightExecutorDeprecation)();
7
9
  const projectRoot = context.projectGraph?.nodes?.[context?.projectName]?.data?.root;
8
10
  if (!projectRoot) {
9
11
  throw new Error(`Unable to find the Project Root for ${context.projectName}. Is it set in the project.json?`);
@@ -3,6 +3,7 @@
3
3
  "version": 2,
4
4
  "title": "Playwright executor",
5
5
  "description": "Run Playwright tests.",
6
+ "x-deprecated": "The `@nx/playwright:playwright` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/playwright:convert-to-inferred` to migrate to the `@nx/playwright/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
6
7
  "type": "object",
7
8
  "properties": {
8
9
  "browser": {
@@ -3,4 +3,3 @@ import type { ConfigurationGeneratorSchema } from './schema';
3
3
  export declare function configurationGenerator(tree: Tree, options: ConfigurationGeneratorSchema): Promise<GeneratorCallback>;
4
4
  export declare function configurationGeneratorInternal(tree: Tree, rawOptions: ConfigurationGeneratorSchema): Promise<GeneratorCallback>;
5
5
  export default configurationGenerator;
6
- //# sourceMappingURL=configuration.d.ts.map
@@ -3,24 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configurationGenerator = configurationGenerator;
4
4
  exports.configurationGeneratorInternal = configurationGeneratorInternal;
5
5
  const tslib_1 = require("tslib");
6
+ const internal_1 = require("@nx/devkit/internal");
6
7
  const devkit_1 = require("@nx/devkit");
7
- const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
8
- const prompt_1 = require("@nx/devkit/src/generators/prompt");
9
8
  const js_1 = require("@nx/js");
10
- const generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
11
- const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
12
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
13
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
9
+ const internal_2 = require("@nx/js/internal");
10
+ const deprecation_1 = require("../../utils/deprecation");
14
11
  const child_process_1 = require("child_process");
15
12
  const path = tslib_1.__importStar(require("path"));
16
13
  const add_linter_1 = require("../../utils/add-linter");
14
+ const assert_supported_playwright_version_1 = require("../../utils/assert-supported-playwright-version");
17
15
  const versions_1 = require("../../utils/versions");
18
16
  const init_1 = require("../init/init");
19
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
17
+ const internal_3 = require("@nx/eslint/internal");
20
18
  function configurationGenerator(tree, options) {
21
19
  return configurationGeneratorInternal(tree, { addPlugin: false, ...options });
22
20
  }
23
21
  async function configurationGeneratorInternal(tree, rawOptions) {
22
+ (0, assert_supported_playwright_version_1.assertSupportedPlaywrightVersion)(tree);
24
23
  const options = await normalizeOptions(tree, rawOptions);
25
24
  const tasks = [];
26
25
  tasks.push(await (0, init_1.initGenerator)(tree, {
@@ -30,14 +29,25 @@ async function configurationGeneratorInternal(tree, rawOptions) {
30
29
  }));
31
30
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
32
31
  const offsetFromProjectRoot = (0, devkit_1.offsetFromRoot)(projectConfig.root);
32
+ const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(tree);
33
+ // Always emit `playwright.config.mts`. Node forces `.mts` to ESM
34
+ // regardless of workspace `type`, so Playwright's runtime routes it
35
+ // through the ESM loader (`requireOrImport` -> dynamic `import()`),
36
+ // bypassing the pirates CJS-compile path that breaks ESM-shape `.ts`
37
+ // configs. Nx's native TS strip loads `.mts` directly via `loadTsFile`.
38
+ // Playwright's configLoader auto-discovers `.mts` (extension list at
39
+ // configLoader.js:313 is `.ts/.js/.mts/.mjs/.cts/.cjs`).
33
40
  (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectConfig.root, {
34
41
  offsetFromRoot: offsetFromProjectRoot,
35
42
  projectRoot: projectConfig.root,
36
43
  webServerCommand: options.webServerCommand ?? null,
37
44
  webServerAddress: options.webServerAddress ?? null,
45
+ isTsSolutionSetup,
38
46
  ...options,
39
47
  });
40
- const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
48
+ const playwrightConfigFile = options.js
49
+ ? 'playwright.config.mjs'
50
+ : 'playwright.config.mts';
41
51
  const tsconfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
42
52
  if (tree.exists(tsconfigPath)) {
43
53
  if (isTsSolutionSetup) {
@@ -51,7 +61,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
51
61
  include: [
52
62
  (0, devkit_1.joinPathFragments)(options.directory, '**/*.ts'),
53
63
  (0, devkit_1.joinPathFragments)(options.directory, '**/*.js'),
54
- 'playwright.config.ts',
64
+ playwrightConfigFile,
55
65
  ],
56
66
  exclude: ['out-tsc', 'test-output'],
57
67
  };
@@ -79,7 +89,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
79
89
  include: [
80
90
  '**/*.ts',
81
91
  '**/*.js',
82
- 'playwright.config.ts',
92
+ playwrightConfigFile,
83
93
  'src/**/*.spec.ts',
84
94
  'src/**/*.spec.js',
85
95
  'src/**/*.test.ts',
@@ -112,7 +122,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
112
122
  if (isTsSolutionSetup) {
113
123
  const packageJsonPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'package.json');
114
124
  if (!tree.exists(packageJsonPath)) {
115
- const importPath = (0, project_name_and_root_utils_1.resolveImportPath)(tree, projectConfig.name, projectConfig.root);
125
+ const importPath = (0, internal_1.resolveImportPath)(tree, projectConfig.name, projectConfig.root);
116
126
  const packageJson = {
117
127
  name: importPath,
118
128
  version: '0.0.1',
@@ -129,6 +139,7 @@ async function configurationGeneratorInternal(tree, rawOptions) {
129
139
  ? p === '@nx/playwright/plugin'
130
140
  : p.plugin === '@nx/playwright/plugin');
131
141
  if (!hasPlugin) {
142
+ (0, deprecation_1.warnPlaywrightExecutorGenerating)();
132
143
  addE2eTarget(tree, options);
133
144
  setupE2ETargetDefaults(tree);
134
145
  }
@@ -143,8 +154,8 @@ async function configurationGeneratorInternal(tree, rawOptions) {
143
154
  addPlugin: options.addPlugin,
144
155
  }));
145
156
  if (options.js) {
146
- const { ModuleKind } = (0, ensure_typescript_1.ensureTypescript)();
147
- (0, devkit_1.toJS)(tree, { extension: '.cjs', module: ModuleKind.CommonJS });
157
+ const { ModuleKind } = (0, internal_2.ensureTypescript)();
158
+ (0, devkit_1.toJS)(tree, { extension: '.mjs', module: ModuleKind.ESNext });
148
159
  }
149
160
  recommendVsCodeExtensions(tree);
150
161
  if (!options.skipPackageJson) {
@@ -160,9 +171,9 @@ async function configurationGeneratorInternal(tree, rawOptions) {
160
171
  await (0, devkit_1.formatFiles)(tree);
161
172
  }
162
173
  if (isTsSolutionSetup) {
163
- const projectPackageManagerWorkspaceState = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(tree, projectConfig.root);
174
+ const projectPackageManagerWorkspaceState = (0, internal_2.getProjectPackageManagerWorkspaceState)(tree, projectConfig.root);
164
175
  if (projectPackageManagerWorkspaceState !== 'included') {
165
- tasks.push((0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, tree.root));
176
+ tasks.push((0, internal_2.getProjectPackageManagerWorkspaceStateWarningTask)(projectPackageManagerWorkspaceState, tree.root));
166
177
  }
167
178
  }
168
179
  return (0, devkit_1.runTasksInSerial)(...tasks);
@@ -172,7 +183,7 @@ async function normalizeOptions(tree, options) {
172
183
  const addPlugin = options.addPlugin ??
173
184
  (process.env.NX_ADD_PLUGINS !== 'false' &&
174
185
  nxJson.useInferencePlugins !== false);
175
- const linter = await (0, generator_prompts_1.normalizeLinterOption)(tree, options.linter);
186
+ const linter = await (0, internal_2.normalizeLinterOption)(tree, options.linter);
176
187
  if (!options.webServerCommand || !options.webServerAddress) {
177
188
  const { webServerCommand, webServerAddress } = await promptForMissingServeData(options.project);
178
189
  options.webServerCommand = webServerCommand;
@@ -186,7 +197,7 @@ async function normalizeOptions(tree, options) {
186
197
  };
187
198
  }
188
199
  async function promptForMissingServeData(projectName) {
189
- const { command, port } = await (0, prompt_1.promptWhenInteractive)([
200
+ const { command, port } = await (0, internal_1.promptWhenInteractive)([
190
201
  {
191
202
  type: 'input',
192
203
  name: 'command',
@@ -243,15 +254,30 @@ function setupE2ETargetDefaults(tree) {
243
254
  return;
244
255
  }
245
256
  // E2e targets depend on all their project's sources + production sources of dependencies
246
- nxJson.targetDefaults ??= {};
247
257
  const productionFileSet = !!nxJson.namedInputs?.production;
248
- nxJson.targetDefaults.e2e ??= {};
249
- nxJson.targetDefaults.e2e.cache ??= true;
250
- nxJson.targetDefaults.e2e.inputs ??= [
251
- 'default',
252
- productionFileSet ? '^production' : '^default',
253
- ];
254
- (0, devkit_1.updateNxJson)(tree, nxJson);
258
+ // Either a `target: 'e2e'` default or a default keyed on the executor
259
+ // we're about to scaffold will apply to the new target — consider both
260
+ // before deciding to add cache/inputs. Target-keyed wins when both are
261
+ // present.
262
+ const existingForTarget = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
263
+ target: 'e2e',
264
+ });
265
+ const existingForExecutor = (0, internal_1.findTargetDefault)(nxJson.targetDefaults, {
266
+ executor: '@nx/playwright:playwright',
267
+ });
268
+ const existingCache = existingForTarget?.cache ?? existingForExecutor?.cache;
269
+ const existingInputs = existingForTarget?.inputs ?? existingForExecutor?.inputs;
270
+ const patch = {};
271
+ if (existingCache === undefined) {
272
+ patch.cache = true;
273
+ }
274
+ if (existingInputs === undefined) {
275
+ patch.inputs = ['default', productionFileSet ? '^production' : '^default'];
276
+ }
277
+ if (Object.keys(patch).length > 0) {
278
+ (0, internal_1.upsertTargetDefault)(tree, nxJson, { target: 'e2e', ...patch });
279
+ (0, devkit_1.updateNxJson)(tree, nxJson);
280
+ }
255
281
  }
256
282
  function addE2eTarget(tree, options) {
257
283
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
@@ -264,7 +290,9 @@ Rename or remove the existing e2e target.`);
264
290
  executor: '@nx/playwright:playwright',
265
291
  outputs: [`{workspaceRoot}/dist/.playwright/${projectConfig.root}`],
266
292
  options: {
267
- config: `${projectConfig.root}/playwright.config.${options.js ? 'cjs' : 'ts'}`,
293
+ // Generator emits `playwright.config.mts` (`.mjs` for `--js`) so the
294
+ // legacy executor's `--config` flag must point at the same extension.
295
+ config: `${projectConfig.root}/playwright.config.${options.js ? 'mjs' : 'mts'}`,
268
296
  },
269
297
  };
270
298
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
@@ -272,7 +300,7 @@ Rename or remove the existing e2e target.`);
272
300
  function ignoreTestOutput(tree, options) {
273
301
  // Make sure playwright outputs are not linted.
274
302
  if (options.linter === 'eslint') {
275
- (0, eslint_file_1.addIgnoresToLintConfig)(tree, '', ['**/test-output']);
303
+ (0, internal_3.addIgnoresToLintConfig)(tree, '', ['**/test-output']);
276
304
  }
277
305
  // Handle gitignore
278
306
  if (!tree.exists('.gitignore')) {
@@ -9,13 +9,20 @@ const baseURL = process.env['BASE_URL'] || '<% if(webServerAddress) {%><%= webSe
9
9
  * Read environment variables from file.
10
10
  * https://github.com/motdotla/dotenv
11
11
  */
12
- // require('dotenv').config();
12
+ // import 'dotenv/config';
13
13
 
14
14
  /**
15
15
  * See https://playwright.dev/docs/test-configuration.
16
+ *
17
+ * Generated as a .mts file so Node forces ESM regardless of workspace
18
+ * `type`. Playwright routes `.mts` through its ESM loader (dynamic import,
19
+ * bypassing the pirates CJS-compile path), and Nx's native TS strip loads
20
+ * `.mts` directly. Playwright's configLoader auto-discovers
21
+ * `playwright.config.mts` via its extension list
22
+ * (.ts/.js/.mts/.mjs/.cts/.cjs).
16
23
  */
17
24
  export default defineConfig({
18
- ...nxE2EPreset(__filename, { testDir: './<%= directory %>' }),
25
+ ...nxE2EPreset(import.meta.dirname, { testDir: './<%= directory %>' }),
19
26
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
20
27
  use: {
21
28
  baseURL,
@@ -50,7 +57,7 @@ export default defineConfig({
50
57
  name: "webkit",
51
58
  use: { ...devices["Desktop Safari"] },
52
59
  },
53
-
60
+
54
61
  // Uncomment for mobile browsers support
55
62
  /* {
56
63
  name: 'Mobile Chrome',
@@ -6,4 +6,3 @@ interface Schema {
6
6
  }
7
7
  export declare function convertToInferred(tree: Tree, options: Schema): Promise<void>;
8
8
  export default convertToInferred;
9
- //# sourceMappingURL=convert-to-inferred.d.ts.map
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToInferred = convertToInferred;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
6
  const plugin_1 = require("../../plugins/plugin");
6
- const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
7
+ const assert_supported_playwright_version_1 = require("../../utils/assert-supported-playwright-version");
7
8
  async function convertToInferred(tree, options) {
9
+ (0, assert_supported_playwright_version_1.assertSupportedPlaywrightVersion)(tree);
8
10
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
9
- const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/playwright/plugin', plugin_1.createNodesV2, { targetName: 'e2e', ciTargetName: 'e2e-ci' }, [
11
+ const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/playwright/plugin', plugin_1.createNodesV2, { targetName: 'e2e', ciTargetName: 'e2e-ci' }, [
10
12
  {
11
13
  executors: ['@nx/playwright:playwright'],
12
14
  postTargetTransformer,
@@ -14,7 +16,7 @@ async function convertToInferred(tree, options) {
14
16
  },
15
17
  ], options.project);
16
18
  if (migratedProjects.size === 0) {
17
- throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
19
+ throw new internal_1.NoTargetsToMigrateError();
18
20
  }
19
21
  if (!options.skipFormat) {
20
22
  await (0, devkit_1.formatFiles)(tree);
@@ -3,4 +3,3 @@ import { InitGeneratorSchema } from './schema';
3
3
  export declare function initGenerator(tree: Tree, options: InitGeneratorSchema): Promise<GeneratorCallback>;
4
4
  export declare function initGeneratorInternal(tree: Tree, options: InitGeneratorSchema): Promise<GeneratorCallback>;
5
5
  export default initGenerator;
6
- //# sourceMappingURL=init.d.ts.map
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initGenerator = initGenerator;
4
4
  exports.initGeneratorInternal = initGeneratorInternal;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
+ const assert_supported_playwright_version_1 = require("../../utils/assert-supported-playwright-version");
8
9
  const versions_1 = require("../../utils/versions");
9
10
  function initGenerator(tree, options) {
10
11
  return initGeneratorInternal(tree, { addPlugin: false, ...options });
11
12
  }
12
13
  async function initGeneratorInternal(tree, options) {
14
+ (0, assert_supported_playwright_version_1.assertSupportedPlaywrightVersion)(tree);
13
15
  const tasks = [];
14
16
  const nxJson = (0, devkit_1.readNxJson)(tree);
15
17
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
@@ -19,10 +21,10 @@ async function initGeneratorInternal(tree, options) {
19
21
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
20
22
  '@nx/playwright': versions_1.nxVersion,
21
23
  '@playwright/test': versions_1.playwrightVersion,
22
- }, undefined, options.keepExistingVersions));
24
+ }, undefined, options.keepExistingVersions ?? true));
23
25
  }
24
26
  if (options.addPlugin) {
25
- await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/playwright/plugin', plugin_1.createNodesV2, { targetName: ['e2e', 'playwright:e2e', 'playwright-e2e'] }, options.updatePackageScripts);
27
+ await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/playwright/plugin', plugin_1.createNodesV2, { targetName: ['e2e', 'playwright:e2e', 'playwright-e2e'] }, options.updatePackageScripts);
26
28
  }
27
29
  if (!options.skipFormat) {
28
30
  await (0, devkit_1.formatFiles)(tree);
@@ -21,7 +21,7 @@
21
21
  "type": "boolean",
22
22
  "x-priority": "internal",
23
23
  "description": "Keep existing dependencies versions",
24
- "default": false
24
+ "default": true
25
25
  },
26
26
  "updatePackageScripts": {
27
27
  "type": "boolean",
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,4 +5,3 @@ export interface PlaywrightPluginOptions {
5
5
  }
6
6
  export declare const createNodes: CreateNodesV2<PlaywrightPluginOptions>;
7
7
  export declare const createNodesV2: CreateNodesV2<PlaywrightPluginOptions>;
8
- //# sourceMappingURL=plugin.d.ts.map
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNodesV2 = exports.createNodes = void 0;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
- const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
7
- const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
8
6
  const js_1 = require("@nx/js");
9
- const internal_1 = require("@nx/js/src/internal");
7
+ const internal_2 = require("@nx/js/internal");
10
8
  const minimatch_1 = require("minimatch");
11
9
  const node_fs_1 = require("node:fs");
12
10
  const node_path_1 = require("node:path");
@@ -22,33 +20,41 @@ exports.createNodes = [
22
20
  const optionsHash = (0, file_hasher_1.hashObject)(options);
23
21
  const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `playwright-${optionsHash}.hash`);
24
22
  const pluginCache = new plugin_cache_utils_1.PluginCache(cachePath);
25
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
23
+ const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
24
+ const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
25
+ const lockFileName = (0, js_1.getLockFileName)(packageManager);
26
+ const normalizedOptions = normalizeOptions(options);
26
27
  try {
27
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, pluginCache, pmc), configFilePaths, options, context);
28
+ const { entries, preErrors } = await filterPlaywrightConfigs(configFilePaths, context);
29
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), { ...normalizedOptions, CI: process.env.CI }, context, entries.map((e) => [lockFileName, ...e.externalTsconfigInputs]));
30
+ let results = [];
31
+ let nodeErrors = [];
32
+ try {
33
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, pluginCache, pmc, entries[idx].externalTsconfigInputs, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
34
+ }
35
+ catch (e) {
36
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
37
+ results = e.partialResults ?? [];
38
+ nodeErrors = e.errors;
39
+ }
40
+ else {
41
+ throw e;
42
+ }
43
+ }
44
+ const allErrors = [...preErrors, ...nodeErrors];
45
+ if (allErrors.length > 0) {
46
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
47
+ }
48
+ return results;
28
49
  }
29
50
  finally {
30
- pluginCache.writeToDisk(cachePath);
51
+ pluginCache.writeToDisk();
31
52
  }
32
53
  },
33
54
  ];
34
55
  exports.createNodesV2 = exports.createNodes;
35
- async function createNodesInternal(configFilePath, options, context, pluginCache, pmc) {
56
+ async function createNodesInternal(configFilePath, normalizedOptions, context, pluginCache, pmc, externalTsconfigInputs, hash) {
36
57
  const projectRoot = (0, node_path_1.dirname)(configFilePath);
37
- // Do not create a project if package.json and project.json isn't there.
38
- const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
39
- if (!siblingFiles.includes('package.json') &&
40
- !siblingFiles.includes('project.json')) {
41
- return {};
42
- }
43
- const normalizedOptions = normalizeOptions(options);
44
- const externalTsconfigInputs = collectExternalTsconfigInputs(projectRoot, context.workspaceRoot);
45
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, {
46
- ...normalizedOptions,
47
- CI: process.env.CI,
48
- }, context, [
49
- (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
50
- ...externalTsconfigInputs,
51
- ]);
52
58
  if (!pluginCache.has(hash)) {
53
59
  pluginCache.set(hash, await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context, pmc, externalTsconfigInputs));
54
60
  }
@@ -68,8 +74,8 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
68
74
  // but we're just reading the config so let's delete the variable they are using to detect this.
69
75
  // See: https://github.com/microsoft/playwright/pull/11218/files
70
76
  delete process['__pw_initiator__'];
71
- const playwrightConfig = await (0, config_utils_1.loadConfigFile)((0, node_path_1.join)(context.workspaceRoot, configFilePath));
72
- const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
77
+ const playwrightConfig = await (0, internal_1.loadConfigFile)((0, node_path_1.join)(context.workspaceRoot, configFilePath));
78
+ const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
73
79
  const tsconfigJsonInputs = externalTsconfigInputs.map((file) => ({
74
80
  json: `{workspaceRoot}/${file}`,
75
81
  fields: ['compilerOptions', 'extends', 'files', 'include'],
@@ -187,7 +193,6 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
187
193
  };
188
194
  dependsOn.push({
189
195
  target: targetName,
190
- projects: 'self',
191
196
  params: 'forward',
192
197
  options: 'forward',
193
198
  });
@@ -409,6 +414,29 @@ function normalizeAtomizedTaskBlobReportOutput(output, subfolder) {
409
414
  ? (0, devkit_1.joinPathFragments)((0, node_path_1.dirname)(output), `${subfolder}.zip`)
410
415
  : (0, devkit_1.joinPathFragments)(output, `${subfolder}.zip`);
411
416
  }
417
+ async function filterPlaywrightConfigs(configFilePaths, context) {
418
+ const preErrors = [];
419
+ const candidates = await Promise.all(configFilePaths.map(async (configFile) => {
420
+ try {
421
+ const projectRoot = (0, node_path_1.dirname)(configFile);
422
+ const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
423
+ if (!siblingFiles.includes('package.json') &&
424
+ !siblingFiles.includes('project.json')) {
425
+ return null;
426
+ }
427
+ const externalTsconfigInputs = collectExternalTsconfigInputs(projectRoot, context.workspaceRoot);
428
+ return { configFile, projectRoot, externalTsconfigInputs };
429
+ }
430
+ catch (e) {
431
+ preErrors.push([configFile, e]);
432
+ return null;
433
+ }
434
+ }));
435
+ return {
436
+ entries: candidates.filter((c) => c !== null),
437
+ preErrors,
438
+ };
439
+ }
412
440
  /**
413
441
  * Collects tsconfig files read by the Playwright task that are NOT already
414
442
  * covered by other inputs, returned as workspace-relative paths.
@@ -454,11 +482,11 @@ function collectExternalTsconfigInputs(projectRoot, workspaceRoot) {
454
482
  };
455
483
  const projectTsconfig = (0, node_path_1.join)(workspaceRoot, projectRoot, 'tsconfig.json');
456
484
  if ((0, node_fs_1.existsSync)(projectTsconfig)) {
457
- (0, internal_1.walkTsconfigExtendsChain)(projectTsconfig, visit);
485
+ (0, internal_2.walkTsconfigExtendsChain)(projectTsconfig, visit);
458
486
  }
459
487
  const rootTsconfig = (0, node_path_1.join)(workspaceRoot, 'tsconfig.json');
460
488
  if ((0, node_fs_1.existsSync)(rootTsconfig)) {
461
- (0, internal_1.walkTsconfigExtendsChain)(rootTsconfig, visit);
489
+ (0, internal_2.walkTsconfigExtendsChain)(rootTsconfig, visit);
462
490
  }
463
491
  return collected;
464
492
  }
@@ -14,4 +14,3 @@ export interface PlaywrightLinterOptions {
14
14
  addPlugin?: boolean;
15
15
  }
16
16
  export declare function addLinterToPlaywrightProject(tree: Tree, options: PlaywrightLinterOptions): Promise<GeneratorCallback>;
17
- //# sourceMappingURL=add-linter.d.ts.map
@@ -3,17 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinterToPlaywrightProject = addLinterToPlaywrightProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const eslint_1 = require("@nx/eslint");
6
- const global_eslint_config_1 = require("@nx/eslint/src/generators/init/global-eslint-config");
6
+ const internal_1 = require("@nx/eslint/internal");
7
7
  const versions_1 = require("./versions");
8
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
9
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
10
8
  async function addLinterToPlaywrightProject(tree, options) {
11
9
  if (options.linter === 'none') {
12
10
  return () => { };
13
11
  }
14
12
  const tasks = [];
15
13
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
16
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectConfig.root);
14
+ const eslintFile = (0, internal_1.findEslintFile)(tree, projectConfig.root);
17
15
  if (!eslintFile) {
18
16
  tasks.push(await (0, eslint_1.lintProjectGenerator)(tree, {
19
17
  project: options.project,
@@ -30,30 +28,30 @@ async function addLinterToPlaywrightProject(tree, options) {
30
28
  return (0, devkit_1.runTasksInSerial)(...tasks);
31
29
  }
32
30
  tasks.push(!options.skipPackageJson
33
- ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'eslint-plugin-playwright': versions_1.eslintPluginPlaywrightVersion })
31
+ ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'eslint-plugin-playwright': versions_1.eslintPluginPlaywrightVersion }, undefined, true)
34
32
  : () => { });
35
- if ((0, eslint_file_1.isEslintConfigSupported)(tree, projectConfig.root) ||
36
- (0, eslint_file_1.isEslintConfigSupported)(tree)) {
37
- if ((0, flat_config_1.useFlatConfig)(tree)) {
38
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, projectConfig.root, 'flat/recommended', {
33
+ if ((0, internal_1.isEslintConfigSupported)(tree, projectConfig.root) ||
34
+ (0, internal_1.isEslintConfigSupported)(tree)) {
35
+ if ((0, internal_1.useFlatConfig)(tree)) {
36
+ (0, internal_1.addPredefinedConfigToFlatLintConfig)(tree, projectConfig.root, 'flat/recommended', {
39
37
  moduleName: 'playwright',
40
38
  moduleImportPath: 'eslint-plugin-playwright',
41
39
  spread: false,
42
40
  insertAtTheEnd: false,
43
41
  });
44
- (0, eslint_file_1.addOverrideToLintConfig)(tree, projectConfig.root, {
42
+ (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, {
45
43
  files: ['*.ts', '*.js'],
46
44
  rules: {},
47
45
  });
48
46
  }
49
47
  else {
50
- const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:playwright/recommended');
48
+ const addExtendsTask = (0, internal_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:playwright/recommended');
51
49
  tasks.push(addExtendsTask);
52
50
  if (options.rootProject) {
53
- (0, eslint_file_1.addPluginsToLintConfig)(tree, projectConfig.root, '@nx');
54
- (0, eslint_file_1.addOverrideToLintConfig)(tree, projectConfig.root, global_eslint_config_1.javaScriptOverride);
51
+ (0, internal_1.addPluginsToLintConfig)(tree, projectConfig.root, '@nx');
52
+ (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, internal_1.javaScriptOverride);
55
53
  }
56
- (0, eslint_file_1.addOverrideToLintConfig)(tree, projectConfig.root, {
54
+ (0, internal_1.addOverrideToLintConfig)(tree, projectConfig.root, {
57
55
  files: [`${options.directory}/**/*.{ts,js,tsx,jsx}`],
58
56
  parserOptions: !options.setParserOptionsProject
59
57
  ? undefined
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function assertSupportedPlaywrightVersion(tree: Tree): void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSupportedPlaywrightVersion = assertSupportedPlaywrightVersion;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ const versions_1 = require("./versions");
6
+ function assertSupportedPlaywrightVersion(tree) {
7
+ (0, internal_1.assertSupportedPackageVersion)(tree, '@playwright/test', versions_1.minSupportedPlaywrightVersion);
8
+ }
@@ -0,0 +1,3 @@
1
+ export declare const PLAYWRIGHT_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/playwright:playwright` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/playwright:convert-to-inferred` to migrate to the `@nx/playwright/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
2
+ export declare function warnPlaywrightExecutorDeprecation(): void;
3
+ export declare function warnPlaywrightExecutorGenerating(): void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLAYWRIGHT_EXECUTOR_DEPRECATION_MESSAGE = void 0;
4
+ exports.warnPlaywrightExecutorDeprecation = warnPlaywrightExecutorDeprecation;
5
+ exports.warnPlaywrightExecutorGenerating = warnPlaywrightExecutorGenerating;
6
+ const devkit_1 = require("@nx/devkit");
7
+ // TODO(v24): Remove the @nx/playwright:playwright executor. The inferred
8
+ // plugin (@nx/playwright/plugin) and the convert-to-inferred generator stay
9
+ // supported.
10
+ exports.PLAYWRIGHT_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/playwright:playwright` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/playwright:convert-to-inferred` to migrate to the `@nx/playwright/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
11
+ function warnPlaywrightExecutorDeprecation() {
12
+ devkit_1.logger.warn(exports.PLAYWRIGHT_EXECUTOR_DEPRECATION_MESSAGE);
13
+ }
14
+ function warnPlaywrightExecutorGenerating() {
15
+ devkit_1.logger.warn('Generating a target that uses the deprecated `@nx/playwright:playwright` executor. The executor will be removed in Nx v24. Run `nx g @nx/playwright:convert-to-inferred` next to migrate this target to the `@nx/playwright/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
16
+ }
@@ -30,8 +30,11 @@ export interface NxPlaywrightOptions {
30
30
  *
31
31
  * you can easily extend this within your playwright config via spreading the preset
32
32
  * @example
33
+ * // Nx generates `playwright.config.mts` (ESM). Pass `import.meta.dirname`.
34
+ * // For hand-written CJS configs (`.cts` or `.ts` outside a `type: "module"`
35
+ * // workspace), pass `__filename` instead.
33
36
  * export default defineConfig({
34
- * ...nxE2EPreset(__filename, options)
37
+ * ...nxE2EPreset(import.meta.dirname, options)
35
38
  * // add your own config here
36
39
  * })
37
40
  *
@@ -39,4 +42,3 @@ export interface NxPlaywrightOptions {
39
42
  * @param options optional configuration options
40
43
  */
41
44
  export declare function nxE2EPreset(pathToConfig: string, options?: NxPlaywrightOptions): import("@playwright/test").PlaywrightTestConfig<{}, {}>;
42
- //# sourceMappingURL=preset.d.ts.map
@@ -2,10 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxE2EPreset = nxE2EPreset;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
5
+ const internal_1 = require("@nx/devkit/internal");
6
+ const internal_2 = require("@nx/js/internal");
6
7
  const test_1 = require("@playwright/test");
7
8
  const node_fs_1 = require("node:fs");
8
9
  const node_path_1 = require("node:path");
10
+ const semver_1 = require("semver");
11
+ const versions_1 = require("./versions");
9
12
  /**
10
13
  * nx E2E Preset for Playwright
11
14
  * @description
@@ -20,8 +23,11 @@ const node_path_1 = require("node:path");
20
23
  *
21
24
  * you can easily extend this within your playwright config via spreading the preset
22
25
  * @example
26
+ * // Nx generates `playwright.config.mts` (ESM). Pass `import.meta.dirname`.
27
+ * // For hand-written CJS configs (`.cts` or `.ts` outside a `type: "module"`
28
+ * // workspace), pass `__filename` instead.
23
29
  * export default defineConfig({
24
- * ...nxE2EPreset(__filename, options)
30
+ * ...nxE2EPreset(import.meta.dirname, options)
25
31
  * // add your own config here
26
32
  * })
27
33
  *
@@ -34,7 +40,7 @@ function nxE2EPreset(pathToConfig, options) {
34
40
  : (0, node_path_1.dirname)(pathToConfig);
35
41
  const projectPath = (0, node_path_1.relative)(devkit_1.workspaceRoot, normalizedPath);
36
42
  const offset = (0, node_path_1.relative)(normalizedPath, devkit_1.workspaceRoot);
37
- const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
43
+ const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
38
44
  const testResultOuputDir = isTsSolutionSetup
39
45
  ? 'test-output/playwright/output'
40
46
  : (0, node_path_1.join)(offset, 'dist', '.playwright', projectPath, 'test-output');
@@ -48,6 +54,12 @@ function nxE2EPreset(pathToConfig, options) {
48
54
  open: options?.openHtmlReport ?? 'on-failure',
49
55
  },
50
56
  ]);
57
+ if (options?.generateBlobReports === true) {
58
+ const installed = (0, internal_1.getInstalledPackageVersion)('@playwright/test');
59
+ if (installed && (0, semver_1.lt)(installed, versions_1.minPlaywrightVersionForBlobReports)) {
60
+ throw new Error(`The "blob" reporter requires "@playwright/test" version ${versions_1.minPlaywrightVersionForBlobReports} or greater. You are currently using version ${installed}. Either upgrade "@playwright/test" or set "generateBlobReports" to false.`);
61
+ }
62
+ }
51
63
  const shouldGenerateBlobReports = options?.generateBlobReports ?? !!process.env['CI'];
52
64
  if (shouldGenerateBlobReports) {
53
65
  reporters.push([
@@ -1,4 +1,3 @@
1
1
  import type { PlaywrightTestConfig } from '@playwright/test';
2
2
  export type ReporterOutput = [reporter: string, output?: string];
3
3
  export declare function getReporterOutputs(playwrightConfig: PlaywrightTestConfig): Array<ReporterOutput>;
4
- //# sourceMappingURL=reporters.d.ts.map
@@ -0,0 +1,5 @@
1
+ export declare const nxVersion: any;
2
+ export declare const minSupportedPlaywrightVersion = "1.36.0";
3
+ export declare const minPlaywrightVersionForBlobReports = "1.37.0";
4
+ export declare const playwrightVersion = "^1.37.0";
5
+ export declare const eslintPluginPlaywrightVersion = "^1.6.2";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eslintPluginPlaywrightVersion = exports.playwrightVersion = exports.minPlaywrightVersionForBlobReports = exports.minSupportedPlaywrightVersion = exports.nxVersion = void 0;
4
+ const path_1 = require("path");
5
+ exports.nxVersion = require((0, path_1.join)('@nx/playwright', 'package.json')).version;
6
+ exports.minSupportedPlaywrightVersion = '1.36.0';
7
+ exports.minPlaywrightVersionForBlobReports = '1.37.0';
8
+ exports.playwrightVersion = '^1.37.0';
9
+ exports.eslintPluginPlaywrightVersion = '^1.6.2';
package/executors.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "executors": {
3
3
  "playwright": {
4
- "implementation": "./src/executors/playwright/playwright.impl",
5
- "schema": "./src/executors/playwright/schema.json",
4
+ "implementation": "./dist/src/executors/playwright/playwright.impl",
5
+ "schema": "./dist/src/executors/playwright/schema.json",
6
6
  "description": "Run Playwright tests."
7
7
  },
8
8
  "merge-reports": {
9
- "implementation": "./src/executors/merge-reports/merge-reports.impl",
10
- "schema": "./src/executors/merge-reports/schema.json",
9
+ "implementation": "./dist/src/executors/merge-reports/merge-reports.impl",
10
+ "schema": "./dist/src/executors/merge-reports/schema.json",
11
11
  "description": "Merge Playwright blob reports to produce unified reports for the configured reporters (excluding the `blob` reporter).",
12
12
  "hidden": true
13
13
  }
package/generators.json CHANGED
@@ -3,19 +3,19 @@
3
3
  "version": "0.1",
4
4
  "generators": {
5
5
  "configuration": {
6
- "factory": "./src/generators/configuration/configuration#configurationGeneratorInternal",
7
- "schema": "./src/generators/configuration/schema.json",
6
+ "factory": "./dist/src/generators/configuration/configuration#configurationGeneratorInternal",
7
+ "schema": "./dist/src/generators/configuration/schema.json",
8
8
  "description": "Add Nx Playwright configuration to your project"
9
9
  },
10
10
  "init": {
11
- "factory": "./src/generators/init/init#initGeneratorInternal",
12
- "schema": "./src/generators/init/schema.json",
11
+ "factory": "./dist/src/generators/init/init#initGeneratorInternal",
12
+ "schema": "./dist/src/generators/init/schema.json",
13
13
  "description": "Initializes a Playwright project in the current workspace",
14
14
  "hidden": true
15
15
  },
16
16
  "convert-to-inferred": {
17
- "factory": "./src/generators/convert-to-inferred/convert-to-inferred",
18
- "schema": "./src/generators/convert-to-inferred/schema.json",
17
+ "factory": "./dist/src/generators/convert-to-inferred/convert-to-inferred",
18
+ "schema": "./dist/src/generators/convert-to-inferred/schema.json",
19
19
  "description": "Convert existing Playwright project(s) using `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`."
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "23.0.0-beta.2",
4
- "type": "commonjs",
5
- "homepage": "https://nx.dev",
3
+ "version": "23.0.0-beta.20",
6
4
  "private": false,
7
- "publishConfig": {
8
- "access": "public"
9
- },
5
+ "type": "commonjs",
6
+ "files": [
7
+ "dist",
8
+ "!dist/tsconfig.tsbuildinfo",
9
+ "!dist/spec",
10
+ "migrations.json",
11
+ "executors.json",
12
+ "generators.json"
13
+ ],
10
14
  "description": "The Nx Plugin for Playwright contains executors and generators allowing your workspace to use the powerful Playwright integration testing capabilities.",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/nrwl/nx.git",
18
+ "directory": "packages/playwright"
19
+ },
11
20
  "keywords": [
12
21
  "Monorepo",
13
22
  "Angular",
@@ -21,27 +30,60 @@
21
30
  "Testing",
22
31
  "Front-end"
23
32
  ],
24
- "main": "./index.js",
25
- "types": "./index.d.ts",
33
+ "main": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "typesVersions": {
36
+ "*": {
37
+ "plugin": [
38
+ "dist/plugin.d.ts"
39
+ ],
40
+ "preset": [
41
+ "dist/preset.d.ts"
42
+ ]
43
+ }
44
+ },
45
+ "exports": {
46
+ ".": {
47
+ "@nx/nx-source": "./index.ts",
48
+ "types": "./dist/index.d.ts",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./package.json": "./package.json",
52
+ "./migrations.json": "./migrations.json",
53
+ "./generators.json": "./generators.json",
54
+ "./executors.json": "./executors.json",
55
+ "./plugin": {
56
+ "@nx/nx-source": "./plugin.ts",
57
+ "types": "./dist/plugin.d.ts",
58
+ "default": "./dist/plugin.js"
59
+ },
60
+ "./preset": {
61
+ "@nx/nx-source": "./preset.ts",
62
+ "types": "./dist/preset.d.ts",
63
+ "default": "./dist/preset.js"
64
+ }
65
+ },
26
66
  "author": "Victor Savkin",
27
67
  "license": "MIT",
28
68
  "bugs": {
29
69
  "url": "https://github.com/nrwl/nx/issues"
30
70
  },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/nrwl/nx.git",
34
- "directory": "packages/playwright"
71
+ "homepage": "https://nx.dev",
72
+ "executors": "./executors.json",
73
+ "generators": "./generators.json",
74
+ "nx-migrations": {
75
+ "migrations": "./migrations.json"
35
76
  },
36
77
  "dependencies": {
37
- "@nx/devkit": "23.0.0-beta.2",
38
- "@nx/eslint": "23.0.0-beta.2",
39
- "@nx/js": "23.0.0-beta.2",
40
78
  "tslib": "^2.3.0",
41
- "minimatch": "10.2.4"
79
+ "minimatch": "10.2.5",
80
+ "semver": "^7.6.3",
81
+ "@nx/devkit": "23.0.0-beta.20",
82
+ "@nx/eslint": "23.0.0-beta.20",
83
+ "@nx/js": "23.0.0-beta.20"
42
84
  },
43
85
  "devDependencies": {
44
- "nx": "23.0.0-beta.2"
86
+ "nx": "23.0.0-beta.20"
45
87
  },
46
88
  "peerDependencies": {
47
89
  "@playwright/test": "^1.36.0"
@@ -51,22 +93,7 @@
51
93
  "optional": true
52
94
  }
53
95
  },
54
- "executors": "./executors.json",
55
- "generators": "./generators.json",
56
- "exports": {
57
- ".": "./index.js",
58
- "./package.json": "./package.json",
59
- "./migrations.json": "./migrations.json",
60
- "./generators.json": "./generators.json",
61
- "./generators/*/schema.json": "./src/generators/*/schema.json",
62
- "./generators/*/schema": "./src/generators/*/schema.d.ts",
63
- "./executors.json": "./executors.json",
64
- "./executors/*/schema.json": "./src/executors/*/schema.json",
65
- "./executors/*/schema": "./src/executors/*/schema.d.ts",
66
- "./plugin": "./plugin.js",
67
- "./preset": "./src/utils/preset.js"
68
- },
69
- "nx-migrations": {
70
- "migrations": "./migrations.json"
96
+ "publishConfig": {
97
+ "access": "public"
71
98
  }
72
99
  }
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/playwright/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC"}
package/plugin.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../packages/playwright/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
package/preset.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../../packages/playwright/preset.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge-reports.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/executors/merge-reports/merge-reports.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe;;GAqHzB;AAED,eAAe,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"playwright.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/executors/playwright/playwright.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,wBAAwB;IAKvC,OAAO,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EACF,IAAI,GACJ,KAAK,GACL,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,eAAe;aAoCM,OAAO;GAKtC;AAkDD,eAAe,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAUjB,IAAI,EAML,MAAM,YAAY,CAAC;AAiBpB,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,UAAU,CAAC;AAGlB,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,8BAGtC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,4BAA4B,8BA+MzC;AA2JD,eAAe,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAOpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBA0BlE;AA+BD,eAAe,iBAAiB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,8BAErE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,8BA0C7B;AAED,eAAe,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=use-serve-static-preview-for-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-serve-static-preview-for-command.d.ts","sourceRoot":"","sources":["../../../../../../packages/playwright/src/migrations/update-19-6-0/use-serve-static-preview-for-command.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/playwright/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAQnB,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAWD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,uBAAuB,CAwB9D,CAAC;AAEF,eAAO,MAAM,aAAa,wCAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-linter.d.ts","sourceRoot":"","sources":["../../../../../packages/playwright/src/utils/add-linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAwB,MAAM,YAAY,CAAC;AAatE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,uBAAuB,EAAE,OAAO,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb;;QAEI;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAmF5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../../../../packages/playwright/src/utils/preset.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB;IAClC;;;QAGI;IACJ,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IACnD;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CACzB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,2DAmD9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reporters.d.ts","sourceRoot":"","sources":["../../../../../packages/playwright/src/utils/reporters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,oBAAoB,GACrC,KAAK,CAAC,cAAc,CAAC,CAuCvB"}
@@ -1,4 +0,0 @@
1
- export declare const nxVersion: any;
2
- export declare const playwrightVersion = "^1.36.0";
3
- export declare const eslintPluginPlaywrightVersion = "^1.6.2";
4
- //# sourceMappingURL=versions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/playwright/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAC/D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,6BAA6B,WAAW,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eslintPluginPlaywrightVersion = exports.playwrightVersion = exports.nxVersion = void 0;
4
- exports.nxVersion = require('../../package.json').version;
5
- exports.playwrightVersion = '^1.36.0';
6
- exports.eslintPluginPlaywrightVersion = '^1.6.2';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes