@testpulse.run/reporter 0.1.2 → 0.1.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.
package/README.md
CHANGED
|
@@ -35,4 +35,4 @@ test("streams automatically when page is used", async ({ page }) => {
|
|
|
35
35
|
});
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Live streaming is enabled by default on the reporter, and the fixture automatically starts and stops live capture for tests that use the `page` fixture. Set `liveStreamingEnabled: false` to opt out. The package bundles `ffmpeg` automatically. To override the encoder path, set `TESTPULSE_FFMPEG_PATH`.
|
|
@@ -16,7 +16,8 @@ export default class TestPulseReporter {
|
|
|
16
16
|
this.options = options;
|
|
17
17
|
this.resolvedOptions = {
|
|
18
18
|
...options,
|
|
19
|
-
endpoint: resolveTestPulseEndpoint(options.endpoint)
|
|
19
|
+
endpoint: resolveTestPulseEndpoint(options.endpoint),
|
|
20
|
+
liveStreamingEnabled: options.liveStreamingEnabled ?? true
|
|
20
21
|
};
|
|
21
22
|
this.runClient = new RunClient(this.resolvedOptions);
|
|
22
23
|
this.artifactUploader = new ArtifactUploader(this.eventQueue, () => this.ensureRunStarted(), this.runClient);
|
|
@@ -74,7 +75,7 @@ export default class TestPulseReporter {
|
|
|
74
75
|
await this.runClient.completeRun(runId, result.status === "failed" ? "Failed" : "Completed");
|
|
75
76
|
}
|
|
76
77
|
finally {
|
|
77
|
-
if (this.
|
|
78
|
+
if (this.resolvedOptions.liveStreamingEnabled) {
|
|
78
79
|
await deleteLiveCaptureState(this.options.liveStreamSessionKey, this.options.liveCaptureStateDirectory);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -107,7 +108,7 @@ export default class TestPulseReporter {
|
|
|
107
108
|
const metadata = await this.metadataPromise;
|
|
108
109
|
const payload = await this.runClient.startRun(metadata);
|
|
109
110
|
this.runId = payload.runId;
|
|
110
|
-
if (this.
|
|
111
|
+
if (this.resolvedOptions.liveStreamingEnabled) {
|
|
111
112
|
if (!payload.streamPublisherToken) {
|
|
112
113
|
throw new Error("TestPulse live streaming token was not returned by the backend.");
|
|
113
114
|
}
|
package/dist/reporter/types.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type StartRunResponse = {
|
|
|
21
21
|
runId: string;
|
|
22
22
|
streamPublisherToken?: string;
|
|
23
23
|
};
|
|
24
|
-
export interface ResolvedTestPulseReporterOptions extends Omit<TestPulseReporterOptions, "endpoint"> {
|
|
24
|
+
export interface ResolvedTestPulseReporterOptions extends Omit<TestPulseReporterOptions, "endpoint" | "liveStreamingEnabled"> {
|
|
25
25
|
endpoint: string;
|
|
26
|
+
liveStreamingEnabled: boolean;
|
|
26
27
|
}
|