@gate-forge/pack-playwright 0.8.0 → 0.9.1

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 (31) hide show
  1. package/dist/discovery/discover.d.ts +22 -0
  2. package/dist/discovery/discover.d.ts.map +1 -1
  3. package/dist/discovery/discover.js +220 -28
  4. package/dist/discovery/discover.js.map +1 -1
  5. package/dist/discovery/index.d.ts +1 -0
  6. package/dist/discovery/index.d.ts.map +1 -1
  7. package/dist/discovery/index.js +1 -0
  8. package/dist/discovery/index.js.map +1 -1
  9. package/dist/discovery/reconcile.d.ts +38 -0
  10. package/dist/discovery/reconcile.d.ts.map +1 -1
  11. package/dist/discovery/reconcile.js +77 -1
  12. package/dist/discovery/reconcile.js.map +1 -1
  13. package/dist/discovery/runner-file-scope.d.ts +118 -0
  14. package/dist/discovery/runner-file-scope.d.ts.map +1 -0
  15. package/dist/discovery/runner-file-scope.js +753 -0
  16. package/dist/discovery/runner-file-scope.js.map +1 -0
  17. package/dist/discovery/static-discovery.d.ts +11 -0
  18. package/dist/discovery/static-discovery.d.ts.map +1 -1
  19. package/dist/discovery/static-discovery.js +23 -3
  20. package/dist/discovery/static-discovery.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/reporter/project-graph-reporter.d.ts +45 -16
  26. package/dist/reporter/project-graph-reporter.d.ts.map +1 -1
  27. package/dist/reporter/project-graph-reporter.js +56 -16
  28. package/dist/reporter/project-graph-reporter.js.map +1 -1
  29. package/package.json +7 -4
  30. package/python/__pycache__/gateforge_persistence_intents.cpython-312.pyc +0 -0
  31. package/python/__pycache__/gateforge_persistence_intents.cpython-314.pyc +0 -0
@@ -17,17 +17,19 @@
17
17
  * itself schedules from — so the graph is the runner's own truth, not
18
18
  * the candidate's claim about it.
19
19
  *
20
- * It records the project graph and, alongside it, the RESOLVED
21
- * `use.storageState` of each project — but only when that value is a
22
- * plain string path. That is DATA the runner already resolved from the
23
- * consumer config (a file location), not consumer code, and it is what
24
- * the standard auth pattern needs: a `setup` project signs in and saves
25
- * `playwright/.auth/user.json`, and the dependent project is the one
26
- * that must be handed that file. Every other project option is
27
- * consumer configuration a supervised run deliberately does not honor,
28
- * so none of it crosses this boundary — including a `storageState`
29
- * given as an inline `{cookies, origins}` document, which is a value
30
- * this boundary does not carry.
20
+ * It records the project graph, alongside it the RESOLVED
21
+ * `use.storageState` of each project (only when that value is a plain
22
+ * string path), and each project's own resolved TEST-FILE selection
23
+ * (`testDir`/`testMatch`/`testIgnore`) — the runner's answer to "which
24
+ * files would you collect at all?". A test file outside every
25
+ * project's selection is not that runner's test, however test-shaped
26
+ * it looks, and the catalog must say so from the runner's own words
27
+ * rather than from a guess about the consumer's glob syntax.
28
+ *
29
+ * Every other project option is consumer configuration a supervised run
30
+ * deliberately does not honor, so none of it crosses this boundary —
31
+ * including a `storageState` given as an inline `{cookies, origins}`
32
+ * document, which is a value this boundary does not carry.
31
33
  *
32
34
  * The output path arrives in the environment, exactly like the json
33
35
  * reporter's own `PLAYWRIGHT_JSON_OUTPUT_FILE`: the reporter list a CLI
@@ -38,11 +40,37 @@
38
40
  import { writeFileSync } from 'node:fs';
39
41
  /** Environment variable naming the graph document to write. */
40
42
  export const PROJECT_GRAPH_PATH_ENV = 'PLAYWRIGHT_GATEFORGE_PROJECT_GRAPH_FILE';
