@trackunit/iris-app-playwright 0.1.40 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-playwright",
3
- "version": "0.1.40",
3
+ "version": "0.2.2",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "generators": "./generators.json",
@@ -2,6 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.playwrightConfigurationGenerator = playwrightConfigurationGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const PLAYWRIGHT_TSCONFIG_REFERENCE = "./playwright/tsconfig.json";
6
+ /**
7
+ * Registers the scaffolded `playwright/tsconfig.json` as a project reference in the
8
+ * project's root `tsconfig.json`. Without this, the playwright tsconfig is orphaned:
9
+ * a solution-style root tsconfig only type-checks what it references, so editors and
10
+ * `tsc-validate` never pick up the spec files.
11
+ *
12
+ * No-ops when the project has no root `tsconfig.json`, or when the reference is already
13
+ * present (so re-runs stay idempotent).
14
+ */
15
+ function addPlaywrightTsConfigReference(tree, projectRoot) {
16
+ const tsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, "tsconfig.json");
17
+ if (!tree.exists(tsConfigPath)) {
18
+ return;
19
+ }
20
+ (0, devkit_1.updateJson)(tree, tsConfigPath, tsConfig => {
21
+ const references = tsConfig.references ?? [];
22
+ const alreadyReferenced = references.some(reference => reference.path === PLAYWRIGHT_TSCONFIG_REFERENCE);
23
+ if (alreadyReferenced) {
24
+ return tsConfig;
25
+ }
26
+ return {
27
+ ...tsConfig,
28
+ references: [...references, { path: PLAYWRIGHT_TSCONFIG_REFERENCE }],
29
+ };
30
+ });
31
+ }
5
32
  /**
6
33
  * Generates Playwright E2E test configuration for an existing project.
7
34
  *
@@ -55,7 +82,7 @@ async function playwrightConfigurationGenerator(tree, options) {
55
82
  },
56
83
  configurations,
57
84
  },
58
- "e2e": {
85
+ e2e: {
59
86
  executor: "nx:run-commands",
60
87
  options: {
61
88
  command: `playwright test --config=playwright.config.ts`,
@@ -69,9 +96,13 @@ async function playwrightConfigurationGenerator(tree, options) {
69
96
  ...options,
70
97
  tmpl: "",
71
98
  });
99
+ addPlaywrightTsConfigReference(tree, projectRoot);
72
100
  await (0, devkit_1.formatFiles)(tree);
73
101
  return () => {
74
- devkit_1.logger.info(`\n\n\nāœ… šŸš€ Please open this file to get started\n${(0, devkit_1.joinPathFragments)(projectRoot, "playwright/tests/app.spec.ts")}`);
102
+ devkit_1.logger.info(`\n\nāœ… šŸš€ \nPlease update credentials in:
103
+ ${(0, devkit_1.joinPathFragments)(projectRoot, "playwright/fixtures/auth.json")}
104
+ and open this file to get started writing tests:
105
+ ${(0, devkit_1.joinPathFragments)(projectRoot, "playwright/tests/app.spec.ts")}`);
75
106
  };
76
107
  }
77
108
  //# sourceMappingURL=generator.js.map