@plune-ai/playwright 0.2.3 → 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/dist/index.cjs CHANGED
@@ -509,7 +509,7 @@ function resultKey(testId, retry) {
509
509
  var SOURCE = "playwright";
510
510
  function fileOf(test) {
511
511
  for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
512
- if (suite.type === "file") return suite.title;
512
+ if (suite.type === "file") return suite.title.replace(/\\/g, "/");
513
513
  }
514
514
  return "";
515
515
  }
@@ -586,6 +586,8 @@ function pendingFrom(test, result) {
586
586
  var PluneReporter = class {
587
587
  options;
588
588
  session = null;
589
+ /** Every test the runner means to run, captured at the start for the one up-front lookup. */
590
+ declared = [];
589
591
  /** Results arrive from a sync callback; this serialises them into the async core. */
590
592
  chain = Promise.resolve();
591
593
  keepOpen = false;
@@ -604,23 +606,34 @@ var PluneReporter = class {
604
606
  onConfigure(config) {
605
607
  this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
606
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
+ */
607
616
  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
- );
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;
620
634
  }
621
635
  onTestEnd(test, result) {
622
- const session = this.session;
623
- if (session === null) return;
636
+ const session = this.open();
624
637
  this.chain = this.chain.then(async () => {
625
638
  (await session).add(pendingFrom(test, result));
626
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
@@ -475,7 +475,7 @@ function resultKey(testId, retry) {
475
475
  var SOURCE = "playwright";
476
476
  function fileOf(test) {
477
477
  for (let suite = test.parent; suite !== void 0; suite = suite.parent) {
478
- if (suite.type === "file") return suite.title;
478
+ if (suite.type === "file") return suite.title.replace(/\\/g, "/");
479
479
  }
480
480
  return "";
481
481
  }
@@ -552,6 +552,8 @@ function pendingFrom(test, result) {
552
552
  var PluneReporter = class {
553
553
  options;
554
554
  session = null;
555
+ /** Every test the runner means to run, captured at the start for the one up-front lookup. */
556
+ declared = [];
555
557
  /** Results arrive from a sync callback; this serialises them into the async core. */
556
558
  chain = Promise.resolve();
557
559
  keepOpen = false;
@@ -570,23 +572,34 @@ var PluneReporter = class {
570
572
  onConfigure(config) {
571
573
  this.keepOpen = config.shard !== null && config.shard !== void 0 || readEnv().keepOpen;
572
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
+ */
573
582
  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
- );
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;
586
600
  }
587
601
  onTestEnd(test, result) {
588
- const session = this.session;
589
- if (session === null) return;
602
+ const session = this.open();
590
603
  this.chain = this.chain.then(async () => {
591
604
  (await session).add(pendingFrom(test, result));
592
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",
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.11.0"
41
+ "@plune-ai/cli": "0.11.1"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",