@pw-studio/cli 0.1.0-20261009180840-cb04d4 → 0.1.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.
package/dist/reporter.js DELETED
@@ -1,51 +0,0 @@
1
- import {
2
- TestResult,
3
- exports_Effect,
4
- exports_FetchHttpClient,
5
- makeClient,
6
- resolve
7
- } from "./bin-gh2ayccc.js";
8
- import"./bin-yk32700q.js";
9
-
10
- // src/reporter.ts
11
- import * as path from "node:path";
12
- function toTestResult(rootDir, test) {
13
- return new TestResult({
14
- testId: test.id,
15
- file: path.relative(rootDir, test.location.file).split(path.sep).join("/"),
16
- project: test.parent.project()?.name ?? "",
17
- title: test.titlePath().filter(Boolean).join(" › "),
18
- outcome: test.outcome(),
19
- durationMs: test.results.reduce((sum, r) => sum + r.duration, 0)
20
- });
21
- }
22
-
23
- class StudioReporter {
24
- options;
25
- rootDir = "";
26
- suite;
27
- constructor(options = {}) {
28
- this.options = options;
29
- }
30
- onBegin(config, suite) {
31
- this.rootDir = config.rootDir;
32
- this.suite = suite;
33
- }
34
- async onEnd() {
35
- const { options, rootDir } = this;
36
- const results = (this.suite?.allTests() ?? []).map((t) => toTestResult(rootDir, t));
37
- const upload = exports_Effect.gen(function* () {
38
- const { url, secret, runId } = yield* resolve(options);
39
- const client = yield* makeClient(url, secret);
40
- yield* client.sharding.recordResults({ params: { runId }, payload: { results } });
41
- }).pipe(exports_Effect.tapCause((cause) => exports_Effect.logWarning(`[pws] could not record ${results.length} results: ${String(cause)}`)), exports_Effect.ignore, exports_Effect.provide(exports_FetchHttpClient.layer));
42
- await exports_Effect.runPromise(upload);
43
- }
44
- printsToStdio() {
45
- return false;
46
- }
47
- }
48
- export {
49
- toTestResult,
50
- StudioReporter as default
51
- };