@browsermation/test 0.0.62 → 0.0.63-beta.2

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,8 +1,9 @@
1
1
  import type { FullConfig, FullResult, Reporter, Suite, TestCase, TestError, TestResult } from '@playwright/test/reporter';
2
2
  export default class BrowsermationReporter implements Reporter {
3
+ browsermationURL: string;
3
4
  log(message: string): void;
4
5
  constructor(options?: {
5
- customOption?: string;
6
+ reportingURL?: string;
6
7
  });
7
8
  getCurrentBranch(): Promise<string>;
8
9
  sendData(data: Record<string, any>): Promise<void>;
package/dist/reporter.js CHANGED
@@ -33,14 +33,17 @@ var regex = (({ onlyFirst = false } = {}) => {
33
33
  })();
34
34
  var stripAnsi = (str) => str.replace(regex, "");
35
35
  var BrowsermationReporter = class {
36
+ browsermationURL = "";
36
37
  log(message) {
37
38
  if (process.env.BM_REPORTER_LOGS) {
38
39
  console.log(message);
39
40
  }
40
41
  }
41
42
  constructor(options = {}) {
43
+ this.browsermationURL = options.reportingURL || process.env.BM_REPORTING_URL || "https://browsermation.com/api/v1/playwright/reporting";
44
+ this.log(`Using Browsermation reporting URL: ${this.browsermationURL}`);
42
45
  this.log(
43
- `my-awesome-reporter setup with customOption set to ${options.customOption}`
46
+ "Using API Token: " + (process.env.BM_API_TOKEN ? process.env.BM_API_TOKEN.slice(0, 4) + "****" : "not set")
44
47
  );
45
48
  }
46
49
  async getCurrentBranch() {
@@ -56,9 +59,9 @@ var BrowsermationReporter = class {
56
59
  });
57
60
  }
58
61
  async sendData(data) {
59
- const url = process.env.BM_REPORTING_URL || "https://browsermation.com/api/v1/playwright/reporting";
62
+ this.log(`Sending data to Browsermation: ${JSON.stringify(data)}`);
60
63
  try {
61
- await fetch(url, {
64
+ await fetch(this.browsermationURL, {
62
65
  method: "POST",
63
66
  headers: {
64
67
  Accept: "application/json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.62",
3
+ "version": "0.0.63-beta.2",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",