@browsermation/test 0.0.64 → 0.0.65

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.
Files changed (2) hide show
  1. package/dist/reporter.js +11 -11
  2. package/package.json +1 -1
package/dist/reporter.js CHANGED
@@ -53,7 +53,7 @@ var BrowsermationReporter = class {
53
53
  this.log(
54
54
  "Using API Token: " + (this.apiToken ? this.apiToken.slice(0, 4) + "****" : "not set")
55
55
  );
56
- if (!this.apiToken) {
56
+ if (!this.apiToken && !process.env.BM_REPORTER_ONLY_LOG_EVENTS) {
57
57
  console.warn(
58
58
  "Warning: No API token set for Browsermation Reporter. Set BM_API_TOKEN environment variable or pass apiToken in reporter options."
59
59
  );
@@ -153,17 +153,17 @@ var BrowsermationReporter = class {
153
153
  });
154
154
  }
155
155
  async sendData(data) {
156
- if (!this.apiToken) {
157
- this.log("API token not set. Skipping sending data to Browsermation.");
158
- return;
159
- }
160
- this.log(`Sending data to Browsermation: ${JSON.stringify(data)}`);
161
156
  if (process.env.BM_REPORTER_ONLY_LOG_EVENTS) {
162
157
  this.log(
163
158
  "BM_REPORTER_ONLY_LOG_EVENTS is set to true. Skipping sending data to Browsermation."
164
159
  );
165
160
  return;
166
161
  }
162
+ if (!this.apiToken) {
163
+ this.log("API token not set. Skipping sending data to Browsermation.");
164
+ return;
165
+ }
166
+ this.log(`Sending data to Browsermation: ${JSON.stringify(data)}`);
167
167
  try {
168
168
  const response = await fetch(this.browsermationURL, {
169
169
  method: "POST",
@@ -215,7 +215,7 @@ var BrowsermationReporter = class {
215
215
  playwright_version: _config.version,
216
216
  node_version: process.version
217
217
  };
218
- this.log(`${JSON.stringify(data)}
218
+ this.logEvent(`${JSON.stringify(data)}
219
219
  `);
220
220
  const response = await this.sendData(data);
221
221
  if (response?.data?.suite_run_id) {
@@ -232,7 +232,7 @@ var BrowsermationReporter = class {
232
232
  status: result.status,
233
233
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
234
234
  };
235
- this.log(`${JSON.stringify(data)}
235
+ this.logEvent(`${JSON.stringify(data)}
236
236
  `);
237
237
  await this.sendData(data);
238
238
  }
@@ -278,7 +278,7 @@ var BrowsermationReporter = class {
278
278
  stderr: result.stderr.map((s) => stripAnsi(s.toString())).join("\n"),
279
279
  stdout: result.stdout.map((s) => stripAnsi(s.toString())).join("\n")
280
280
  };
281
- this.log(`${JSON.stringify(data)}
281
+ this.logEvent(`${JSON.stringify(data)}
282
282
  `);
283
283
  await this.sendData(data);
284
284
  }
@@ -290,7 +290,7 @@ var BrowsermationReporter = class {
290
290
  stack: error.stack,
291
291
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
292
292
  };
293
- console.error(`${JSON.stringify(data)}
293
+ this.logEvent(`${JSON.stringify(data)}
294
294
  `);
295
295
  await this.sendData(data);
296
296
  }
@@ -300,7 +300,7 @@ var BrowsermationReporter = class {
300
300
  suite_run_id: this.suiteRunId,
301
301
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
302
302
  };
303
- this.log(`${JSON.stringify(data)}
303
+ this.logEvent(`${JSON.stringify(data)}
304
304
  `);
305
305
  await this.sendData(data);
306
306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",