browser-ava 2.2.36 → 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.36",
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,29 +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
- BigInt.prototype.toJSON = function () {
13
+ function primitiveRoString() {
14
14
  return this.toString();
15
- };
16
- Error.prototype.toJSON = function () {
17
- return this.toString();
18
- };
15
+ }
16
+ BigInt.prototype.toJSON = primitiveRoString;
17
+ Error.prototype.toJSON = primitiveRoString;
19
18
 
20
19
  /*
21
20
  forward console info,log,error to the server
22
21
  */
23
- for (const slot of ["log", "info", "error"]) {
24
- const former = console[slot];
22
+ for (const action of ["log", "info", "error"]) {
23
+ const former = console[action];
25
24
 
26
- console[slot] = (...args) => {
25
+ console[action] = (...data) => {
27
26
  if (ws) {
28
- ws.send(JSON.stringify({ action: slot, data: args }));
27
+ ws.send(JSON.stringify({ action, data }));
29
28
  }
30
- former(...args);
29
+ former(...data);
31
30
  };
32
31
  }
33
32
 
@@ -86,7 +85,7 @@ async function displayTests() {
86
85
  .map(a => (a.title || "") + " " + (a.message || ""))
87
86
  .join(" ")
88
87
  : ""
89
- }</span>${t.message ? t.message : ""}</li>`;
88
+ }</span>${t.message ? t.message : ""}${t.stack ? "<br>" + t.stack : ""}</li>`;
90
89
  }
91
90
 
92
91
  function renderModule(tm) {
@@ -188,6 +187,7 @@ async function runTest(parent, tm, testInstance) {
188
187
  } catch (e) {
189
188
  testInstance.passed = false;
190
189
  testInstance.message = e;
190
+ testInstance.stack = e.stack;
191
191
  } finally {
192
192
  ws.send(JSON.stringify({ action: "update", data: testInstance }));
193
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