@nx/playwright 22.7.0-beta.12 → 22.7.0-beta.13

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/playwright",
3
- "version": "22.7.0-beta.12",
3
+ "version": "22.7.0-beta.13",
4
4
  "type": "commonjs",
5
5
  "homepage": "https://nx.dev",
6
6
  "private": false,
@@ -34,14 +34,14 @@
34
34
  "directory": "packages/playwright"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "22.7.0-beta.12",
38
- "@nx/eslint": "22.7.0-beta.12",
39
- "@nx/js": "22.7.0-beta.12",
37
+ "@nx/devkit": "22.7.0-beta.13",
38
+ "@nx/eslint": "22.7.0-beta.13",
39
+ "@nx/js": "22.7.0-beta.13",
40
40
  "tslib": "^2.3.0",
41
41
  "minimatch": "10.2.4"
42
42
  },
43
43
  "devDependencies": {
44
- "nx": "22.7.0-beta.12"
44
+ "nx": "22.7.0-beta.13"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@playwright/test": "^1.36.0"
@@ -1 +1 @@
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;AAepB,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
+ {"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"}
@@ -6,6 +6,7 @@ const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculat
6
6
  const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
7
7
  const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
8
8
  const js_1 = require("@nx/js");
9
+ const internal_1 = require("@nx/js/src/internal");
9
10
  const minimatch_1 = require("minimatch");
10
11
  const node_fs_1 = require("node:fs");
11
12
  const node_path_1 = require("node:path");
@@ -40,12 +41,16 @@ async function createNodesInternal(configFilePath, options, context, pluginCache
40
41
  return {};
41
42
  }
42
43
  const normalizedOptions = normalizeOptions(options);
44
+ const externalTsconfigInputs = collectExternalTsconfigInputs(projectRoot, context.workspaceRoot);
43
45
  const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, {
44
46
  ...normalizedOptions,
45
47
  CI: process.env.CI,
46
- }, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
48
+ }, context, [
49
+ (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
50
+ ...externalTsconfigInputs,
51
+ ]);
47
52
  if (!pluginCache.has(hash)) {
48
- pluginCache.set(hash, await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context, pmc));
53
+ pluginCache.set(hash, await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context, pmc, externalTsconfigInputs));
49
54
  }
50
55
  const { targets, metadata } = pluginCache.get(hash);
51
56
  return {
@@ -58,13 +63,17 @@ async function createNodesInternal(configFilePath, options, context, pluginCache
58
63
  },
59
64
  };
60
65
  }
61
- async function buildPlaywrightTargets(configFilePath, projectRoot, options, context, pmc) {
66
+ async function buildPlaywrightTargets(configFilePath, projectRoot, options, context, pmc, externalTsconfigInputs) {
62
67
  // Playwright forbids importing the `@playwright/test` module twice. This would affect running the tests,
63
68
  // but we're just reading the config so let's delete the variable they are using to detect this.
64
69
  // See: https://github.com/microsoft/playwright/pull/11218/files
65
70
  delete process['__pw_initiator__'];
66
71
  const playwrightConfig = await (0, config_utils_1.loadConfigFile)((0, node_path_1.join)(context.workspaceRoot, configFilePath));
67
72
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
73
+ const tsconfigJsonInputs = externalTsconfigInputs.map((file) => ({
74
+ json: `{workspaceRoot}/${file}`,
75
+ fields: ['compilerOptions', 'extends', 'files', 'include'],
76
+ }));
68
77
  const targets = {};
69
78
  let metadata;
70
79
  const testOutput = getTestOutput(playwrightConfig);
@@ -101,6 +110,7 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
101
110
  ...('production' in namedInputs
102
111
  ? ['default', '^production', '^{projectRoot}/tsconfig*.json']
103
112
  : ['default', '^default']),
113
+ ...tsconfigJsonInputs,
104
114
  { externalDependencies: ['@playwright/test'] },
105
115
  ],
106
116
  outputs: getTargetOutputs(testOutput, reporterOutputs, context.workspaceRoot, projectRoot),
@@ -118,6 +128,7 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
118
128
  ...('production' in namedInputs
119
129
  ? ['default', '^production', '^{projectRoot}/tsconfig*.json']
120
130
  : ['default', '^default']),
131
+ ...tsconfigJsonInputs,
121
132
  { externalDependencies: ['@playwright/test'] },
122
133
  ],
123
134
  outputs: getTargetOutputs(testOutput, ciReporterOutputs, context.workspaceRoot, projectRoot),
@@ -398,3 +409,56 @@ function normalizeAtomizedTaskBlobReportOutput(output, subfolder) {
398
409
  ? (0, devkit_1.joinPathFragments)((0, node_path_1.dirname)(output), `${subfolder}.zip`)
399
410
  : (0, devkit_1.joinPathFragments)(output, `${subfolder}.zip`);
400
411
  }
412
+ /**
413
+ * Collects tsconfig files read by the Playwright task that are NOT already
414
+ * covered by other inputs, returned as workspace-relative paths.
415
+ *
416
+ * Sources:
417
+ * - The project tsconfig's `extends` chain (compile-time config loading)
418
+ * - The workspace root `tsconfig.json` (read at runtime by
419
+ * `isUsingTsSolutionSetup`, which `nxE2EPreset` calls from the Playwright
420
+ * worker to pick the output directory convention)
421
+ *
422
+ * Exclusions:
423
+ * - Files inside the project root — covered by `default`
424
+ * - The native `TsConfiguration` hash instruction file at the workspace
425
+ * root (`tsconfig.base.json` when it exists, otherwise `tsconfig.json`)
426
+ * - Files under `node_modules` — invalidated via the lockfile
427
+ * - Paths outside the workspace — cannot be expressed as inputs
428
+ */
429
+ function collectExternalTsconfigInputs(projectRoot, workspaceRoot) {
430
+ const rootTsConfigName = (0, js_1.getRootTsConfigFileName)();
431
+ const projectPrefix = `${projectRoot}/`;
432
+ const collected = [];
433
+ const seen = new Set();
434
+ const visit = (absolutePath) => {
435
+ const wsRelative = (0, node_path_1.relative)(workspaceRoot, absolutePath)
436
+ .split(node_path_1.sep)
437
+ .join('/');
438
+ if (seen.has(wsRelative))
439
+ return 'continue';
440
+ seen.add(wsRelative);
441
+ if (wsRelative.startsWith('../') || wsRelative === '..')
442
+ return 'continue';
443
+ if (wsRelative.startsWith('node_modules/') ||
444
+ wsRelative.includes('/node_modules/')) {
445
+ return 'continue';
446
+ }
447
+ if (wsRelative === projectRoot || wsRelative.startsWith(projectPrefix)) {
448
+ return 'continue';
449
+ }
450
+ if (wsRelative === rootTsConfigName)
451
+ return 'continue';
452
+ collected.push(wsRelative);
453
+ return 'continue';
454
+ };
455
+ const projectTsconfig = (0, node_path_1.join)(workspaceRoot, projectRoot, 'tsconfig.json');
456
+ if ((0, node_fs_1.existsSync)(projectTsconfig)) {
457
+ (0, internal_1.walkTsconfigExtendsChain)(projectTsconfig, visit);
458
+ }
459
+ const rootTsconfig = (0, node_path_1.join)(workspaceRoot, 'tsconfig.json');
460
+ if ((0, node_fs_1.existsSync)(rootTsconfig)) {
461
+ (0, internal_1.walkTsconfigExtendsChain)(rootTsconfig, visit);
462
+ }
463
+ return collected;
464
+ }