@plune-ai/playwright 0.2.3 → 0.2.5

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 CHANGED
@@ -56,6 +56,7 @@ fills in what you left out. Anything set in the config file wins.
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 |
59
+ | `PLUNE_FULL_RUN` | this run is the whole suite: a case it used to report and did not is marked detached |
59
60
 
60
61
  Flags are read by value, not by presence: `PLUNE_PROCEED=0` in a matrix cell means off.
61
62
 
@@ -69,6 +70,13 @@ result: a reporter sees a test's result, not its source, and a body nobody wrote
69
70
  queue exists to keep out. A person decides whether the project tracks the test; approving attaches
70
71
  the keys, so the next run resolves instead of offering it again.
71
72
 
73
+ `PLUNE_FULL_RUN=1` is the reporter's word that nothing was filtered out — not `-g`, not a file
74
+ argument, not `--only-changed`. When such a run finishes with every expected test reported, the
75
+ platform marks the active cases this reporter used to report and did not this time as **detached**
76
+ (kept, with their history; the run is named as the reason), and prints how many. A later result on
77
+ a detached case makes it active again on its own. Set it on the CI job that runs everything and
78
+ nowhere else; a run that lost a shard never detaches anything.
79
+
72
80
  `PLUNE_GROUP` is **not supported yet** — a group of runs is a Plune feature that does not exist, and
73
81
  a group of one run means nothing. Setting it prints a line saying it was ignored, rather than
74
82
  accepting it and quietly dropping it. If you report to a deployment older than run titles, the
package/dist/index.cjs CHANGED
@@ -161,6 +161,7 @@ function readEnv(env = process.env) {
161
161
  const environment = value(env, "PLUNE_ENV");
162
162
  const labels = list(env, "PLUNE_LABELS");
163
163
  const offerDiscovered = flag(env, "PLUNE_CREATE");
164
+ const full = flag(env, "PLUNE_FULL_RUN");
164
165
  return {
165
166
  config: {
166
167
  ...externalKey !== void 0 ? { externalKey } : {},
@@ -173,7 +174,8 @@ function readEnv(env = process.env) {
173
174
  ...labels !== void 0 ? { labels } : {},
174
175
  // Only when set: `false` here would outrank a config file that asked for it, and an unset
175
176
  // variable is not an instruction.
176
- ...offerDiscovered ? { offerDiscovered } : {}
177
+ ...offerDiscovered ? { offerDiscovered } : {},
178
+ ...full ? { full } : {}
177
179
  },
178
180
  // Two names for two situations that end the same way. `SHARED_RUN` says other processes are
179
181
  // reporting into this run; `PROCEED` says the job will close it on its own schedule. Either
@@ -313,7 +315,11 @@ async function startRun(passed, declared) {
313
315
  const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
314
316
  if (typeof hit === "string") return [{ testCaseId: hit }];
315
317
  return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
316
- })
318
+ }),
319
+ // The claim travels with the list it is about (D20). A runner that could not enumerate
320
+ // its tests has no list, and a claim without one is nothing the platform can check —
321
+ // so it is not sent, rather than sent and silently meaningless.
322
+ ...cfg.full === true ? { full: true } : {}
317
323
  };
318
324
  if (expected !== void 0 && expected.length > EXPECTED_MAX) {
319
325
  log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
@@ -480,6 +486,9 @@ async function startRun(passed, declared) {
480
486
  ...reason !== void 0 ? { reason } : {}
481
487
  });
482
488
  if (!out.ok) log(`plune: could not close run ${runId} (${out.detail || out.kind}).`);
489
+ else if (typeof out.body.detached === "number" && out.body.detached > 0) {
490
+ log(`plune: ${out.body.detached} test case(s) marked detached \u2014 this full run no longer reports them.`);
491
+ }
483
492
  }
484
493
  summarise();
485
494
  },
@@ -509,7 +518,7 @@ function resultKey(testId, retry) {
509
518
  var SOURCE = "playwright";
510
519
  function fileOf(test) {
511
520
  for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
512
- if (suite.type === "file") return suite.title;
521
+ if (suite.type === "file") return suite.title.replace(/\\/g, "/");
513
522
  }
514
523
  return "";
515
524
  }
