@piwitests/reporter 0.5.0 → 0.7.0

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 (76) hide show
  1. package/README.md +37 -26
  2. package/dist/global-setup-module.js +2 -2
  3. package/dist/index.d.ts +13 -4
  4. package/dist/index.js +19 -5
  5. package/dist/internal/capture/attachments.d.ts +19 -0
  6. package/dist/internal/capture/attachments.js +22 -0
  7. package/dist/internal/capture/capture-fixtures.d.ts +41 -0
  8. package/dist/internal/capture/capture-fixtures.js +562 -0
  9. package/dist/{locator-healing.d.ts → internal/capture/locator-healing.d.ts} +47 -1
  10. package/dist/{locator-healing.js → internal/capture/locator-healing.js} +113 -29
  11. package/dist/internal/collect/error-text.d.ts +18 -0
  12. package/dist/internal/collect/error-text.js +79 -0
  13. package/dist/{metadata-collector.d.ts → internal/collect/metadata-collector.d.ts} +2 -2
  14. package/dist/{metadata-collector.js → internal/collect/metadata-collector.js} +12 -9
  15. package/dist/{skip-classify.d.ts → internal/collect/skip-classify.d.ts} +1 -1
  16. package/dist/{step-analyzer.d.ts → internal/collect/step-analyzer.d.ts} +6 -0
  17. package/dist/{step-analyzer.js → internal/collect/step-analyzer.js} +7 -2
  18. package/dist/internal/config/env.d.ts +45 -0
  19. package/dist/{config.js → internal/config/env.js} +50 -35
  20. package/dist/internal/files/compression.js +69 -0
  21. package/dist/{file-handler.d.ts → internal/files/file-handler.d.ts} +4 -4
  22. package/dist/{file-handler.js → internal/files/file-handler.js} +61 -29
  23. package/dist/{crash-recovery.d.ts → internal/streaming/crash-recovery.d.ts} +5 -5
  24. package/dist/{crash-recovery.js → internal/streaming/crash-recovery.js} +9 -8
  25. package/dist/{stream-buffer.d.ts → internal/streaming/stream-buffer.d.ts} +2 -2
  26. package/dist/{stream-buffer.js → internal/streaming/stream-buffer.js} +5 -5
  27. package/dist/{stream-manager.d.ts → internal/streaming/stream-manager.d.ts} +8 -8
  28. package/dist/{stream-manager.js → internal/streaming/stream-manager.js} +16 -13
  29. package/dist/{run-submitter.d.ts → internal/submit/run-submitter.d.ts} +7 -7
  30. package/dist/{run-submitter.js → internal/submit/run-submitter.js} +11 -9
  31. package/dist/{serializer.d.ts → internal/submit/serializer.d.ts} +1 -1
  32. package/dist/{uploader.d.ts → internal/submit/uploader.d.ts} +8 -8
  33. package/dist/{uploader.js → internal/submit/uploader.js} +45 -10
  34. package/dist/internal/support/ci.d.ts +2 -0
  35. package/dist/internal/support/ci.js +32 -0
  36. package/dist/internal/support/cli-filters.d.ts +1 -0
  37. package/dist/internal/support/cli-filters.js +51 -0
  38. package/dist/internal/support/errors.d.ts +8 -0
  39. package/dist/internal/support/errors.js +15 -0
  40. package/dist/internal/support/instance-id.d.ts +4 -0
  41. package/dist/internal/support/instance-id.js +48 -0
  42. package/dist/internal/support/limiter.d.ts +2 -0
  43. package/dist/internal/support/limiter.js +27 -0
  44. package/dist/internal/support/setup-file.d.ts +13 -0
  45. package/dist/internal/support/setup-file.js +61 -0
  46. package/dist/internal/support/source-snippet.d.ts +12 -0
  47. package/dist/internal/support/source-snippet.js +97 -0
  48. package/dist/internal/support/worker-index.d.ts +7 -0
  49. package/dist/internal/support/worker-index.js +14 -0
  50. package/dist/{http-client.d.ts → internal/transport/http-client.d.ts} +11 -1
  51. package/dist/{http-client.js → internal/transport/http-client.js} +57 -10
  52. package/dist/{config-wrapper.d.ts → public/config-wrapper.d.ts} +1 -1
  53. package/dist/{config-wrapper.js → public/config-wrapper.js} +4 -4
  54. package/dist/public/global-setup.d.ts +13 -0
  55. package/dist/public/global-setup.js +146 -0
  56. package/dist/{config.d.ts → public/options.d.ts} +7 -45
  57. package/dist/public/options.js +2 -0
  58. package/dist/{reporter.d.ts → public/reporter.d.ts} +1 -1
  59. package/dist/{reporter.js → public/reporter.js} +44 -54
  60. package/dist/types/collected.d.ts +96 -0
  61. package/dist/types/collected.js +10 -0
  62. package/dist/types/wire.d.ts +174 -0
  63. package/dist/types/wire.js +14 -0
  64. package/dist/types.d.ts +8 -253
  65. package/dist/types.js +23 -10
  66. package/package.json +1 -6
  67. package/dist/compression.js +0 -39
  68. package/dist/fixtures.d.ts +0 -25
  69. package/dist/fixtures.js +0 -336
  70. package/dist/helpers.d.ts +0 -44
  71. package/dist/helpers.js +0 -312
  72. /package/dist/{skip-classify.js → internal/collect/skip-classify.js} +0 -0
  73. /package/dist/{compression.d.ts → internal/files/compression.d.ts} +0 -0
  74. /package/dist/{serializer.js → internal/submit/serializer.js} +0 -0
  75. /package/dist/{logger.d.ts → internal/support/logger.d.ts} +0 -0
  76. /package/dist/{logger.js → internal/support/logger.js} +0 -0
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Wire contract — the **external** shapes sent to / received from the Piwi
3
+ * Dashboard server.
4
+ *
5
+ * These structurally mirror — but do not import — `application/shared/types.ts`
6
+ * (`TestCasePayload`, `StreamEventPayload`, `TestRunFinishPayload`). Importing
7
+ * that module would leak the monorepo path into the published `.d.ts` files; the
8
+ * constraint forbids the import, not the types. **Any change here is a change to
9
+ * the server contract** — keep both sides structurally compatible.
10
+ *
11
+ * For the in-process collection model (never sent verbatim), see `./collected.ts`.
12
+ */
13
+ export interface SuiteConfigEntry {
14
+ mode: 'parallel' | 'serial' | 'default';
15
+ annotations: Array<{
16
+ type: string;
17
+ description?: string;
18
+ }>;
19
+ }
20
+ export interface TestAnnotation {
21
+ type: string;
22
+ description?: string;
23
+ }
24
+ /**
25
+ * Filter that narrowed a run to a subset of tests, recorded when `isFullRun`
26
+ * is false. Mirrors `FilterDetails` in `application/shared/types.ts`.
27
+ */
28
+ export interface FilterDetails {
29
+ /** A non-default `--grep` pattern (Playwright's default `.*` is excluded). */
30
+ grep?: string;
31
+ /** A `--grep-invert` pattern. */
32
+ grepInvert?: string;
33
+ /** Positional file/path filters from the CLI invocation (e.g. ["tests/login.spec.ts"]). */
34
+ files?: string[];
35
+ }
36
+ export interface BrowserConfig {
37
+ projectName?: string;
38
+ browserName?: string | null;
39
+ channel?: string | null;
40
+ viewport?: {
41
+ width: number;
42
+ height: number;
43
+ } | null;
44
+ deviceScaleFactor?: number | null;
45
+ isMobile?: boolean | null;
46
+ hasTouch?: boolean | null;
47
+ locale?: string | null;
48
+ timezoneId?: string | null;
49
+ geolocation?: {
50
+ longitude: number;
51
+ latitude: number;
52
+ accuracy?: number;
53
+ } | null;
54
+ colorScheme?: string | null;
55
+ reducedMotion?: string | null;
56
+ forcedColors?: string | null;
57
+ offline?: boolean | null;
58
+ bypassCSP?: boolean | null;
59
+ javaScriptEnabled?: boolean | null;
60
+ serviceWorkers?: string | null;
61
+ userAgent?: string | null;
62
+ }
63
+ /** A hook/fixture step event with absolute timings (for the workers timeline). */
64
+ export interface TestStepEvent {
65
+ title: string;
66
+ category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'wait';
67
+ startedAt: number;
68
+ duration: number;
69
+ status: string;
70
+ location?: string | null;
71
+ }
72
+ /**
73
+ * The per-case wire shape that `toWireTestCase` produces and the server
74
+ * receives. Structurally compatible with `TestCasePayload` and the per-event
75
+ * `StreamEventPayload`.
76
+ */
77
+ export interface WireTestCase {
78
+ type?: 'begin' | 'complete' | 'step-begin' | 'step-end';
79
+ title: string;
80
+ location: string;
81
+ status?: string;
82
+ duration?: number;
83
+ error?: string | null;
84
+ retries?: number;
85
+ workerIndex?: number | null;
86
+ shardIndex?: number | null;
87
+ startedAt?: number | null;
88
+ steps?: unknown;
89
+ stepEvents?: TestStepEvent[] | null;
90
+ slowestStep?: string | null;
91
+ slowestStepDuration?: number | null;
92
+ wastedTimeMs?: number | null;
93
+ networkRequests?: unknown;
94
+ webVitals?: unknown;
95
+ consoleLogs?: unknown;
96
+ ariaSnapshot?: unknown;
97
+ testSource?: string | null;
98
+ browser?: BrowserConfig | null;
99
+ suitePath?: string[] | null;
100
+ suiteConfig?: SuiteConfigEntry[] | null;
101
+ testAnnotations?: TestAnnotation[] | null;
102
+ /** Step-event discriminant (only for `step-begin`/`step-end` events). */
103
+ stepCategory?: string | null;
104
+ parentTitle?: string | null;
105
+ /** Per-element locator snapshots with ranked alternatives (transient — not stored per-run). */
106
+ locatorSnapshots?: unknown;
107
+ }
108
+ export interface BeginStreamEvent {
109
+ type: 'begin';
110
+ title: string;
111
+ location: string;
112
+ workerIndex: number | null;
113
+ shardIndex: number | null;
114
+ browser?: BrowserConfig | null;
115
+ suitePath?: string[] | null;
116
+ suiteConfig?: SuiteConfigEntry[] | null;
117
+ }
118
+ export interface CompleteStreamEvent {
119
+ type: 'complete';
120
+ title: string;
121
+ location: string;
122
+ status: string;
123
+ duration: number;
124
+ error: string | null;
125
+ retries: number;
126
+ workerIndex: number | null;
127
+ shardIndex: number | null;
128
+ startedAt: number | null;
129
+ browser?: BrowserConfig | null;
130
+ suitePath?: string[] | null;
131
+ suiteConfig?: SuiteConfigEntry[] | null;
132
+ testAnnotations?: TestAnnotation[] | null;
133
+ steps?: unknown;
134
+ stepEvents?: TestStepEvent[] | null;
135
+ slowestStep?: string | null;
136
+ slowestStepDuration?: number | null;
137
+ networkRequests?: unknown;
138
+ webVitals?: unknown;
139
+ consoleLogs?: unknown;
140
+ ariaSnapshot?: unknown;
141
+ testSource?: string | null;
142
+ locatorSnapshots?: unknown;
143
+ }
144
+ export interface StepBeginStreamEvent {
145
+ type: 'step-begin';
146
+ title: string;
147
+ location: string;
148
+ stepCategory: 'hook' | 'fixture';
149
+ parentTitle: string | null;
150
+ workerIndex: number | null;
151
+ startedAt: number | null;
152
+ }
153
+ export interface StepEndStreamEvent {
154
+ type: 'step-end';
155
+ title: string;
156
+ location: string;
157
+ status: string;
158
+ duration: number;
159
+ stepCategory: 'hook' | 'fixture';
160
+ parentTitle: string | null;
161
+ workerIndex: number | null;
162
+ startedAt: number | null;
163
+ }
164
+ /** Discriminated union of events queued to `StreamManager` and persisted by `StreamBuffer`. */
165
+ export type StreamEvent = BeginStreamEvent | CompleteStreamEvent | StepBeginStreamEvent | StepEndStreamEvent;
166
+ export interface SetupStep {
167
+ title: string;
168
+ category: string;
169
+ startedAt: number;
170
+ duration: number;
171
+ status: string;
172
+ location?: string | null;
173
+ workerIndex?: number | null;
174
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Wire contract — the **external** shapes sent to / received from the Piwi
4
+ * Dashboard server.
5
+ *
6
+ * These structurally mirror — but do not import — `application/shared/types.ts`
7
+ * (`TestCasePayload`, `StreamEventPayload`, `TestRunFinishPayload`). Importing
8
+ * that module would leak the monorepo path into the published `.d.ts` files; the
9
+ * constraint forbids the import, not the types. **Any change here is a change to
10
+ * the server contract** — keep both sides structurally compatible.
11
+ *
12
+ * For the in-process collection model (never sent verbatim), see `./collected.ts`.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types.d.ts CHANGED
@@ -1,256 +1,11 @@
1
1
  /**
2
- * Reporter-local domain model.
2
+ * Reporter-local domain model, split by audience:
3
+ * - `types/wire.ts` — the **external** contract sent to / received from the server.
4
+ * - `types/collected.ts` — the **internal** model the reporter accumulates in process.
3
5
  *
4
- * These interfaces describe the data that flows *between* the reporter's
5
- * classes (`FileHandler`, `Uploader`, `StreamManager`, `PiwiDashboardReporter`).
6
- * They intentionally mirror but do not import the wire types in
7
- * `application/shared/types.ts`. Importing that module would leak the monorepo
8
- * path into the published `.d.ts` files; the constraint forbids the import,
9
- * not the types. Keep these structurally compatible with
10
- * `TestCasePayload` / `StreamEventPayload` / `TestRunFinishPayload` when
11
- * evolving them.
6
+ * This barrel re-exports both so `./types.js` imports keep resolving. Prefer
7
+ * importing from the specific module (`./types/wire.js` / `./types/collected.js`)
8
+ * so each import site shows whether it touches the wire contract or the internal model.
12
9
  */
13
- export interface SuiteConfigEntry {
14
- mode: 'parallel' | 'serial' | 'default';
15
- annotations: Array<{
16
- type: string;
17
- description?: string;
18
- }>;
19
- }
20
- export interface TestAnnotation {
21
- type: string;
22
- description?: string;
23
- }
24
- /**
25
- * Filter that narrowed a run to a subset of tests, recorded when `isFullRun`
26
- * is false. Mirrors `FilterDetails` in `application/shared/types.ts`.
27
- */
28
- export interface FilterDetails {
29
- /** A non-default `--grep` pattern (Playwright's default `.*` is excluded). */
30
- grep?: string;
31
- /** A `--grep-invert` pattern. */
32
- grepInvert?: string;
33
- /** Positional file/path filters from the CLI invocation (e.g. ["tests/login.spec.ts"]). */
34
- files?: string[];
35
- }
36
- export interface BrowserConfig {
37
- projectName?: string;
38
- browserName?: string | null;
39
- channel?: string | null;
40
- viewport?: {
41
- width: number;
42
- height: number;
43
- } | null;
44
- deviceScaleFactor?: number | null;
45
- isMobile?: boolean | null;
46
- hasTouch?: boolean | null;
47
- locale?: string | null;
48
- timezoneId?: string | null;
49
- geolocation?: {
50
- longitude: number;
51
- latitude: number;
52
- accuracy?: number;
53
- } | null;
54
- colorScheme?: string | null;
55
- reducedMotion?: string | null;
56
- forcedColors?: string | null;
57
- offline?: boolean | null;
58
- bypassCSP?: boolean | null;
59
- javaScriptEnabled?: boolean | null;
60
- serviceWorkers?: string | null;
61
- userAgent?: string | null;
62
- }
63
- /**
64
- * A raw Playwright attachment as exposed on `TestResult.attachments`.
65
- * Carried verbatim on `CollectedTestCase.attachments` so `FileHandler` can
66
- * resolve trace/attachment paths; never sent to the server.
67
- */
68
- export interface RawAttachment {
69
- name: string;
70
- path?: string;
71
- contentType?: string;
72
- body?: Buffer;
73
- originalName?: string;
74
- }
75
- /** Performance metrics collected from `result.steps` by `step-analyzer`. */
76
- export interface CollectedPerformanceMetrics {
77
- steps: Array<{
78
- title: string;
79
- duration: number;
80
- category: string;
81
- }>;
82
- totalStepDuration: number;
83
- slowestStep: {
84
- title: string;
85
- duration: number;
86
- } | null;
87
- navigationCount: number;
88
- navigationTotalDuration: number;
89
- waitTotalDuration: number;
90
- waitCount: number;
91
- }
92
- /** A hook/fixture step event with absolute timings (for the workers timeline). */
93
- export interface TestStepEvent {
94
- title: string;
95
- category: 'hook' | 'fixture' | 'test.step' | 'expect' | 'wait';
96
- startedAt: number;
97
- duration: number;
98
- status: string;
99
- location?: string | null;
100
- }
101
- /**
102
- * What `onTestEnd` accumulates per test case. Mixes three concerns that the
103
- * reporter must keep together during a run:
104
- * - **wire fields** (`title`, `status`, `duration`, …) that `toWireTestCase`
105
- * projects onto `WireTestCase` before sending,
106
- * - **collection-only state** (`attachments`, `performanceMetrics`,
107
- * `stepEvents`) consumed by `FileHandler` and the run-level summary,
108
- * - the `type` discriminant so the same collected object can be queued as a
109
- * stream event.
110
- *
111
- * Upload bookkeeping (`_filesUploaded`) is deliberately NOT on this object —
112
- * `StreamManager` tracks it in a side `Set` so the data model stays clean.
113
- */
114
- export interface CollectedTestCase {
115
- /** Stream-event discriminant: `'begin'` or `'complete'`. Omitted for batch-only runs. */
116
- type?: 'begin' | 'complete';
117
- title: string;
118
- location: string;
119
- status?: string;
120
- duration?: number;
121
- error?: string | null;
122
- retries?: number;
123
- workerIndex?: number | null;
124
- shardIndex?: number | null;
125
- startedAt?: number | null;
126
- /** Raw Playwright attachments — never sent on the wire. */
127
- attachments?: RawAttachment[];
128
- browser?: BrowserConfig | null;
129
- suitePath?: string[] | null;
130
- suiteConfig?: SuiteConfigEntry[] | null;
131
- testAnnotations?: TestAnnotation[] | null;
132
- /** Source snippet around the failing line (failed/timedOut only). */
133
- testSource?: string;
134
- /** Step metrics from `collectStepMetrics`. Consumed by the run summary + `toWireTestCase`. */
135
- performanceMetrics?: CollectedPerformanceMetrics;
136
- stepEvents?: TestStepEvent[];
137
- /** Parsed from `piwi-dashboard-network` attachments by `FileHandler`. */
138
- networkRequests?: unknown;
139
- /** Parsed from `piwi-dashboard-web-vitals` attachments. */
140
- webVitals?: unknown;
141
- /** Parsed from `piwi-dashboard-console` attachments. */
142
- consoleLogs?: unknown;
143
- /** Parsed from `piwi-dashboard-aria-snapshot` attachment. */
144
- ariaSnapshot?: string;
145
- /** Parsed from `piwi-dashboard-locators` attachment. */
146
- locatorSnapshots?: import('./locator-healing.js').LocatorSnapshot[];
147
- }
148
- /**
149
- * The per-case wire shape that `toWireTestCase` produces and the server
150
- * receives. Structurally compatible with `TestCasePayload` and the per-event
151
- * `StreamEventPayload`.
152
- */
153
- export interface WireTestCase {
154
- type?: 'begin' | 'complete' | 'step-begin' | 'step-end';
155
- title: string;
156
- location: string;
157
- status?: string;
158
- duration?: number;
159
- error?: string | null;
160
- retries?: number;
161
- workerIndex?: number | null;
162
- shardIndex?: number | null;
163
- startedAt?: number | null;
164
- steps?: unknown;
165
- stepEvents?: TestStepEvent[] | null;
166
- slowestStep?: string | null;
167
- slowestStepDuration?: number | null;
168
- wastedTimeMs?: number | null;
169
- networkRequests?: unknown;
170
- webVitals?: unknown;
171
- consoleLogs?: unknown;
172
- ariaSnapshot?: unknown;
173
- testSource?: string | null;
174
- browser?: BrowserConfig | null;
175
- suitePath?: string[] | null;
176
- suiteConfig?: SuiteConfigEntry[] | null;
177
- testAnnotations?: TestAnnotation[] | null;
178
- /** Step-event discriminant (only for `step-begin`/`step-end` events). */
179
- stepCategory?: string | null;
180
- parentTitle?: string | null;
181
- /** Per-element locator snapshots with ranked alternatives (transient — not stored per-run). */
182
- locatorSnapshots?: unknown;
183
- }
184
- export interface BeginStreamEvent {
185
- type: 'begin';
186
- title: string;
187
- location: string;
188
- workerIndex: number | null;
189
- shardIndex: number | null;
190
- browser?: BrowserConfig | null;
191
- suitePath?: string[] | null;
192
- suiteConfig?: SuiteConfigEntry[] | null;
193
- }
194
- export interface CompleteStreamEvent {
195
- type: 'complete';
196
- title: string;
197
- location: string;
198
- status: string;
199
- duration: number;
200
- error: string | null;
201
- retries: number;
202
- workerIndex: number | null;
203
- shardIndex: number | null;
204
- startedAt: number | null;
205
- browser?: BrowserConfig | null;
206
- suitePath?: string[] | null;
207
- suiteConfig?: SuiteConfigEntry[] | null;
208
- testAnnotations?: TestAnnotation[] | null;
209
- steps?: unknown;
210
- stepEvents?: TestStepEvent[] | null;
211
- slowestStep?: string | null;
212
- slowestStepDuration?: number | null;
213
- networkRequests?: unknown;
214
- webVitals?: unknown;
215
- consoleLogs?: unknown;
216
- ariaSnapshot?: unknown;
217
- testSource?: string | null;
218
- locatorSnapshots?: unknown;
219
- }
220
- export interface StepBeginStreamEvent {
221
- type: 'step-begin';
222
- title: string;
223
- location: string;
224
- stepCategory: 'hook' | 'fixture';
225
- parentTitle: string | null;
226
- workerIndex: number | null;
227
- startedAt: number | null;
228
- }
229
- export interface StepEndStreamEvent {
230
- type: 'step-end';
231
- title: string;
232
- location: string;
233
- status: string;
234
- duration: number;
235
- stepCategory: 'hook' | 'fixture';
236
- parentTitle: string | null;
237
- workerIndex: number | null;
238
- startedAt: number | null;
239
- }
240
- /** Discriminated union of events queued to `StreamManager` and persisted by `StreamBuffer`. */
241
- export type StreamEvent = BeginStreamEvent | CompleteStreamEvent | StepBeginStreamEvent | StepEndStreamEvent;
242
- export interface SetupStep {
243
- title: string;
244
- category: string;
245
- startedAt: number;
246
- duration: number;
247
- status: string;
248
- location?: string | null;
249
- workerIndex?: number | null;
250
- }
251
- /** Hash + size of a single trace file, used for dedup against the server. */
252
- export interface TraceHashInfo {
253
- tracePath: string;
254
- hash: string;
255
- size: number;
256
- }
10
+ export * from './types/wire.js';
11
+ export * from './types/collected.js';
package/dist/types.js CHANGED
@@ -1,14 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
2
17
  /**
3
- * Reporter-local domain model.
18
+ * Reporter-local domain model, split by audience:
19
+ * - `types/wire.ts` — the **external** contract sent to / received from the server.
20
+ * - `types/collected.ts` — the **internal** model the reporter accumulates in process.
4
21
  *
5
- * These interfaces describe the data that flows *between* the reporter's
6
- * classes (`FileHandler`, `Uploader`, `StreamManager`, `PiwiDashboardReporter`).
7
- * They intentionally mirror but do not import the wire types in
8
- * `application/shared/types.ts`. Importing that module would leak the monorepo
9
- * path into the published `.d.ts` files; the constraint forbids the import,
10
- * not the types. Keep these structurally compatible with
11
- * `TestCasePayload` / `StreamEventPayload` / `TestRunFinishPayload` when
12
- * evolving them.
22
+ * This barrel re-exports both so `./types.js` imports keep resolving. Prefer
23
+ * importing from the specific module (`./types/wire.js` / `./types/collected.js`)
24
+ * so each import site shows whether it touches the wire contract or the internal model.
13
25
  */
14
- Object.defineProperty(exports, "__esModule", { value: true });
26
+ __exportStar(require("./types/wire.js"), exports);
27
+ __exportStar(require("./types/collected.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piwitests/reporter",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Playwright reporter for sending test results to Piwi Dashboard",
5
5
  "url": "https://github.com/PiwiTests/platform",
6
6
  "homepage": "https://piwitests.github.io",
@@ -19,11 +19,6 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "import": "./dist/index.js",
21
21
  "require": "./dist/index.js"
22
- },
23
- "./fixtures": {
24
- "types": "./dist/fixtures.d.ts",
25
- "import": "./dist/fixtures.js",
26
- "require": "./dist/fixtures.js"
27
22
  }
28
23
  },
29
24
  "keywords": [
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.compressDirectory = compressDirectory;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const zlib_1 = __importDefault(require("zlib"));
10
- const util_1 = require("util");
11
- const gzipAsync = (0, util_1.promisify)(zlib_1.default.gzip);
12
- /**
13
- * Recursively read a directory and pack all files into a gzip-compressed
14
- * archive (a concatenation of length-prefixed path+content pairs).
15
- */
16
- async function compressDirectory(sourceDir) {
17
- const files = [];
18
- function collect(dir, baseDir = '') {
19
- for (const entry of fs_1.default.readdirSync(dir, { withFileTypes: true })) {
20
- const full = path_1.default.join(dir, entry.name);
21
- const rel = path_1.default.join(baseDir, entry.name);
22
- if (entry.isDirectory())
23
- collect(full, rel);
24
- else if (entry.isFile())
25
- files.push({ path: rel, content: fs_1.default.readFileSync(full) });
26
- }
27
- }
28
- collect(sourceDir);
29
- const parts = [];
30
- for (const f of files) {
31
- const pb = Buffer.from(f.path, 'utf8');
32
- const plb = Buffer.allocUnsafe(4);
33
- plb.writeUInt32LE(pb.length, 0);
34
- const clb = Buffer.allocUnsafe(4);
35
- clb.writeUInt32LE(f.content.length, 0);
36
- parts.push(plb, pb, clb, f.content);
37
- }
38
- return await gzipAsync(Buffer.concat(parts), { level: 5 });
39
- }
@@ -1,25 +0,0 @@
1
- import type { Fixtures } from '@playwright/test';
2
- /**
3
- * Playwright fixtures that collect network requests, console entries,
4
- * web vitals, ARIA snapshots, and locator interaction data during a test.
5
- *
6
- * Attaches collected data as `piwi-dashboard-*` test-info attachments
7
- * which the Piwi Dashboard reporter parses on `onTestEnd`.
8
- */
9
- export declare const dashboardFixtures: Fixtures;
10
- /**
11
- * Extend a Playwright `test` object with Piwi Dashboard fixtures.
12
- *
13
- * Use this instead of importing `@playwright/test` directly from this package
14
- * to avoid the "Requiring @playwright/test second time" error caused by
15
- * duplicate module resolution.
16
- *
17
- * @example
18
- * ```ts
19
- * import { test as base } from '@playwright/test';
20
- * import { extendDashboardFixtures } from '@piwitests/reporter/fixtures';
21
- *
22
- * export const test = extendDashboardFixtures(base);
23
- * ```
24
- */
25
- export declare function extendDashboardFixtures<T>(test: T): T;