@browsermation/test 0.0.63-beta.6 → 0.0.63-beta.8

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.
@@ -9,6 +9,8 @@ export default class BrowsermationReporter implements Reporter {
9
9
  });
10
10
  getCurrentBranch(): Promise<string>;
11
11
  getCurrentRepo(): Promise<string>;
12
+ getLatestCommitId(): Promise<string>;
13
+ getLatestCommitMessage(): Promise<string>;
12
14
  sendData(data: Record<string, any>): Promise<void>;
13
15
  /**
14
16
  * 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
@@ -80,6 +80,30 @@ var BrowsermationReporter = class {
80
80
  );
81
81
  });
82
82
  }
83
+ async getLatestCommitId() {
84
+ return new Promise((resolve) => {
85
+ const { exec } = require("child_process");
86
+ exec("git rev-parse HEAD", (error, stdout) => {
87
+ if (error) {
88
+ resolve("unknown");
89
+ } else {
90
+ resolve(stdout.trim());
91
+ }
92
+ });
93
+ });
94
+ }
95
+ async getLatestCommitMessage() {
96
+ return new Promise((resolve) => {
97
+ const { exec } = require("child_process");
98
+ exec("git log -1 --pretty=%B", (error, stdout) => {
99
+ if (error) {
100
+ resolve("unknown");
101
+ } else {
102
+ resolve(stdout.trim());
103
+ }
104
+ });
105
+ });
106
+ }
83
107
  async sendData(data) {
84
108
  if (!this.apiToken) {
85
109
  this.log("API token not set. Skipping sending data to Browsermation.");
@@ -120,8 +144,12 @@ var BrowsermationReporter = class {
120
144
  hostname: (0, import_node_os.hostname)(),
121
145
  git_branch: await this.getCurrentBranch(),
122
146
  git_repo: await this.getCurrentRepo(),
147
+ git_commit_id: await this.getLatestCommitId(),
148
+ git_commit_message: await this.getLatestCommitMessage(),
123
149
  totalTests: suite.allTests().length,
124
- cpus: (0, import_node_os.cpus)().length
150
+ cpus: (0, import_node_os.cpus)().length,
151
+ playwright_version: _config.metadata?.playwrightVersion || "unknown",
152
+ node_version: process.version
125
153
  };
126
154
  this.log(`${JSON.stringify(data)}
127
155
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.63-beta.6",
3
+ "version": "0.0.63-beta.8",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",