@@ -586,6 +595,8 @@ function pendingFrom(test, result) {
586
595
  var PluneReporter = class {
587
596
  options;
588
597
  session = null;
598
+ /** Every test the runner means to run, captured at the start for the one up-front lookup. */
599
+ declared = [];
589
600
  /** Results arrive from a sync callback; this serialises them into the async core. */
590
601
  chain = Promise.resolve();
591
602
  keepOpen = false;
@@ -604,23 +615,34 @@ var PluneReporter = class {
604
615
  onConfigure(config) {
605
616
  this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
606
617
  }
618
+ /**
619
+ * Only the list is taken here; the run opens on the first result. `onBegin` also fires for
620
+ * `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
621
+ * there was an empty run on the platform every time, and with a rejected token the request it
622
+ * made was the one thing left pending when Node exited (a libuv assertion on Windows). No
623
+ * result, no run.
624
+ */
607
625
  onBegin(suite) {
608
- const tests = suite.allTests();
609
- this.session = startRun(
610
- {
611
- ...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
612
- ...this.options.token !== void 0 ? { token: this.options.token } : {},
613
- ...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
614
- ...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
615
- ...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
616
- meta: { runner: SOURCE }
617
- },
618
- tests.map(keysFor)
619
- );
626
+ this.declared = suite.allTests().map(keysFor);
627
+ }
628
+ open() {
629
+ if (this.session === null) {
630
+ this.session = startRun(
631
+ {
632
+ ...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
633
+ ...this.options.token !== void 0 ? { token: this.options.token } : {},
634
+ ...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
635
+ ...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
636
+ ...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
637
+ meta: { runner: SOURCE }
638
+ },
639
+ this.declared
640
+ );
641
+ }
642
+ return this.session;
620
643
  }
621
644
  onTestEnd(test, result) {
622
- const session = this.session;
623
- if (session === null) return;
645
+ const session = this.open();
624
646
  this.chain = this.chain.then(async () => {
625
647
  (await session).add(pendingFrom(test, result));
626
648
  }).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
@@ -127,6 +127,7 @@ function readEnv(env = process.env) {
127
127
  const environment = value(env, "PLUNE_ENV");
128
128
  const labels = list(env, "PLUNE_LABELS");
129
129
  const offerDiscovered = flag(env, "PLUNE_CREATE");
130
+ const full = flag(env, "PLUNE_FULL_RUN");
130
131
  return {
131
132
  config: {
132
133
  ...externalKey !== void 0 ? { externalKey } : {},
@@ -139,7 +140,8 @@ function readEnv(env = process.env) {
139
140
  ...labels !== void 0 ? { labels } : {},
140
141
  // Only when set: `false` here would outrank a config file that asked for it, and an unset
141
142
  // variable is not an instruction.
142
- ...offerDiscovered ? { offerDiscovered } : {}
143
+ ...offerDiscovered ? { offerDiscovered } : {},
144
+ ...full ? { full } : {}
143
145
  },
144
146
  // Two names for two situations that end the same way. `SHARED_RUN` says other processes are
145
147
  // reporting into this run; `PROCEED` says the job will close it on its own schedule. Either
@@ -279,7 +281,11 @@ async function startRun(passed, declared) {
279
281
  const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
280
282
  if (typeof hit === "string") return [{ testCaseId: hit }];
281
283
  return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
282
- })
284
+ }),
285
+ // The claim travels with the list it is about (D20). A runner that could not enumerate
286
+ // its tests has no list, and a claim without one is nothing the platform can check —
287
+ // so it is not sent, rather than sent and silently meaningless.
288
+ ...cfg.full === true ? { full: true } : {}
283
289
  };
284
290
  if (expected !== void 0 && expected.length > EXPECTED_MAX) {
285
291
  log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
@@ -446,6 +452,9 @@ async function startRun(passed, declared) {
446
452
  ...reason !== void 0 ? { reason } : {}
447
453
  });
448
454
  if (!out.ok) log(`plune: could not close run ${runId} (${out.detail || out.kind}).`);
455
+ else if (typeof out.body.detached === "number" && out.body.detached > 0) {
456
+ log(`plune: ${out.body.detached} test case(s) marked detached \u2014 this full run no longer reports them.`);
457
+ }
449
458
  }
450
459
  summarise();
451
460
  },
@@ -475,7 +484,7 @@ function resultKey(testId, retry) {
475
484
  var SOURCE = "playwright";
476
485
  function fileOf(test) {
477
486
  for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
478
- if (suite.type === "file") return suite.title;
487
+ if (suite.type === "file") return suite.title.replace(/\\/g, "/");
479
488
  }
480
489
  return "";
481
490
  }
@@ -552,6 +561,8 @@ function pendingFrom(test, result) {
552
561
  var PluneReporter = class {
553
562
  options;
554
563
  session = null;
564
+ /** Every test the runner means to run, captured at the start for the one up-front lookup. */
565
+ declared = [];
555
566
  /** Results arrive from a sync callback; this serialises them into the async core. */
556
567
  chain = Promise.resolve();
557
568
  keepOpen = false;
@@ -570,23 +581,34 @@ var PluneReporter = class {
570
581
  onConfigure(config) {
571
582
  this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
572
583
  }
584
+ /**
585
+ * Only the list is taken here; the run opens on the first result. `onBegin` also fires for
586
+ * `--list`, for a `--grep` that matches nothing and for a suite of zero tests — and a run opened
587
+ * there was an empty run on the platform every time, and with a rejected token the request it
588
+ * made was the one thing left pending when Node exited (a libuv assertion on Windows). No
589
+ * result, no run.
590
+ */
573
591
  onBegin(suite) {
574
- const tests = suite.allTests();
575
- this.session = startRun(
576
- {
577
- ...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
578
- ...this.options.token !== void 0 ? { token: this.options.token } : {},
579
- ...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
580
- ...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
581
- ...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
582
- meta: { runner: SOURCE }
583
- },
584
- tests.map(keysFor)
585
- );
592
+ this.declared = suite.allTests().map(keysFor);
593
+ }
594
+ open() {
595
+ if (this.session === null) {
596
+ this.session = startRun(
597
+ {
598
+ ...this.options.apiUrl !== void 0 ? { apiUrl: this.options.apiUrl } : {},
599
+ ...this.options.token !== void 0 ? { token: this.options.token } : {},
600
+ ...this.options.externalKey !== void 0 ? { externalKey: this.options.externalKey } : {},
601
+ ...this.options.batchSize !== void 0 ? { batchSize: this.options.batchSize } : {},
602
+ ...this.options.fallbackPath !== void 0 ? { fallbackPath: this.options.fallbackPath } : {},
603
+ meta: { runner: SOURCE }
604
+ },
605
+ this.declared
606
+ );
607
+ }
608
+ return this.session;
586
609
  }
587
610
  onTestEnd(test, result) {
588
- const session = this.session;
589
- if (session === null) return;
611
+ const session = this.open();
590
612
  this.chain = this.chain.then(async () => {
591
613
  (await session).add(pendingFrom(test, result));
592
614
  }).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",
3
+ "version": "0.2.5",
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.11.0"
41
+ "@plune-ai/cli": "0.12.0"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",