@testpulse.run/playwright-jsonl-reporter 0.2.3

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.
@@ -0,0 +1,166 @@
1
+ import { Reporter, FullConfig, Suite, FullResult } from '@playwright/test/reporter';
2
+ import { TestPulseReporterEventName, TestPulseReporterCore } from '@testpulse.run/playwright-core';
3
+ import { TestPulseDerivedEventName } from '@testpulse.run/playwright-events';
4
+
5
+ type JsonlEventStream = "core" | "derived";
6
+ type JsonlEventName = TestPulseReporterEventName | TestPulseDerivedEventName;
7
+ type JsonlTestOutcome = "passed" | "failed" | "flaky" | "skipped" | "interrupted" | "timedOut";
8
+ interface JsonlAttachment {
9
+ name: string;
10
+ contentType: string;
11
+ path?: string;
12
+ bodySize?: number;
13
+ }
14
+ interface JsonlError {
15
+ message?: string;
16
+ stack?: string;
17
+ value?: string;
18
+ file?: string;
19
+ line?: number;
20
+ column?: number;
21
+ }
22
+ interface JsonlEvent {
23
+ schemaVersion: 1;
24
+ eventId: string;
25
+ sequence: number;
26
+ type: JsonlEventName;
27
+ stream: JsonlEventStream;
28
+ eventName: JsonlEventName;
29
+ timestamp: string;
30
+ source: string;
31
+ runId: string;
32
+ writerId: string;
33
+ shardId?: string;
34
+ shardIndex?: number;
35
+ shardCount?: number;
36
+ workerId?: string;
37
+ workerIndex?: number;
38
+ parallelIndex?: number;
39
+ testId?: string;
40
+ testTitle?: string;
41
+ file?: string;
42
+ line?: number;
43
+ column?: number;
44
+ projectName?: string;
45
+ retry?: number;
46
+ repeatEachIndex?: number;
47
+ expectedStatus?: string;
48
+ stepId?: string;
49
+ parentStepId?: string;
50
+ stepTitle?: string;
51
+ stepCategory?: string;
52
+ stepFile?: string;
53
+ stepLine?: number;
54
+ stepColumn?: number;
55
+ status?: string;
56
+ durationMs?: number;
57
+ startTime?: string;
58
+ totalTests?: number;
59
+ configuredWorkers?: number;
60
+ errors?: JsonlError[];
61
+ attachments?: JsonlAttachment[];
62
+ outcome?: JsonlTestOutcome;
63
+ payload?: Record<string, unknown>;
64
+ }
65
+ interface EventSinkMetadata {
66
+ writerId: string;
67
+ sinkType: string;
68
+ }
69
+ interface EventSink {
70
+ readonly metadata: EventSinkMetadata;
71
+ write(event: JsonlEvent): void;
72
+ flush(): Promise<void>;
73
+ close(): Promise<void>;
74
+ }
75
+
76
+ interface JsonlReporterOptions {
77
+ outputDir?: string;
78
+ sink?: EventSink;
79
+ failOnHandlerError?: boolean;
80
+ includeCoreEvents?: boolean;
81
+ includeDerivedEvents?: boolean;
82
+ runId?: string;
83
+ }
84
+ declare class JsonlReporter implements Reporter {
85
+ private readonly core;
86
+ private readonly events;
87
+ private readonly sink;
88
+ private readonly configuredRunId?;
89
+ private nextEventId;
90
+ private runId;
91
+ private shard?;
92
+ constructor(options?: JsonlReporterOptions);
93
+ onBegin(config: FullConfig, suite: Suite): void;
94
+ onEnd(result: FullResult): ReturnType<TestPulseReporterCore["onEnd"]>;
95
+ onError(...args: Parameters<TestPulseReporterCore["onError"]>): void;
96
+ onTestBegin(...args: Parameters<TestPulseReporterCore["onTestBegin"]>): void;
97
+ onTestEnd(...args: Parameters<TestPulseReporterCore["onTestEnd"]>): void;
98
+ onStepBegin(...args: Parameters<TestPulseReporterCore["onStepBegin"]>): void;
99
+ onStepEnd(...args: Parameters<TestPulseReporterCore["onStepEnd"]>): void;
100
+ onStdOut(...args: Parameters<TestPulseReporterCore["onStdOut"]>): void;
101
+ onStdErr(...args: Parameters<TestPulseReporterCore["onStdErr"]>): void;
102
+ private createCorePlugin;
103
+ private createDerivedPlugin;
104
+ private createSinkFinalizerPlugin;
105
+ private writeCoreEvent;
106
+ private writeDerivedEvent;
107
+ private createSerializationContext;
108
+ }
109
+
110
+ interface HttpEventSinkOptions {
111
+ baseUrl: string;
112
+ writerId?: string;
113
+ apiKey?: string;
114
+ storageStreamId?: string;
115
+ flushIntervalMs?: number;
116
+ batchSize?: number;
117
+ fetch?: typeof fetch;
118
+ }
119
+ interface HttpEventIngestResponse {
120
+ accepted: boolean;
121
+ acceptedCount: number;
122
+ lastAcceptedSequence: number | null;
123
+ }
124
+ declare class HttpEventSink implements EventSink {
125
+ readonly metadata: EventSinkMetadata;
126
+ private readonly baseUrl;
127
+ private readonly apiKey?;
128
+ private readonly storageStreamId;
129
+ private readonly flushIntervalMs;
130
+ private readonly batchSize;
131
+ private readonly fetchImpl;
132
+ private readonly pending;
133
+ private closed;
134
+ private inFlight?;
135
+ private flushTimer?;
136
+ private lastBackgroundError?;
137
+ constructor(options: HttpEventSinkOptions);
138
+ write(event: JsonlEvent): void;
139
+ flush(): Promise<void>;
140
+ close(): Promise<void>;
141
+ private ensureFlushTimer;
142
+ private clearFlushTimer;
143
+ private triggerBackgroundFlush;
144
+ private sendEvents;
145
+ private createEndpoint;
146
+ private createHeaders;
147
+ }
148
+
149
+ interface FileSystemEventSinkOptions {
150
+ outputDir?: string;
151
+ fileName?: string;
152
+ writerId?: string;
153
+ }
154
+ declare class FileSystemEventSink implements EventSink {
155
+ readonly filePath: string;
156
+ readonly metadata: EventSinkMetadata;
157
+ private readonly stream;
158
+ private closed;
159
+ private streamError?;
160
+ constructor(options?: FileSystemEventSinkOptions);
161
+ write(event: JsonlEvent): void;
162
+ flush(): Promise<void>;
163
+ close(): Promise<void>;
164
+ }
165
+
166
+ export { type EventSink, type EventSinkMetadata, FileSystemEventSink, type FileSystemEventSinkOptions, type HttpEventIngestResponse, HttpEventSink, type HttpEventSinkOptions, type JsonlAttachment, type JsonlError, type JsonlEvent, type JsonlEventName, type JsonlEventStream, JsonlReporter, type JsonlReporterOptions, type JsonlTestOutcome, JsonlReporter as default };
@@ -0,0 +1,166 @@
1
+ import { Reporter, FullConfig, Suite, FullResult } from '@playwright/test/reporter';
2
+ import { TestPulseReporterEventName, TestPulseReporterCore } from '@testpulse.run/playwright-core';
3
+ import { TestPulseDerivedEventName } from '@testpulse.run/playwright-events';
4
+
5
+ type JsonlEventStream = "core" | "derived";
6
+ type JsonlEventName = TestPulseReporterEventName | TestPulseDerivedEventName;
7
+ type JsonlTestOutcome = "passed" | "failed" | "flaky" | "skipped" | "interrupted" | "timedOut";
8
+ interface JsonlAttachment {
9
+ name: string;
10
+ contentType: string;
11
+ path?: string;
12
+ bodySize?: number;
13
+ }
14
+ interface JsonlError {
15
+ message?: string;
16
+ stack?: string;
17
+ value?: string;
18
+ file?: string;
19
+ line?: number;
20
+ column?: number;
21
+ }
22
+ interface JsonlEvent {
23
+ schemaVersion: 1;
24
+ eventId: string;
25
+ sequence: number;
26
+ type: JsonlEventName;
27
+ stream: JsonlEventStream;
28
+ eventName: JsonlEventName;
29
+ timestamp: string;
30
+ source: string;
31
+ runId: string;
32
+ writerId: string;
33
+ shardId?: string;
34
+ shardIndex?: number;
35
+ shardCount?: number;
36
+ workerId?: string;
37
+ workerIndex?: number;
38
+ parallelIndex?: number;
39
+ testId?: string;
40
+ testTitle?: string;
41
+ file?: string;
42
+ line?: number;
43
+ column?: number;
44
+ projectName?: string;
45
+ retry?: number;
46
+ repeatEachIndex?: number;
47
+ expectedStatus?: string;
48
+ stepId?: string;
49
+ parentStepId?: string;
50
+ stepTitle?: string;
51
+ stepCategory?: string;
52
+ stepFile?: string;
53
+ stepLine?: number;
54
+ stepColumn?: number;
55
+ status?: string;
56
+ durationMs?: number;
57
+ startTime?: string;
58
+ totalTests?: number;
59
+ configuredWorkers?: number;
60
+ errors?: JsonlError[];
61
+ attachments?: JsonlAttachment[];
62
+ outcome?: JsonlTestOutcome;
63
+ payload?: Record<string, unknown>;
64
+ }
65
+ interface EventSinkMetadata {
66
+ writerId: string;
67
+ sinkType: string;
68
+ }
69
+ interface EventSink {
70
+ readonly metadata: EventSinkMetadata;
71
+ write(event: JsonlEvent): void;
72
+ flush(): Promise<void>;
73
+ close(): Promise<void>;
74
+ }
75
+
76
+ interface JsonlReporterOptions {
77
+ outputDir?: string;
78
+ sink?: EventSink;
79
+ failOnHandlerError?: boolean;
80
+ includeCoreEvents?: boolean;
81
+ includeDerivedEvents?: boolean;
82
+ runId?: string;
83
+ }
84
+ declare class JsonlReporter implements Reporter {
85
+ private readonly core;
86
+ private readonly events;
87
+ private readonly sink;
88
+ private readonly configuredRunId?;
89
+ private nextEventId;
90
+ private runId;
91
+ private shard?;
92
+ constructor(options?: JsonlReporterOptions);
93
+ onBegin(config: FullConfig, suite: Suite): void;
94
+ onEnd(result: FullResult): ReturnType<TestPulseReporterCore["onEnd"]>;
95
+ onError(...args: Parameters<TestPulseReporterCore["onError"]>): void;
96
+ onTestBegin(...args: Parameters<TestPulseReporterCore["onTestBegin"]>): void;
97
+ onTestEnd(...args: Parameters<TestPulseReporterCore["onTestEnd"]>): void;
98
+ onStepBegin(...args: Parameters<TestPulseReporterCore["onStepBegin"]>): void;
99
+ onStepEnd(...args: Parameters<TestPulseReporterCore["onStepEnd"]>): void;
100
+ onStdOut(...args: Parameters<TestPulseReporterCore["onStdOut"]>): void;
101
+ onStdErr(...args: Parameters<TestPulseReporterCore["onStdErr"]>): void;
102
+ private createCorePlugin;
103
+ private createDerivedPlugin;
104
+ private createSinkFinalizerPlugin;
105
+ private writeCoreEvent;
106
+ private writeDerivedEvent;
107
+ private createSerializationContext;
108
+ }
109
+
110
+ interface HttpEventSinkOptions {
111
+ baseUrl: string;
112
+ writerId?: string;
113
+ apiKey?: string;
114
+ storageStreamId?: string;
115
+ flushIntervalMs?: number;
116
+ batchSize?: number;
117
+ fetch?: typeof fetch;
118
+ }
119
+ interface HttpEventIngestResponse {
120
+ accepted: boolean;
121
+ acceptedCount: number;
122
+ lastAcceptedSequence: number | null;
123
+ }
124
+ declare class HttpEventSink implements EventSink {
125
+ readonly metadata: EventSinkMetadata;
126
+ private readonly baseUrl;
127
+ private readonly apiKey?;
128
+ private readonly storageStreamId;
129
+ private readonly flushIntervalMs;
130
+ private readonly batchSize;
131
+ private readonly fetchImpl;
132
+ private readonly pending;
133
+ private closed;
134
+ private inFlight?;
135
+ private flushTimer?;
136
+ private lastBackgroundError?;
137
+ constructor(options: HttpEventSinkOptions);
138
+ write(event: JsonlEvent): void;
139
+ flush(): Promise<void>;
140
+ close(): Promise<void>;
141
+ private ensureFlushTimer;
142
+ private clearFlushTimer;
143
+ private triggerBackgroundFlush;
144
+ private sendEvents;
145
+ private createEndpoint;
146
+ private createHeaders;
147
+ }
148
+
149
+ interface FileSystemEventSinkOptions {
150
+ outputDir?: string;
151
+ fileName?: string;
152
+ writerId?: string;
153
+ }
154
+ declare class FileSystemEventSink implements EventSink {
155
+ readonly filePath: string;
156
+ readonly metadata: EventSinkMetadata;
157
+ private readonly stream;
158
+ private closed;
159
+ private streamError?;
160
+ constructor(options?: FileSystemEventSinkOptions);
161
+ write(event: JsonlEvent): void;
162
+ flush(): Promise<void>;
163
+ close(): Promise<void>;
164
+ }
165
+
166
+ export { type EventSink, type EventSinkMetadata, FileSystemEventSink, type FileSystemEventSinkOptions, type HttpEventIngestResponse, HttpEventSink, type HttpEventSinkOptions, type JsonlAttachment, type JsonlError, type JsonlEvent, type JsonlEventName, type JsonlEventStream, JsonlReporter, type JsonlReporterOptions, type JsonlTestOutcome, JsonlReporter as default };