browser-ava 2.2.35 → 2.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ava",
3
- "version": "2.2.35",
3
+ "version": "2.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -46,7 +46,7 @@
46
46
  "ws": "^8.18.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^22.8.4",
49
+ "@types/node": "^22.8.7",
50
50
  "ava": "^6.2.0",
51
51
  "c8": "^10.1.2",
52
52
  "documentation": "^14.0.3",
@@ -5,32 +5,28 @@ import {
5
5
  pluralize,
6
6
  moduleName
7
7
  } from "./util.mjs";
8
- import { isEqual } from "./eql.mjs";
8
+ import { isEqual } from "./assertions.mjs";
9
9
 
10
10
  let ws = new WebSocket(`ws://${location.host}`);
11
11
  ws.onerror = console.error;
12
12
 
13
- ArrayBuffer.prototype.toJSON = function () {
13
+ function primitiveRoString() {
14
14
  return this.toString();
15
- };
16
- BigInt.prototype.toJSON = function () {
17
- return this.toString();
18
- };
19
- Error.prototype.toJSON = function () {
20
- return this.toString();
21
- };
15
+ }
16
+ BigInt.prototype.toJSON = primitiveRoString;
17
+ Error.prototype.toJSON = primitiveRoString;
22
18
 
23
19
  /*
24
20
  forward console info,log,error to the server
25
21
  */
26
- for (const slot of ["log", "info", "error"]) {
27
- const former = console[slot];
22
+ for (const action of ["log", "info", "error"]) {
23
+ const former = console[action];
28
24
 
29
- console[slot] = (...args) => {
25
+ console[action] = (...data) => {
30
26
  if (ws) {
31
- ws.send(JSON.stringify({ action: slot, data: args }));
27
+ ws.send(JSON.stringify({ action, data }));
32
28
  }
33
- former(...args);
29
+ former(...data);
34
30
  };
35
31
  }
36
32
 
@@ -89,7 +85,7 @@ async function displayTests() {
89
85
  .map(a => (a.title || "") + " " + (a.message || ""))
90
86
  .join(" ")
91
87
  : ""
92
- }</span>${t.message ? t.message : ""}</li>`;
88
+ }</span>${t.message ? t.message : ""}${t.stack ? "<br>" + t.stack : ""}</li>`;
93
89
  }
94
90
 
95
91
  function renderModule(tm) {
@@ -191,6 +187,7 @@ async function runTest(parent, tm, testInstance) {
191
187
  } catch (e) {
192
188
  testInstance.passed = false;
193
189
  testInstance.message = e;
190
+ testInstance.stack = e.stack;
194
191
  } finally {
195
192
  ws.send(JSON.stringify({ action: "update", data: testInstance }));
196
193
  }
@@ -134,6 +134,12 @@ program
134
134
  console.log(" ", chalk.green("✔"), data.title);
135
135
  } else {
136
136
  console.log(" ", chalk.red("✘ [fail]: "), data.title);
137
+ if(data.message) {
138
+ console.log(" ", data.message);
139
+ if(data.stack) {
140
+ console.log(" ", data.stack);
141
+ }
142
+ }
137
143
  }
138
144
  }
139
145
  }
File without changes