@plune-ai/playwright 0.2.0 → 0.2.1

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/index.cjs CHANGED
@@ -224,6 +224,7 @@ async function startRun(passed, expected) {
224
224
  rejected: 0,
225
225
  unresolved: 0,
226
226
  offered: 0,
227
+ unoffered: 0,
227
228
  deferred: 0
228
229
  };
229
230
  const resolved = /* @__PURE__ */ new Map();
@@ -316,13 +317,17 @@ async function startRun(passed, expected) {
316
317
  }
317
318
  async function offer() {
318
319
  if (discoveries.size === 0 || offline || runId === null) return;
319
- for (const batch of chunk([...discoveries.values()], DISCOVER_MAX)) {
320
+ const batches = chunk([...discoveries.values()], DISCOVER_MAX);
321
+ for (const [index, batch] of batches.entries()) {
320
322
  const out = await client.post("/v1/review-items/discovered", {
321
323
  discovered: batch,
322
324
  runId
323
325
  });
324
326
  if (!out.ok) {
325
- log(`plune: could not offer ${batch.length} unknown tests for review (${out.detail || out.kind}).`);
327
+ stats.unoffered = batches.slice(index).reduce((n, rest) => n + rest.length, 0);
328
+ log(
329
+ `plune: could not offer ${stats.unoffered} unknown test(s) for review (${out.detail || out.kind}).`
330
+ );
326
331
  return;
327
332
  }
328
333
  stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
@@ -352,7 +357,10 @@ async function startRun(passed, expected) {
352
357
  }
353
358
  }
354
359
  if (unanswered.length > 0) defer(unanswered);
355
- if (submissions.length === 0) return;
360
+ if (submissions.length === 0) {
361
+ progress();
362
+ return;
363
+ }
356
364
  const out = await client.post(
357
365
  `/v1/runs/${runId}/results`,
358
366
  { results: submissions }
@@ -362,6 +370,7 @@ async function startRun(passed, expected) {
362
370
  stats.duplicate += out.body.counts.duplicate ?? 0;
363
371
  stats.conflict += out.body.counts.conflict ?? 0;
364
372
  stats.rejected += out.body.counts.rejected ?? 0;
373
+ progress();
365
374
  return;
366
375
  }
367
376
  if (out.kind === "auth") {
@@ -374,6 +383,12 @@ async function startRun(passed, expected) {
374
383
  }
375
384
  defer(submissions);
376
385
  }
386
+ function progress() {
387
+ const total = expected?.length ?? 0;
388
+ if (total <= batchSize) return;
389
+ const done2 = stats.accepted + stats.duplicate + stats.conflict + stats.rejected + stats.unresolved;
390
+ log(`plune: ${Math.min(done2, total)} of ${total} results sent`);
391
+ }
377
392
  function summarise() {
378
393
  const parts = [`${stats.accepted} accepted`];
379
394
  if (stats.duplicate > 0) parts.push(`${stats.duplicate} already reported`);
package/dist/index.js CHANGED
@@ -190,6 +190,7 @@ async function startRun(passed, expected) {
190
190
  rejected: 0,
191
191
  unresolved: 0,
192
192
  offered: 0,
193
+ unoffered: 0,
193
194
  deferred: 0
194
195
  };
195
196
  const resolved = /* @__PURE__ */ new Map();
@@ -282,13 +283,17 @@ async function startRun(passed, expected) {
282
283
  }
283
284
  async function offer() {
284
285
  if (discoveries.size === 0 || offline || runId === null) return;
285
- for (const batch of chunk([...discoveries.values()], DISCOVER_MAX)) {
286
+ const batches = chunk([...discoveries.values()], DISCOVER_MAX);
287
+ for (const [index, batch] of batches.entries()) {
286
288
  const out = await client.post("/v1/review-items/discovered", {
287
289
  discovered: batch,
288
290
  runId
289
291
  });
290
292
  if (!out.ok) {
291
- log(`plune: could not offer ${batch.length} unknown tests for review (${out.detail || out.kind}).`);
293
+ stats.unoffered = batches.slice(index).reduce((n, rest) => n + rest.length, 0);
294
+ log(
295
+ `plune: could not offer ${stats.unoffered} unknown test(s) for review (${out.detail || out.kind}).`
296
+ );
292
297
  return;
293
298
  }
294
299
  stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
@@ -318,7 +323,10 @@ async function startRun(passed, expected) {
318
323
  }
319
324
  }
320
325
  if (unanswered.length > 0) defer(unanswered);
321
- if (submissions.length === 0) return;
326
+ if (submissions.length === 0) {
327
+ progress();
328
+ return;
329
+ }
322
330
  const out = await client.post(
323
331
  `/v1/runs/${runId}/results`,
324
332
  { results: submissions }
@@ -328,6 +336,7 @@ async function startRun(passed, expected) {
328
336
  stats.duplicate += out.body.counts.duplicate ?? 0;
329
337
  stats.conflict += out.body.counts.conflict ?? 0;
330
338
  stats.rejected += out.body.counts.rejected ?? 0;
339
+ progress();
331
340
  return;
332
341
  }
333
342
  if (out.kind === "auth") {
@@ -340,6 +349,12 @@ async function startRun(passed, expected) {
340
349
  }
341
350
  defer(submissions);
342
351
  }
352
+ function progress() {
353
+ const total = expected?.length ?? 0;
354
+ if (total <= batchSize) return;
355
+ const done2 = stats.accepted + stats.duplicate + stats.conflict + stats.rejected + stats.unresolved;
356
+ log(`plune: ${Math.min(done2, total)} of ${total} results sent`);
357
+ }
343
358
  function summarise() {
344
359
  const parts = [`${stats.accepted} accepted`];
345
360
  if (stats.duplicate > 0) parts.push(`${stats.duplicate} already reported`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/playwright",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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.8.0"
41
+ "@plune-ai/cli": "0.9.1"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",