@plune-ai/playwright 0.2.2 → 0.2.4
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 +1 -1
- package/dist/index.cjs +46 -22
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +46 -22
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ fills in what you left out. Anything set in the config file wins.
|
|
|
52
52
|
| `PLUNE_PROCEED` | the job closes the run itself, later |
|
|
53
53
|
| `PLUNE_BATCH_SIZE` | results per request (default 100, max 500) |
|
|
54
54
|
| `PLUNE_FALLBACK` | where unsent batches are written |
|
|
55
|
-
| `PLUNE_RUN_TITLE` | what to call the run in the list |
|
|
55
|
+
| `PLUNE_RUN_TITLE` | what to call the run in the list (default: `<directory> · 2026-09-15 15:26 · ci`) |
|
|
56
56
|
| `PLUNE_ENV` | where it ran — `staging`, `prod`, a preview name |
|
|
57
57
|
| `PLUNE_LABELS` | comma-separated marks: `smoke,nightly` |
|
|
58
58
|
| `PLUNE_CREATE` | offer tests Plune has no case for to the review queue |
|
package/dist/index.cjs
CHANGED
|
@@ -40,8 +40,9 @@ var import_crypto = require("crypto");
|
|
|
40
40
|
var import_fs = require("fs");
|
|
41
41
|
var import_os = require("os");
|
|
42
42
|
var import_path = require("path");
|
|
43
|
-
var fs = __toESM(require("fs"), 1);
|
|
44
43
|
var path = __toESM(require("path"), 1);
|
|
44
|
+
var fs = __toESM(require("fs"), 1);
|
|
45
|
+
var path2 = __toESM(require("path"), 1);
|
|
45
46
|
var import_crypto2 = require("crypto");
|
|
46
47
|
var DEFAULT_API_URL = "https://beta-api.plune.ai";
|
|
47
48
|
function resolveApiUrl(explicit) {
|
|
@@ -88,7 +89,7 @@ function createClient(opts) {
|
|
|
88
89
|
const wait = opts.wait ?? sleep;
|
|
89
90
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
90
91
|
const scrub = (text) => opts.token === "" ? text : text.split(opts.token).join("***");
|
|
91
|
-
async function send(method,
|
|
92
|
+
async function send(method, path3, body) {
|
|
92
93
|
let last = {
|
|
93
94
|
kind: "unavailable",
|
|
94
95
|
status: null,
|
|
@@ -97,7 +98,7 @@ function createClient(opts) {
|
|
|
97
98
|
for (let attempt = 0; attempt <= RETRY_DELAYS_MS.length; attempt += 1) {
|
|
98
99
|
let res;
|
|
99
100
|
try {
|
|
100
|
-
res = await doFetch(`${base}${
|
|
101
|
+
res = await doFetch(`${base}${path3}`, {
|
|
101
102
|
method,
|
|
102
103
|
headers: { "content-type": "application/json", authorization: `Bearer ${opts.token}` },
|
|
103
104
|
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
@@ -125,8 +126,8 @@ function createClient(opts) {
|
|
|
125
126
|
return { ok: false, ...last };
|
|
126
127
|
}
|
|
127
128
|
return {
|
|
128
|
-
post: (
|
|
129
|
-
del: (
|
|
129
|
+
post: (path3, body) => send("POST", path3, body),
|
|
130
|
+
del: (path3) => send("DELETE", path3)
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
@@ -181,9 +182,15 @@ function readEnv(env = process.env) {
|
|
|
181
182
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0)
|
|
182
183
|
};
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
+
function defaultRunTitle(env = process.env, now = /* @__PURE__ */ new Date(), cwd = process.cwd()) {
|
|
186
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
187
|
+
const stamp = `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())} ${two(now.getHours())}:${two(now.getMinutes())}`;
|
|
188
|
+
const where = flag(env, "CI") || flag(env, "GITHUB_ACTIONS") ? "ci" : "local";
|
|
189
|
+
return `${path.basename(cwd)} \xB7 ${stamp} \xB7 ${where}`;
|
|
190
|
+
}
|
|
191
|
+
var DEFAULT_FALLBACK_PATH = path2.join(".plune", "pending-results.jsonl");
|
|
185
192
|
function appendBatch(file, batch) {
|
|
186
|
-
fs.mkdirSync(
|
|
193
|
+
fs.mkdirSync(path2.dirname(file), { recursive: true });
|
|
187
194
|
const line = {
|
|
188
195
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
189
196
|
runId: batch.runId,
|
|
@@ -322,6 +329,10 @@ async function startRun(passed, declared) {
|
|
|
322
329
|
...externalKey !== null ? { externalKey } : {},
|
|
323
330
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
324
331
|
...configuration !== void 0 ? { configuration } : {},
|
|
332
|
+
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
333
|
+
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
334
|
+
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
335
|
+
title: defaultRunTitle(),
|
|
325
336
|
...described
|
|
326
337
|
});
|
|
327
338
|
if (start.ok) {
|
|
@@ -498,7 +509,7 @@ function resultKey(testId, retry) {
|
|
|
498
509
|
var SOURCE = "playwright";
|
|
499
510
|
function fileOf(test) {
|
|
500
511
|
for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
|
|
501
|
-
if (suite.type === "file") return suite.title;
|
|
512
|
+
if (suite.type === "file") return suite.title.replace(/\\/g, "/");
|
|
502
513
|
}
|
|
503
514
|
return "";
|
|
504
515
|
}
|
|
@@ -575,6 +586,8 @@ function pendingFrom(test, result) {
|
|
|
575
586
|
var PluneReporter = class {
|
|
576
587
|
options;
|
|
577
588
|
session = null;
|
|
589
|
+
/** Every test the runner means to run, captured at the start for the one up-front lookup. */
|
|
590
|
+
declared = [];
|
|
578
591
|
/** Results arrive from a sync callback; this serialises them into the async core. */
|
|
579
592
|
chain = Promise.resolve();
|
|
580
593
|
keepOpen = false;
|
|
@@ -593,23 +606,34 @@ var PluneReporter = class {
|
|
|
593
606
|
onConfigure(config) {
|
|
594
607
|
this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
|
|
595
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* Only the list is taken here; the run opens on the first result. `onBegin` also fires for
|
|
611
|
+
* `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
|
|
612
|
+
* there was an empty run on the platform every time, and with a rejected token the request it
|
|
613
|
+
* made was the one thing left pending when Node exited (a libuv assertion on Windows). No
|
|
614
|
+
* result, no run.
|
|
615
|
+
*/
|
|
596
616
|
onBegin(suite) {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
617
|
+
this.declared = suite.allTests().map(keysFor);
|
|
618
|
+
}
|
|
619
|
+
open() {
|
|
620
|
+
if (this.session === null) {
|
|
621
|
+
this.session = startRun(
|
|
622
|
+
{
|
|
623
|
+
...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
|
|
624
|
+
...this.options.token !== void 0 ? { token: this.options.token } : {},
|
|
625
|
+
...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
|
|
626
|
+
...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
|
|
627
|
+
...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
|
|
628
|
+
meta: { runner: SOURCE }
|
|
629
|
+
},
|
|
630
|
+
this.declared
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
return this.session;
|
|
609
634
|
}
|
|
610
635
|
onTestEnd(test, result) {
|
|
611
|
-
const session = this.
|
|
612
|
-
if (session === null) return;
|
|
636
|
+
const session = this.open();
|
|
613
637
|
this.chain = this.chain.then(async () => {
|
|
614
638
|
(await session).add(pendingFrom(test, result));
|
|
615
639
|
}).catch((err) => this.giveUp(err));
|
package/dist/index.d.cts
CHANGED
|
@@ -18,6 +18,8 @@ interface PluneReporterOptions {
|
|
|
18
18
|
declare class PluneReporter {
|
|
19
19
|
private readonly options;
|
|
20
20
|
private session;
|
|
21
|
+
/** Every test the runner means to run, captured at the start for the one up-front lookup. */
|
|
22
|
+
private declared;
|
|
21
23
|
/** Results arrive from a sync callback; this serialises them into the async core. */
|
|
22
24
|
private chain;
|
|
23
25
|
private keepOpen;
|
|
@@ -28,7 +30,15 @@ declare class PluneReporter {
|
|
|
28
30
|
/** Nothing is drawn; the runner's own reporter keeps the terminal. */
|
|
29
31
|
printsToStdio(): boolean;
|
|
30
32
|
onConfigure(config: FullConfig): void;
|
|
33
|
+
/**
|
|
34
|
+
* Only the list is taken here; the run opens on the first result. `onBegin` also fires for
|
|
35
|
+
* `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
|
|
36
|
+
* there was an empty run on the platform every time, and with a rejected token the request it
|
|
37
|
+
* made was the one thing left pending when Node exited (a libuv assertion on Windows). No
|
|
38
|
+
* result, no run.
|
|
39
|
+
*/
|
|
31
40
|
onBegin(suite: Suite): void;
|
|
41
|
+
private open;
|
|
32
42
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
33
43
|
onEnd(_result: FullResult): Promise<void>;
|
|
34
44
|
/** Say it once, then stay out of the way. The test run's own outcome is not ours to change. */
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface PluneReporterOptions {
|
|
|
18
18
|
declare class PluneReporter {
|
|
19
19
|
private readonly options;
|
|
20
20
|
private session;
|
|
21
|
+
/** Every test the runner means to run, captured at the start for the one up-front lookup. */
|
|
22
|
+
private declared;
|
|
21
23
|
/** Results arrive from a sync callback; this serialises them into the async core. */
|
|
22
24
|
private chain;
|
|
23
25
|
private keepOpen;
|
|
@@ -28,7 +30,15 @@ declare class PluneReporter {
|
|
|
28
30
|
/** Nothing is drawn; the runner's own reporter keeps the terminal. */
|
|
29
31
|
printsToStdio(): boolean;
|
|
30
32
|
onConfigure(config: FullConfig): void;
|
|
33
|
+
/**
|
|
34
|
+
* Only the list is taken here; the run opens on the first result. `onBegin` also fires for
|
|
35
|
+
* `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
|
|
36
|
+
* there was an empty run on the platform every time, and with a rejected token the request it
|
|
37
|
+
* made was the one thing left pending when Node exited (a libuv assertion on Windows). No
|
|
38
|
+
* result, no run.
|
|
39
|
+
*/
|
|
31
40
|
onBegin(suite: Suite): void;
|
|
41
|
+
private open;
|
|
32
42
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
33
43
|
onEnd(_result: FullResult): Promise<void>;
|
|
34
44
|
/** Say it once, then stay out of the way. The test run's own outcome is not ours to change. */
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,9 @@ import { createHash } from "crypto";
|
|
|
6
6
|
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
7
7
|
import { homedir } from "os";
|
|
8
8
|
import { dirname, join } from "path";
|
|
9
|
-
import * as fs from "fs";
|
|
10
9
|
import * as path from "path";
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
import * as path2 from "path";
|
|
11
12
|
import { createHash as createHash2 } from "crypto";
|
|
12
13
|
var DEFAULT_API_URL = "https://beta-api.plune.ai";
|
|
13
14
|
function resolveApiUrl(explicit) {
|
|
@@ -54,7 +55,7 @@ function createClient(opts) {
|
|
|
54
55
|
const wait = opts.wait ?? sleep;
|
|
55
56
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
56
57
|
const scrub = (text) => opts.token === "" ? text : text.split(opts.token).join("***");
|
|
57
|
-
async function send(method,
|
|
58
|
+
async function send(method, path3, body) {
|
|
58
59
|
let last = {
|
|
59
60
|
kind: "unavailable",
|
|
60
61
|
status: null,
|
|
@@ -63,7 +64,7 @@ function createClient(opts) {
|
|
|
63
64
|
for (let attempt = 0; attempt <= RETRY_DELAYS_MS.length; attempt += 1) {
|
|
64
65
|
let res;
|
|
65
66
|
try {
|
|
66
|
-
res = await doFetch(`${base}${
|
|
67
|
+
res = await doFetch(`${base}${path3}`, {
|
|
67
68
|
method,
|
|
68
69
|
headers: { "content-type": "application/json", authorization: `Bearer ${opts.token}` },
|
|
69
70
|
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
@@ -91,8 +92,8 @@ function createClient(opts) {
|
|
|
91
92
|
return { ok: false, ...last };
|
|
92
93
|
}
|
|
93
94
|
return {
|
|
94
|
-
post: (
|
|
95
|
-
del: (
|
|
95
|
+
post: (path3, body) => send("POST", path3, body),
|
|
96
|
+
del: (path3) => send("DELETE", path3)
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
99
|
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
@@ -147,9 +148,15 @@ function readEnv(env = process.env) {
|
|
|
147
148
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0)
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
function defaultRunTitle(env = process.env, now = /* @__PURE__ */ new Date(), cwd = process.cwd()) {
|
|
152
|
+
const two = (n) => String(n).padStart(2, "0");
|
|
153
|
+
const stamp = `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())} ${two(now.getHours())}:${two(now.getMinutes())}`;
|
|
154
|
+
const where = flag(env, "CI") || flag(env, "GITHUB_ACTIONS") ? "ci" : "local";
|
|
155
|
+
return `${path.basename(cwd)} \xB7 ${stamp} \xB7 ${where}`;
|
|
156
|
+
}
|
|
157
|
+
var DEFAULT_FALLBACK_PATH = path2.join(".plune", "pending-results.jsonl");
|
|
151
158
|
function appendBatch(file, batch) {
|
|
152
|
-
fs.mkdirSync(
|
|
159
|
+
fs.mkdirSync(path2.dirname(file), { recursive: true });
|
|
153
160
|
const line = {
|
|
154
161
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
155
162
|
runId: batch.runId,
|
|
@@ -288,6 +295,10 @@ async function startRun(passed, declared) {
|
|
|
288
295
|
...externalKey !== null ? { externalKey } : {},
|
|
289
296
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
290
297
|
...configuration !== void 0 ? { configuration } : {},
|
|
298
|
+
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
299
|
+
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
300
|
+
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
301
|
+
title: defaultRunTitle(),
|
|
291
302
|
...described
|
|
292
303
|
});
|
|
293
304
|
if (start.ok) {
|
|
@@ -464,7 +475,7 @@ function resultKey(testId, retry) {
|
|
|
464
475
|
var SOURCE = "playwright";
|
|
465
476
|
function fileOf(test) {
|
|
466
477
|
for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
|
|
467
|
-
if (suite.type === "file") return suite.title;
|
|
478
|
+
if (suite.type === "file") return suite.title.replace(/\\/g, "/");
|
|
468
479
|
}
|
|
469
480
|
return "";
|
|
470
481
|
}
|
|
@@ -541,6 +552,8 @@ function pendingFrom(test, result) {
|
|
|
541
552
|
var PluneReporter = class {
|
|
542
553
|
options;
|
|
543
554
|
session = null;
|
|
555
|
+
/** Every test the runner means to run, captured at the start for the one up-front lookup. */
|
|
556
|
+
declared = [];
|
|
544
557
|
/** Results arrive from a sync callback; this serialises them into the async core. */
|
|
545
558
|
chain = Promise.resolve();
|
|
546
559
|
keepOpen = false;
|
|
@@ -559,23 +572,34 @@ var PluneReporter = class {
|
|
|
559
572
|
onConfigure(config) {
|
|
560
573
|
this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
|
|
561
574
|
}
|
|
575
|
+
/**
|
|
576
|
+
* Only the list is taken here; the run opens on the first result. `onBegin` also fires for
|
|
577
|
+
* `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
|
|
578
|
+
* there was an empty run on the platform every time, and with a rejected token the request it
|
|
579
|
+
* made was the one thing left pending when Node exited (a libuv assertion on Windows). No
|
|
580
|
+
* result, no run.
|
|
581
|
+
*/
|
|
562
582
|
onBegin(suite) {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
583
|
+
this.declared = suite.allTests().map(keysFor);
|
|
584
|
+
}
|
|
585
|
+
open() {
|
|
586
|
+
if (this.session === null) {
|
|
587
|
+
this.session = startRun(
|
|
588
|
+
{
|
|
589
|
+
...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
|
|
590
|
+
...this.options.token !== void 0 ? { token: this.options.token } : {},
|
|
591
|
+
...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
|
|
592
|
+
...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
|
|
593
|
+
...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
|
|
594
|
+
meta: { runner: SOURCE }
|
|
595
|
+
},
|
|
596
|
+
this.declared
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
return this.session;
|
|
575
600
|
}
|
|
576
601
|
onTestEnd(test, result) {
|
|
577
|
-
const session = this.
|
|
578
|
-
if (session === null) return;
|
|
602
|
+
const session = this.open();
|
|
579
603
|
this.chain = this.chain.then(async () => {
|
|
580
604
|
(await session).add(pendingFrom(test, result));
|
|
581
605
|
}).catch((err) => this.giveUp(err));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/playwright",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Report Playwright results to Plune — a reporter and, later, a test importer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tsup": "^8.0.0",
|
|
39
39
|
"typescript": "^5.4.0",
|
|
40
40
|
"vitest": "^1.6.0",
|
|
41
|
-
"@plune-ai/cli": "0.
|
|
41
|
+
"@plune-ai/cli": "0.11.1"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|