@browsermation/test 0.0.12 → 0.0.14

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.
package/dist/bin/cli.js CHANGED
@@ -42871,7 +42871,7 @@ var {
42871
42871
  // package.json
42872
42872
  var package_default = {
42873
42873
  name: "@browsermation/test",
42874
- version: "0.0.12",
42874
+ version: "0.0.14",
42875
42875
  description: "The testing platform for Playwright by Browsermation.",
42876
42876
  main: "./dist/index.js",
42877
42877
  types: "./dist/index.d.ts",
@@ -42898,10 +42898,10 @@ var package_default = {
42898
42898
  ],
42899
42899
  scripts: {
42900
42900
  "build:cli": "esbuild src/bin/cli.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/bin/cli.js",
42901
- "build:reporter": "esbuild src/reporter.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/reporter.js",
42901
+ "build:reporter": "esbuild src/reporter/reporter.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/reporter.js",
42902
42902
  "build:index": "esbuild src/index.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/index.js",
42903
42903
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
42904
- build: "rm -rf dist && npm run build:cli && npm run build:index && npm run build:types",
42904
+ build: "rm -rf dist && npm run build:cli && npm run build:index && npm run build:reporter && npm run build:types",
42905
42905
  start: "node dist/bin/cli.js",
42906
42906
  "build:start": "npm run build && npm start",
42907
42907
  publish: "npm run build && npm publish --access public"
@@ -0,0 +1,100 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/reporter/reporter.ts
20
+ var reporter_exports = {};
21
+ __export(reporter_exports, {
22
+ default: () => BrowsermationReporter
23
+ });
24
+ module.exports = __toCommonJS(reporter_exports);
25
+ var regex = (({ onlyFirst = false } = {}) => {
26
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
27
+ const pattern = [
28
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
29
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
30
+ ].join("|");
31
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
32
+ })();
33
+ var stripAnsi = (str) => str.replace(regex, "");
34
+ var BrowsermationReporter = class {
35
+ onBegin(_config, suite) {
36
+ const data = {
37
+ type: "begin",
38
+ title: suite.title,
39
+ file: suite.location?.file,
40
+ timestamp: Date.now()
41
+ };
42
+ console.log(`${JSON.stringify(data)}
43
+ `);
44
+ }
45
+ onEnd(result) {
46
+ const data = {
47
+ type: "end",
48
+ startTime: result.startTime,
49
+ duration: result.duration,
50
+ status: result.status,
51
+ timestamp: Date.now()
52
+ };
53
+ console.log(`${JSON.stringify(data)}
54
+ `);
55
+ }
56
+ onTestBegin(test) {
57
+ const data = {
58
+ id: test.id,
59
+ type: "test-start",
60
+ title: test.title,
61
+ file: test.location.file,
62
+ timestamp: Date.now()
63
+ };
64
+ console.log(`${JSON.stringify(data)}
65
+ `);
66
+ }
67
+ onTestEnd(test, result) {
68
+ const data = {
69
+ id: test.id,
70
+ type: "test-end",
71
+ title: test.title,
72
+ titlePath: test.titlePath,
73
+ status: result.status,
74
+ duration: result.duration,
75
+ errors: stripAnsi(result.error?.message || ""),
76
+ timestamp: Date.now()
77
+ };
78
+ console.log(`${JSON.stringify(data)}
79
+ `);
80
+ }
81
+ onError(error) {
82
+ const data = {
83
+ type: "error",
84
+ message: error.message,
85
+ stack: error.stack,
86
+ timestamp: Date.now()
87
+ };
88
+ console.error(`${JSON.stringify(data)}
89
+ `);
90
+ }
91
+ onExit() {
92
+ const data = {
93
+ type: "exit",
94
+ timestamp: Date.now()
95
+ };
96
+ console.log(`${JSON.stringify(data)}
97
+ `);
98
+ return Promise.resolve();
99
+ }
100
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,10 +27,10 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "build:cli": "esbuild src/bin/cli.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/bin/cli.js",
30
- "build:reporter": "esbuild src/reporter.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/reporter.js",
30
+ "build:reporter": "esbuild src/reporter/reporter.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/reporter.js",
31
31
  "build:index": "esbuild src/index.ts --bundle --platform=node --external:playwright --target=node22 --outfile=dist/index.js",
32
32
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
33
- "build": "rm -rf dist && npm run build:cli && npm run build:index && npm run build:types",
33
+ "build": "rm -rf dist && npm run build:cli && npm run build:index && npm run build:reporter && npm run build:types",
34
34
  "start": "node dist/bin/cli.js",
35
35
  "build:start": "npm run build && npm start",
36
36
  "publish": "npm run build && npm publish --access public"