@browsermation/test 0.0.63-beta.2 → 0.0.63-beta.3

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.
@@ -6,6 +6,7 @@ export default class BrowsermationReporter implements Reporter {
6
6
  reportingURL?: string;
7
7
  });
8
8
  getCurrentBranch(): Promise<string>;
9
+ getCurrentRepo(): Promise<string>;
9
10
  sendData(data: Record<string, any>): Promise<void>;
10
11
  /**
11
12
  * onBegin() is called once with a root suite that contains all other suites and tests. Learn more about suites hierarchy.
package/dist/reporter.js CHANGED
@@ -58,6 +58,21 @@ var BrowsermationReporter = class {
58
58
  });
59
59
  });
60
60
  }
61
+ async getCurrentRepo() {
62
+ return new Promise((resolve) => {
63
+ const { exec } = require("child_process");
64
+ exec(
65
+ "basename `git rev-parse --show-toplevel`",
66
+ (error, stdout) => {
67
+ if (error) {
68
+ resolve("unknown");
69
+ } else {
70
+ resolve(stdout.trim());
71
+ }
72
+ }
73
+ );
74
+ });
75
+ }
61
76
  async sendData(data) {
62
77
  this.log(`Sending data to Browsermation: ${JSON.stringify(data)}`);
63
78
  try {
@@ -87,8 +102,10 @@ var BrowsermationReporter = class {
87
102
  type: "begin",
88
103
  timestamp: Date.now(),
89
104
  hostname: (0, import_node_os.hostname)(),
90
- branch: await this.getCurrentBranch(),
91
- totalTests: suite.allTests().length
105
+ git_branch: await this.getCurrentBranch(),
106
+ git_repo: await this.getCurrentRepo(),
107
+ totalTests: suite.allTests().length,
108
+ cpus: (0, import_node_os.cpus)().length
92
109
  };
93
110
  this.log(`${JSON.stringify(data)}
94
111
  `);
@@ -113,7 +130,9 @@ var BrowsermationReporter = class {
113
130
  type: "test-start",
114
131
  title: test.title,
115
132
  file: test.location.file,
116
- timestamp: Date.now()
133
+ timestamp: Date.now(),
134
+ free_memory: (0, import_node_os.freemem)(),
135
+ total_memory: (0, import_node_os.totalmem)()
117
136
  };
118
137
  this.log(`${JSON.stringify(data)}
119
138
  `);
@@ -128,7 +147,9 @@ var BrowsermationReporter = class {
128
147
  status: result.status,
129
148
  duration: result.duration,
130
149
  errors: stripAnsi(result.error?.message || ""),
131
- timestamp: Date.now()
150
+ timestamp: Date.now(),
151
+ free_memory: (0, import_node_os.freemem)(),
152
+ total_memory: (0, import_node_os.totalmem)()
132
153
  };
133
154
  this.log(`${JSON.stringify(data)}
134
155
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.63-beta.2",
3
+ "version": "0.0.63-beta.3",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",