43
+ /**
44
+ * Normalizes one resolved `testMatch`/`testIgnore` value to its globs.
45
+ *
46
+ * @param value: the runner's resolved value (string, RegExp, or array).
47
+ *
48
+ * @returns
49
+ * string[]: the globs in source order; empty when the runner resolved
50
+ * nothing. `null` when any element is not a plain string/RegExp — the
51
+ * caller then treats that project's whole selection as unknown.
52
+ */
53
+ function selectionGlobs(value) {
54
+ if (value === undefined || value === null)
55
+ return [];
56
+ const values = Array.isArray(value) ? value : [value];
57
+ const globs = [];
58
+ for (const element of values) {
59
+ if (typeof element === 'string')
60
+ globs.push(element);
61
+ else if (element instanceof RegExp)
62
+ globs.push(element.toString());
63
+ else
64
+ return null;
65
+ }
66
+ return globs;
67
+ }
41
68
  /**
42
69
  * The Playwright reporter that records the resolved project dependency
43
- * graph and the storage states its projects declare. Written for the
44
- * v2 reporter protocol (`version()` returning `'v2'`), whose
45
- * `onConfigure` receives the resolved full config.
70
+ * graph, the storage states its projects declare, and each project's
71
+ * resolved test-file selection. Written for the v2 reporter protocol
72
+ * (`version()` returning `'v2'`), whose `onConfigure` receives the
73
+ * resolved full config.
46
74
  */
47
75
  export class ProjectGraphReporter {
48
76
  /** Opts into the v2 reporter protocol (config arrives in onConfigure). */
@@ -50,8 +78,8 @@ export class ProjectGraphReporter {
50
78
  return 'v2';
51
79
  }
52
80
  /**
53
- * Records the graph, and the declared storage states, the RUNNER
54
- * resolved.
81
+ * Records the graph, the declared storage states, and the test-file
82
+ * selection the RUNNER resolved.
55
83
  *
56
84
  * @param config: the resolved full config, exactly as the runner has it.
57
85
  */
@@ -63,6 +91,7 @@ export class ProjectGraphReporter {
63
91
  // a legal one, so a map keyed by it must not inherit anything.
64
92
  const projectDependencies = Object.create(null);
65
93
  const projectStorageStates = Object.create(null);
94
+ const testFileScope = [];
66
95
  for (const project of config.projects ?? []) {
67
96
  if (typeof project.name !== 'string' || project.name.length === 0)
68
97
  continue;
@@ -79,11 +108,22 @@ export class ProjectGraphReporter {
79
108
  if (typeof storageState === 'string') {
80
109
  projectStorageStates[project.name] = storageState;
81
110
  }
111
+ // The runner's own file selection. Only plain globs and RegExps
112
+ // cross; a function-valued selector is consumer CODE, and a
113
+ // project with a non-data value is left out so it narrows nothing
114
+ // instead of narrowing wrongly.
115
+ const testDir = project.testDir;
116
+ const testMatch = selectionGlobs(project.testMatch);
117
+ const testIgnore = selectionGlobs(project.testIgnore);
118
+ if (typeof testDir === 'string' && testDir.length > 0 && testMatch !== null && testIgnore !== null) {
119
+ testFileScope.push({ name: project.name, testDir, testMatch, testIgnore });
120
+ }
82
121
  }
83
122
  const document = {
84
123
  schemaVersion: 2,
85
124
  projectDependencies,
86
125
  ...(Object.keys(projectStorageStates).length > 0 ? { projectStorageStates } : {}),
126
+ ...(testFileScope.length > 0 ? { testFileScope } : {}),
87
127
  };
88
128
  writeFileSync(graphPath, `${JSON.stringify(document)}\n`, 'utf8');
89
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"project-graph-reporter.js","sourceRoot":"","sources":["../../src/reporter/project-graph-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,yCAAyC,CAAC;AAqChF;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAC/B,0EAA0E;IACnE,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,MAAwB;QACzC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACtD,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC9D,sEAAsE;QACtE,+DAA+D;QAC/D,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA6B,CAAC;QAC5E,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA2B,CAAC;QAC3E,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YAC5C,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAC5E,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG;gBAClC,GAAG,IAAI,GAAG,CACR,CAAC,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AC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC;QACF,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gate-forge/pack-playwright",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "gateforgeCompatibility": {
5
5
  "supervisedFixtureProtocol": "gateforge.supervised-playwright.v1"
6
6
  },
@@ -44,7 +44,10 @@
44
44
  "bin",
45
45
  "dist",
46
46
  "examples",
47
- "python"
47
+ "python",
48
+ "!**/__pycache__",
49
+ "!**/*.pyc",
50
+ "!**/*.pyo"
48
51
  ],
49
52
  "scripts": {
50
53
  "build": "tsc -p tsconfig.build.json",
@@ -52,8 +55,8 @@
52
55
  "test": "vitest run"
53
56
  },
54
57
  "dependencies": {
55
- "@gate-forge/core": "^0.8.0",
56
- "@gate-forge/witness": "^0.8.0",
58
+ "@gate-forge/core": "^0.9.1",
59
+ "@gate-forge/witness": "^0.9.1",
57
60
  "playwright": "1.58.2",
58
61
  "typescript": "^5.9.2",
59
62
  "yaml": "^2.8.1"