@plune-ai/playwright 0.7.2 → 0.7.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/dist/index.cjs CHANGED
@@ -847,7 +847,13 @@ function textRefusal(bytes) {
847
847
  }
848
848
  return void 0;
849
849
  }
850
- function onDisk(result) {
850
+ function withoutTargets(result) {
851
+ if (result.targets === void 0) return result;
852
+ const { targets: _targets, ...rest } = result;
853
+ return rest;
854
+ }
855
+ function onDisk(deferred) {
856
+ const result = withoutTargets(deferred);
851
857
  if (!("files" in result) || result.files === void 0) return result;
852
858
  const { files, ...rest } = result;
853
859
  const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
@@ -1399,6 +1405,7 @@ async function startRun(passed, declared2) {
1399
1405
  let runId = null;
1400
1406
  let joined = false;
1401
1407
  let offline = token === "";
1408
+ let targetsRefused = false;
1402
1409
  let done = false;
1403
1410
  const shortened = /* @__PURE__ */ new Set();
1404
1411
  const specFiles = /* @__PURE__ */ new Map();
@@ -1668,16 +1675,24 @@ async function startRun(passed, declared2) {
1668
1675
  await send(submissions, filesByKey);
1669
1676
  }
1670
1677
  async function send(submissions, filesByKey) {
1671
- for (const part of packed(submissions)) {
1678
+ for (const packedPart of packed(submissions)) {
1679
+ let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
1672
1680
  if (offline) {
1673
1681
  defer(part);
1674
1682
  continue;
1675
1683
  }
1676
- const out = await client.post(
1684
+ const post = (results) => client.post(
1677
1685
  `/v1/runs/${runId}/results`,
1678
1686
  // The job's combination on every batch; a refusal of it is a 422 said below as it came.
1679
- { results: part, ...configuration !== void 0 ? { configuration } : {} }
1687
+ { results, ...configuration !== void 0 ? { configuration } : {} }
1680
1688
  );
1689
+ let out = await post(part);
1690
+ if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0)) {
1691
+ if (!targetsRefused) log("plune: the platform does not take targets on a result yet \u2014 the results are sent without them.");
1692
+ targetsRefused = true;
1693
+ part = part.map(withoutTargets);
1694
+ out = await post(part);
1695
+ }
1681
1696
  const counts = out.ok ? out.body?.counts : void 0;
1682
1697
  const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
1683
1698
  if (told.length > 0) {
package/dist/index.js CHANGED
@@ -813,7 +813,13 @@ function textRefusal(bytes) {
813
813
  }
814
814
  return void 0;
815
815
  }
816
- function onDisk(result) {
816
+ function withoutTargets(result) {
817
+ if (result.targets === void 0) return result;
818
+ const { targets: _targets, ...rest } = result;
819
+ return rest;
820
+ }
821
+ function onDisk(deferred) {
822
+ const result = withoutTargets(deferred);
817
823
  if (!("files" in result) || result.files === void 0) return result;
818
824
  const { files, ...rest } = result;
819
825
  const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
@@ -1365,6 +1371,7 @@ async function startRun(passed, declared2) {
1365
1371
  let runId = null;
1366
1372
  let joined = false;
1367
1373
  let offline = token === "";
1374
+ let targetsRefused = false;
1368
1375
  let done = false;
1369
1376
  const shortened = /* @__PURE__ */ new Set();
1370
1377
  const specFiles = /* @__PURE__ */ new Map();
@@ -1634,16 +1641,24 @@ async function startRun(passed, declared2) {
1634
1641
  await send(submissions, filesByKey);
1635
1642
  }
1636
1643
  async function send(submissions, filesByKey) {
1637
- for (const part of packed(submissions)) {
1644
+ for (const packedPart of packed(submissions)) {
1645
+ let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
1638
1646
  if (offline) {
1639
1647
  defer(part);
1640
1648
  continue;
1641
1649
  }
1642
- const out = await client.post(
1650
+ const post = (results) => client.post(
1643
1651
  `/v1/runs/${runId}/results`,
1644
1652
  // The job's combination on every batch; a refusal of it is a 422 said below as it came.
1645
- { results: part, ...configuration !== void 0 ? { configuration } : {} }
1653
+ { results, ...configuration !== void 0 ? { configuration } : {} }
1646
1654
  );
1655
+ let out = await post(part);
1656
+ if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0)) {
1657
+ if (!targetsRefused) log("plune: the platform does not take targets on a result yet \u2014 the results are sent without them.");
1658
+ targetsRefused = true;
1659
+ part = part.map(withoutTargets);
1660
+ out = await post(part);
1661
+ }
1647
1662
  const counts = out.ok ? out.body?.counts : void 0;
1648
1663
  const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
1649
1664
  if (told.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/playwright",
3
- "version": "0.7.2",
3
+ "version": "0.7.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.39.3"
41
+ "@plune-ai/cli": "0.39.4"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",