browser-ava 2.3.0 → 2.3.1
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 +1 -1
- package/src/browser/runtime.mjs +14 -3
package/package.json
CHANGED
package/src/browser/runtime.mjs
CHANGED
|
@@ -16,6 +16,17 @@ function primitiveRoString() {
|
|
|
16
16
|
BigInt.prototype.toJSON = primitiveRoString;
|
|
17
17
|
Error.prototype.toJSON = primitiveRoString;
|
|
18
18
|
|
|
19
|
+
function allErrorProperties(key, value) {
|
|
20
|
+
if (value instanceof Error) {
|
|
21
|
+
const error = {};
|
|
22
|
+
Object.
|
|
23
|
+
getOwnPropertyNames(value).
|
|
24
|
+
forEach((key) => error[key] = value[key]);
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
/*
|
|
20
31
|
forward console info,log,error to the server
|
|
21
32
|
*/
|
|
@@ -24,7 +35,7 @@ for (const action of ["log", "info", "error"]) {
|
|
|
24
35
|
|
|
25
36
|
console[action] = (...data) => {
|
|
26
37
|
if (ws) {
|
|
27
|
-
ws.send(JSON.stringify({ action, data }));
|
|
38
|
+
ws.send(JSON.stringify({ action, data }, allErrorProperties));
|
|
28
39
|
}
|
|
29
40
|
former(...data);
|
|
30
41
|
};
|
|
@@ -189,7 +200,7 @@ async function runTest(parent, tm, testInstance) {
|
|
|
189
200
|
testInstance.message = e;
|
|
190
201
|
testInstance.stack = e.stack;
|
|
191
202
|
} finally {
|
|
192
|
-
ws.send(JSON.stringify({ action: "update", data: testInstance }));
|
|
203
|
+
ws.send(JSON.stringify({ action: "update", data: testInstance }, allErrorProperties));
|
|
193
204
|
}
|
|
194
205
|
}
|
|
195
206
|
}
|
|
@@ -231,7 +242,7 @@ async function runTestModule(tm) {
|
|
|
231
242
|
async function runTestModules() {
|
|
232
243
|
await Promise.all(testModules.map(tm => runTestModule(tm)));
|
|
233
244
|
|
|
234
|
-
ws.send(JSON.stringify({ action: "result", data: testModules }));
|
|
245
|
+
ws.send(JSON.stringify({ action: "result", data: testModules }, allErrorProperties));
|
|
235
246
|
|
|
236
247
|
displayTests();
|
|
237
248
|
}
|