@empiricalrun/playwright-utils 0.55.0 → 0.57.0

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.
@@ -1,4 +1,4 @@
1
- import type { FullResult, Reporter, TestCase, TestResult } from "@playwright/test/reporter";
1
+ import type { FullConfig, FullResult, Reporter, TestCase, TestResult } from "@playwright/test/reporter";
2
2
  declare class EmpiricalReporter implements Reporter {
3
3
  private _currentWorkingDir;
4
4
  private _testResultSourceDir;
@@ -8,7 +8,9 @@ declare class EmpiricalReporter implements Reporter {
8
8
  private _testRetryCounts;
9
9
  private _uploader;
10
10
  private _attachmentCleanup;
11
+ private _maxFailures;
11
12
  constructor();
13
+ onBegin(config: FullConfig): void;
12
14
  private _piSandboxLog;
13
15
  private enqueTestAttachmentUploadTask;
14
16
  onTestEnd(test: TestCase, result: TestResult): void;
@@ -1 +1 @@
1
- {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAuBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,kBAAkB,CAA2B;IAErD,cAEC;IAED,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,6BAA6B,CAuCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,QAiI3C;IAEK,KAAK,CAAC,MAAM,EAAE,UAAU,iBAiH7B;IAED,OAAO,CAAC,qBAAqB;YAkBf,gBAAgB;YAOhB,iBAAiB;CAqChC;eAEc,iBAAiB"}
1
+ {"version":3,"file":"empirical-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/empirical-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACX,MAAM,2BAA2B,CAAC;AAuBnC,cAAM,iBAAkB,YAAW,QAAQ;IACzC,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,oBAAoB,CAG1B;IACF,OAAO,CAAC,sBAAsB,CAAuB;IACrD,OAAO,CAAC,YAAY,CAAgD;IACpE,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,kBAAkB,CAA2B;IAGrD,OAAO,CAAC,YAAY,CAAqB;IAEzC,cAEC;IAED,OAAO,CAAC,MAAM,EAAE,UAAU,QAEzB;IAED,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,6BAA6B,CAuCnC;IAEF,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,QAkI3C;IAEK,KAAK,CAAC,MAAM,EAAE,UAAU,iBAiH7B;IAED,OAAO,CAAC,qBAAqB;YAkBf,gBAAgB;YAOhB,iBAAiB;CAqChC;eAEc,iBAAiB"}
@@ -23,9 +23,15 @@ class EmpiricalReporter {
23
23
  _testRetryCounts = new Map();
24
24
  _uploader = null;
25
25
  _attachmentCleanup = new attachment_cleanup_1.AttachmentCleanup();
26
+ // Resolved Playwright maxFailures (0 = no cap), sent on every run-end event
27
+ // so the server-side early-end enforces the client's configured cap.
28
+ _maxFailures;
26
29
  constructor() {
27
30
  this._uploader = (0, uploader_1.getUploader)();
28
31
  }
32
+ onBegin(config) {
33
+ this._maxFailures = config.maxFailures;
34
+ }
29
35
  _piSandboxLog(message) {
30
36
  const runningInsidePiSandbox = process.env.RUNNING_INSIDE_PI_SANDBOX === "true";
31
37
  if (!runningInsidePiSandbox) {
@@ -150,6 +156,7 @@ class EmpiricalReporter {
150
156
  runId: process.env.TEST_RUN_GITHUB_ACTION_ID,
151
157
  failingLine,
152
158
  shardIndex,
159
+ maxFailures: this._maxFailures,
153
160
  };
154
161
  return (0, util_1.sendTestCaseUpdateToDashboard)(params);
155
162
  }
@@ -117,7 +117,13 @@ function createUploader() {
117
117
  logger_1.logger.debug("[Uploader] PROJECT_NAME and TEST_RUN_GITHUB_ACTION_ID must be set");
118
118
  return null;
119
119
  }
120
- const enableS3 = process.env.ENABLE_S3_UPLOADS === "true";
120
+ // REPORT_STORAGE_BACKEND selects the upload target; anything else is a misconfig.
121
+ const backend = process.env.REPORT_STORAGE_BACKEND;
122
+ if (backend !== "s3" && backend !== "r2") {
123
+ logger_1.logger.debug(`[Uploader] REPORT_STORAGE_BACKEND must be "s3" or "r2" (got ${backend ?? "unset"})`);
124
+ return null;
125
+ }
126
+ const enableS3 = backend === "s3";
121
127
  const credentials = Uploader.getCredentialsFromEnv(enableS3);
122
128
  if (!credentials) {
123
129
  const storageType = enableS3 ? "S3" : "R2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.55.0",
3
+ "version": "0.57.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -56,7 +56,7 @@
56
56
  "ts-morph": "^23.0.0",
57
57
  "@empiricalrun/cua": "^0.4.1",
58
58
  "@empiricalrun/llm": "^0.27.0",
59
- "@empiricalrun/r2-uploader": "^0.9.1",
59
+ "@empiricalrun/r2-uploader": "^0.10.0",
60
60
  "@empiricalrun/reporter": "^0.29.1"
61
61
  },
62
62
  "scripts": {