@plune-ai/playwright 0.2.1 → 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.
- package/README.md +1 -1
- package/dist/index.cjs +72 -17
- package/dist/index.js +72 -17
- 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
|
@@ -36,12 +36,14 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
var import_node_fs = require("fs");
|
|
37
37
|
|
|
38
38
|
// ../../dist/reporter-core.js
|
|
39
|
+
var import_crypto = require("crypto");
|
|
39
40
|
var import_fs = require("fs");
|
|
40
41
|
var import_os = require("os");
|
|
41
42
|
var import_path = require("path");
|
|
42
|
-
var fs = __toESM(require("fs"), 1);
|
|
43
43
|
var path = __toESM(require("path"), 1);
|
|
44
|
-
var
|
|
44
|
+
var fs = __toESM(require("fs"), 1);
|
|
45
|
+
var path2 = __toESM(require("path"), 1);
|
|
46
|
+
var import_crypto2 = require("crypto");
|
|
45
47
|
var DEFAULT_API_URL = "https://beta-api.plune.ai";
|
|
46
48
|
function resolveApiUrl(explicit) {
|
|
47
49
|
const raw = explicit ?? process.env["PLUNE_API_URL"] ?? DEFAULT_API_URL;
|
|
@@ -87,7 +89,7 @@ function createClient(opts) {
|
|
|
87
89
|
const wait = opts.wait ?? sleep;
|
|
88
90
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
89
91
|
const scrub = (text) => opts.token === "" ? text : text.split(opts.token).join("***");
|
|
90
|
-
async function
|
|
92
|
+
async function send(method, path3, body) {
|
|
91
93
|
let last = {
|
|
92
94
|
kind: "unavailable",
|
|
93
95
|
status: null,
|
|
@@ -96,17 +98,23 @@ function createClient(opts) {
|
|
|
96
98
|
for (let attempt = 0; attempt <= RETRY_DELAYS_MS.length; attempt += 1) {
|
|
97
99
|
let res;
|
|
98
100
|
try {
|
|
99
|
-
res = await doFetch(`${base}${
|
|
100
|
-
method
|
|
101
|
+
res = await doFetch(`${base}${path3}`, {
|
|
102
|
+
method,
|
|
101
103
|
headers: { "content-type": "application/json", authorization: `Bearer ${opts.token}` },
|
|
102
|
-
|
|
104
|
+
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
105
|
+
// `JSON.stringify(body)` would do, and some proxies answer that with a 400 nobody can
|
|
106
|
+
// explain.
|
|
107
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
103
108
|
});
|
|
104
109
|
} catch (err) {
|
|
105
110
|
last = { kind: "unavailable", status: null, detail: scrub(String(err)) };
|
|
106
111
|
if (attempt < RETRY_DELAYS_MS.length) await wait(RETRY_DELAYS_MS[attempt]);
|
|
107
112
|
continue;
|
|
108
113
|
}
|
|
109
|
-
if (res.ok)
|
|
114
|
+
if (res.ok) {
|
|
115
|
+
if (res.status === 204) return { ok: true, status: res.status, body: void 0 };
|
|
116
|
+
return { ok: true, status: res.status, body: await res.json() };
|
|
117
|
+
}
|
|
110
118
|
const detail = scrub(await detailOf(res));
|
|
111
119
|
const kind = classify(res.status);
|
|
112
120
|
last = { kind, status: res.status, detail };
|
|
@@ -117,7 +125,10 @@ function createClient(opts) {
|
|
|
117
125
|
}
|
|
118
126
|
return { ok: false, ...last };
|
|
119
127
|
}
|
|
120
|
-
return {
|
|
128
|
+
return {
|
|
129
|
+
post: (path3, body) => send("POST", path3, body),
|
|
130
|
+
del: (path3) => send("DELETE", path3)
|
|
131
|
+
};
|
|
121
132
|
}
|
|
122
133
|
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
123
134
|
function value(env, name) {
|
|
@@ -171,9 +182,15 @@ function readEnv(env = process.env) {
|
|
|
171
182
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0)
|
|
172
183
|
};
|
|
173
184
|
}
|
|
174
|
-
|
|
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");
|
|
175
192
|
function appendBatch(file, batch) {
|
|
176
|
-
fs.mkdirSync(
|
|
193
|
+
fs.mkdirSync(path2.dirname(file), { recursive: true });
|
|
177
194
|
const line = {
|
|
178
195
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
179
196
|
runId: batch.runId,
|
|
@@ -188,6 +205,18 @@ var BATCH_MAX = 500;
|
|
|
188
205
|
var DISCOVER_MAX = 500;
|
|
189
206
|
var BATCH_DEFAULT = 100;
|
|
190
207
|
var EXPECTED_MAX = 1e4;
|
|
208
|
+
var KEY_MAX = 1024;
|
|
209
|
+
var TITLE_MAX = 300;
|
|
210
|
+
function boundKey(key) {
|
|
211
|
+
if (key.value.length <= KEY_MAX) return key;
|
|
212
|
+
const digest = (0, import_crypto.createHash)("sha256").update(key.value).digest("hex").slice(0, 16);
|
|
213
|
+
let head = key.value.slice(0, KEY_MAX - digest.length - 1);
|
|
214
|
+
if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
|
|
215
|
+
return { ...key, value: `${head}#${digest}` };
|
|
216
|
+
}
|
|
217
|
+
function boundTitle(title) {
|
|
218
|
+
return title.length <= TITLE_MAX ? title : `${title.slice(0, TITLE_MAX - 1)}\u2026`;
|
|
219
|
+
}
|
|
191
220
|
function chunk(items, size) {
|
|
192
221
|
const out = [];
|
|
193
222
|
for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
|
|
@@ -201,7 +230,7 @@ function warnIfDropped(sent, run, log) {
|
|
|
201
230
|
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
202
231
|
);
|
|
203
232
|
}
|
|
204
|
-
async function startRun(passed,
|
|
233
|
+
async function startRun(passed, declared) {
|
|
205
234
|
const env = readEnv();
|
|
206
235
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
207
236
|
const cfg = { ...env.config, ...stated };
|
|
@@ -224,6 +253,7 @@ async function startRun(passed, expected) {
|
|
|
224
253
|
rejected: 0,
|
|
225
254
|
unresolved: 0,
|
|
226
255
|
offered: 0,
|
|
256
|
+
created: 0,
|
|
227
257
|
unoffered: 0,
|
|
228
258
|
deferred: 0
|
|
229
259
|
};
|
|
@@ -234,6 +264,22 @@ async function startRun(passed, expected) {
|
|
|
234
264
|
let joined = false;
|
|
235
265
|
let offline = token === "";
|
|
236
266
|
let done = false;
|
|
267
|
+
const shortened = /* @__PURE__ */ new Set();
|
|
268
|
+
function bound(keys) {
|
|
269
|
+
return keys.map((key) => {
|
|
270
|
+
const fit = boundKey(key);
|
|
271
|
+
if (fit !== key && !shortened.has(key.value)) {
|
|
272
|
+
shortened.add(key.value);
|
|
273
|
+
if (shortened.size === 1) {
|
|
274
|
+
log(
|
|
275
|
+
`plune: a test name longer than ${KEY_MAX} characters was shortened to fit its key \u2014 "${key.value.slice(0, 80)}\u2026". Give the test a shorter name; until then this is its identity.`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return fit;
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const expected = declared?.map(bound);
|
|
237
283
|
if (offline) {
|
|
238
284
|
log('plune: no API token \u2014 run "plune login" first. Results will be written to the fallback file.');
|
|
239
285
|
}
|
|
@@ -261,9 +307,9 @@ async function startRun(passed, expected) {
|
|
|
261
307
|
}
|
|
262
308
|
if (!offline) {
|
|
263
309
|
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
264
|
-
const
|
|
265
|
-
const configuration =
|
|
266
|
-
expected:
|
|
310
|
+
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
311
|
+
const configuration = stated2.length === 0 ? void 0 : {
|
|
312
|
+
expected: stated2.flatMap((keys) => {
|
|
267
313
|
const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
|
|
268
314
|
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
269
315
|
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
@@ -283,6 +329,10 @@ async function startRun(passed, expected) {
|
|
|
283
329
|
...externalKey !== null ? { externalKey } : {},
|
|
284
330
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
285
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(),
|
|
286
336
|
...described
|
|
287
337
|
});
|
|
288
338
|
if (start.ok) {
|
|
@@ -307,9 +357,11 @@ async function startRun(passed, expected) {
|
|
|
307
357
|
if (!offerDiscovered) return;
|
|
308
358
|
if (result.title === void 0 || result.specRef === void 0) return;
|
|
309
359
|
if (result.keys.length === 0) return;
|
|
360
|
+
const title = boundTitle(result.title);
|
|
361
|
+
if (title !== result.title) shortened.add(result.title);
|
|
310
362
|
discoveries.set(result.keys[0].value, {
|
|
311
363
|
keys: result.keys,
|
|
312
|
-
title
|
|
364
|
+
title,
|
|
313
365
|
source: result.source,
|
|
314
366
|
specRef: result.specRef,
|
|
315
367
|
rawStatus: result.rawStatus
|
|
@@ -331,6 +383,7 @@ async function startRun(passed, expected) {
|
|
|
331
383
|
return;
|
|
332
384
|
}
|
|
333
385
|
stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
|
|
386
|
+
stats.created += out.body.results.filter((r) => r.outcome === "created").length;
|
|
334
387
|
}
|
|
335
388
|
}
|
|
336
389
|
async function flush() {
|
|
@@ -396,7 +449,9 @@ async function startRun(passed, expected) {
|
|
|
396
449
|
if (stats.rejected > 0) parts.push(`${stats.rejected} rejected`);
|
|
397
450
|
if (stats.unresolved > 0) parts.push(`${stats.unresolved} with no matching test case`);
|
|
398
451
|
if (stats.offered > 0) parts.push(`${stats.offered} offered for review`);
|
|
452
|
+
if (stats.created > 0) parts.push(`${stats.created} added as cases (trusted source)`);
|
|
399
453
|
if (stats.deferred > 0) parts.push(`${stats.deferred} written to ${fallbackPath}`);
|
|
454
|
+
if (shortened.size > 0) parts.push(`${shortened.size} test name(s) shortened to fit a key`);
|
|
400
455
|
log(`plune: ${parts.join(" \xB7 ")}`);
|
|
401
456
|
}
|
|
402
457
|
return {
|
|
@@ -410,7 +465,7 @@ async function startRun(passed, expected) {
|
|
|
410
465
|
return stats;
|
|
411
466
|
},
|
|
412
467
|
async add(result) {
|
|
413
|
-
buffer.push(result);
|
|
468
|
+
buffer.push({ ...result, keys: bound(result.keys) });
|
|
414
469
|
if (buffer.length >= batchSize) await flush();
|
|
415
470
|
},
|
|
416
471
|
flush,
|
|
@@ -441,7 +496,7 @@ async function startRun(passed, expected) {
|
|
|
441
496
|
};
|
|
442
497
|
}
|
|
443
498
|
function sha256(input) {
|
|
444
|
-
return (0,
|
|
499
|
+
return (0, import_crypto2.createHash)("sha256").update(input, "utf8").digest("hex");
|
|
445
500
|
}
|
|
446
501
|
var RESULT_KEY_MAX = 200;
|
|
447
502
|
var HASH_CHARS = 32;
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { readFileSync as readFileSync2 } from "fs";
|
|
3
3
|
|
|
4
4
|
// ../../dist/reporter-core.js
|
|
5
|
+
import { createHash } from "crypto";
|
|
5
6
|
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
6
7
|
import { homedir } from "os";
|
|
7
8
|
import { dirname, join } from "path";
|
|
8
|
-
import * as fs from "fs";
|
|
9
9
|
import * as path from "path";
|
|
10
|
-
import
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
import * as path2 from "path";
|
|
12
|
+
import { createHash as createHash2 } from "crypto";
|
|
11
13
|
var DEFAULT_API_URL = "https://beta-api.plune.ai";
|
|
12
14
|
function resolveApiUrl(explicit) {
|
|
13
15
|
const raw = explicit ?? process.env["PLUNE_API_URL"] ?? DEFAULT_API_URL;
|
|
@@ -53,7 +55,7 @@ function createClient(opts) {
|
|
|
53
55
|
const wait = opts.wait ?? sleep;
|
|
54
56
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
55
57
|
const scrub = (text) => opts.token === "" ? text : text.split(opts.token).join("***");
|
|
56
|
-
async function
|
|
58
|
+
async function send(method, path3, body) {
|
|
57
59
|
let last = {
|
|
58
60
|
kind: "unavailable",
|
|
59
61
|
status: null,
|
|
@@ -62,17 +64,23 @@ function createClient(opts) {
|
|
|
62
64
|
for (let attempt = 0; attempt <= RETRY_DELAYS_MS.length; attempt += 1) {
|
|
63
65
|
let res;
|
|
64
66
|
try {
|
|
65
|
-
res = await doFetch(`${base}${
|
|
66
|
-
method
|
|
67
|
+
res = await doFetch(`${base}${path3}`, {
|
|
68
|
+
method,
|
|
67
69
|
headers: { "content-type": "application/json", authorization: `Bearer ${opts.token}` },
|
|
68
|
-
|
|
70
|
+
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
71
|
+
// `JSON.stringify(body)` would do, and some proxies answer that with a 400 nobody can
|
|
72
|
+
// explain.
|
|
73
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
69
74
|
});
|
|
70
75
|
} catch (err) {
|
|
71
76
|
last = { kind: "unavailable", status: null, detail: scrub(String(err)) };
|
|
72
77
|
if (attempt < RETRY_DELAYS_MS.length) await wait(RETRY_DELAYS_MS[attempt]);
|
|
73
78
|
continue;
|
|
74
79
|
}
|
|
75
|
-
if (res.ok)
|
|
80
|
+
if (res.ok) {
|
|
81
|
+
if (res.status === 204) return { ok: true, status: res.status, body: void 0 };
|
|
82
|
+
return { ok: true, status: res.status, body: await res.json() };
|
|
83
|
+
}
|
|
76
84
|
const detail = scrub(await detailOf(res));
|
|
77
85
|
const kind = classify(res.status);
|
|
78
86
|
last = { kind, status: res.status, detail };
|
|
@@ -83,7 +91,10 @@ function createClient(opts) {
|
|
|
83
91
|
}
|
|
84
92
|
return { ok: false, ...last };
|
|
85
93
|
}
|
|
86
|
-
return {
|
|
94
|
+
return {
|
|
95
|
+
post: (path3, body) => send("POST", path3, body),
|
|
96
|
+
del: (path3) => send("DELETE", path3)
|
|
97
|
+
};
|
|
87
98
|
}
|
|
88
99
|
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
89
100
|
function value(env, name) {
|
|
@@ -137,9 +148,15 @@ function readEnv(env = process.env) {
|
|
|
137
148
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0)
|
|
138
149
|
};
|
|
139
150
|
}
|
|
140
|
-
|
|
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");
|
|
141
158
|
function appendBatch(file, batch) {
|
|
142
|
-
fs.mkdirSync(
|
|
159
|
+
fs.mkdirSync(path2.dirname(file), { recursive: true });
|
|
143
160
|
const line = {
|
|
144
161
|
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
145
162
|
runId: batch.runId,
|
|
@@ -154,6 +171,18 @@ var BATCH_MAX = 500;
|
|
|
154
171
|
var DISCOVER_MAX = 500;
|
|
155
172
|
var BATCH_DEFAULT = 100;
|
|
156
173
|
var EXPECTED_MAX = 1e4;
|
|
174
|
+
var KEY_MAX = 1024;
|
|
175
|
+
var TITLE_MAX = 300;
|
|
176
|
+
function boundKey(key) {
|
|
177
|
+
if (key.value.length <= KEY_MAX) return key;
|
|
178
|
+
const digest = createHash("sha256").update(key.value).digest("hex").slice(0, 16);
|
|
179
|
+
let head = key.value.slice(0, KEY_MAX - digest.length - 1);
|
|
180
|
+
if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
|
|
181
|
+
return { ...key, value: `${head}#${digest}` };
|
|
182
|
+
}
|
|
183
|
+
function boundTitle(title) {
|
|
184
|
+
return title.length <= TITLE_MAX ? title : `${title.slice(0, TITLE_MAX - 1)}\u2026`;
|
|
185
|
+
}
|
|
157
186
|
function chunk(items, size) {
|
|
158
187
|
const out = [];
|
|
159
188
|
for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
|
|
@@ -167,7 +196,7 @@ function warnIfDropped(sent, run, log) {
|
|
|
167
196
|
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
168
197
|
);
|
|
169
198
|
}
|
|
170
|
-
async function startRun(passed,
|
|
199
|
+
async function startRun(passed, declared) {
|
|
171
200
|
const env = readEnv();
|
|
172
201
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
173
202
|
const cfg = { ...env.config, ...stated };
|
|
@@ -190,6 +219,7 @@ async function startRun(passed, expected) {
|
|
|
190
219
|
rejected: 0,
|
|
191
220
|
unresolved: 0,
|
|
192
221
|
offered: 0,
|
|
222
|
+
created: 0,
|
|
193
223
|
unoffered: 0,
|
|
194
224
|
deferred: 0
|
|
195
225
|
};
|
|
@@ -200,6 +230,22 @@ async function startRun(passed, expected) {
|
|
|
200
230
|
let joined = false;
|
|
201
231
|
let offline = token === "";
|
|
202
232
|
let done = false;
|
|
233
|
+
const shortened = /* @__PURE__ */ new Set();
|
|
234
|
+
function bound(keys) {
|
|
235
|
+
return keys.map((key) => {
|
|
236
|
+
const fit = boundKey(key);
|
|
237
|
+
if (fit !== key && !shortened.has(key.value)) {
|
|
238
|
+
shortened.add(key.value);
|
|
239
|
+
if (shortened.size === 1) {
|
|
240
|
+
log(
|
|
241
|
+
`plune: a test name longer than ${KEY_MAX} characters was shortened to fit its key \u2014 "${key.value.slice(0, 80)}\u2026". Give the test a shorter name; until then this is its identity.`
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return fit;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
const expected = declared?.map(bound);
|
|
203
249
|
if (offline) {
|
|
204
250
|
log('plune: no API token \u2014 run "plune login" first. Results will be written to the fallback file.');
|
|
205
251
|
}
|
|
@@ -227,9 +273,9 @@ async function startRun(passed, expected) {
|
|
|
227
273
|
}
|
|
228
274
|
if (!offline) {
|
|
229
275
|
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
230
|
-
const
|
|
231
|
-
const configuration =
|
|
232
|
-
expected:
|
|
276
|
+
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
277
|
+
const configuration = stated2.length === 0 ? void 0 : {
|
|
278
|
+
expected: stated2.flatMap((keys) => {
|
|
233
279
|
const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
|
|
234
280
|
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
235
281
|
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
@@ -249,6 +295,10 @@ async function startRun(passed, expected) {
|
|
|
249
295
|
...externalKey !== null ? { externalKey } : {},
|
|
250
296
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
251
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(),
|
|
252
302
|
...described
|
|
253
303
|
});
|
|
254
304
|
if (start.ok) {
|
|
@@ -273,9 +323,11 @@ async function startRun(passed, expected) {
|
|
|
273
323
|
if (!offerDiscovered) return;
|
|
274
324
|
if (result.title === void 0 || result.specRef === void 0) return;
|
|
275
325
|
if (result.keys.length === 0) return;
|
|
326
|
+
const title = boundTitle(result.title);
|
|
327
|
+
if (title !== result.title) shortened.add(result.title);
|
|
276
328
|
discoveries.set(result.keys[0].value, {
|
|
277
329
|
keys: result.keys,
|
|
278
|
-
title
|
|
330
|
+
title,
|
|
279
331
|
source: result.source,
|
|
280
332
|
specRef: result.specRef,
|
|
281
333
|
rawStatus: result.rawStatus
|
|
@@ -297,6 +349,7 @@ async function startRun(passed, expected) {
|
|
|
297
349
|
return;
|
|
298
350
|
}
|
|
299
351
|
stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
|
|
352
|
+
stats.created += out.body.results.filter((r) => r.outcome === "created").length;
|
|
300
353
|
}
|
|
301
354
|
}
|
|
302
355
|
async function flush() {
|
|
@@ -362,7 +415,9 @@ async function startRun(passed, expected) {
|
|
|
362
415
|
if (stats.rejected > 0) parts.push(`${stats.rejected} rejected`);
|
|
363
416
|
if (stats.unresolved > 0) parts.push(`${stats.unresolved} with no matching test case`);
|
|
364
417
|
if (stats.offered > 0) parts.push(`${stats.offered} offered for review`);
|
|
418
|
+
if (stats.created > 0) parts.push(`${stats.created} added as cases (trusted source)`);
|
|
365
419
|
if (stats.deferred > 0) parts.push(`${stats.deferred} written to ${fallbackPath}`);
|
|
420
|
+
if (shortened.size > 0) parts.push(`${shortened.size} test name(s) shortened to fit a key`);
|
|
366
421
|
log(`plune: ${parts.join(" \xB7 ")}`);
|
|
367
422
|
}
|
|
368
423
|
return {
|
|
@@ -376,7 +431,7 @@ async function startRun(passed, expected) {
|
|
|
376
431
|
return stats;
|
|
377
432
|
},
|
|
378
433
|
async add(result) {
|
|
379
|
-
buffer.push(result);
|
|
434
|
+
buffer.push({ ...result, keys: bound(result.keys) });
|
|
380
435
|
if (buffer.length >= batchSize) await flush();
|
|
381
436
|
},
|
|
382
437
|
flush,
|
|
@@ -407,7 +462,7 @@ async function startRun(passed, expected) {
|
|
|
407
462
|
};
|
|
408
463
|
}
|
|
409
464
|
function sha256(input) {
|
|
410
|
-
return
|
|
465
|
+
return createHash2("sha256").update(input, "utf8").digest("hex");
|
|
411
466
|
}
|
|
412
467
|
var RESULT_KEY_MAX = 200;
|
|
413
468
|
var HASH_CHARS = 32;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/playwright",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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.0"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|