proby 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/lib/run.js +11 -2
  2. package/package.json +1 -1
package/lib/run.js CHANGED
@@ -4,7 +4,7 @@ import red from "@rcompat/cli/color/red";
4
4
  import print from "@rcompat/cli/print";
5
5
  import repository from "@rcompat/test/repository";
6
6
  const endings = [".spec.ts", ".spec.js"];
7
- function stringify(value) {
7
+ function stringify_scalar(value) {
8
8
  if (value === null)
9
9
  return "null";
10
10
  if (value === undefined)
@@ -18,9 +18,18 @@ function stringify(value) {
18
18
  if (typeof value === "function") {
19
19
  return `[Function${value.name ? `: ${value.name}` : ""}]`;
20
20
  }
21
+ }
22
+ function stringify(value) {
23
+ const scalar = stringify_scalar(value);
24
+ if (scalar !== undefined) {
25
+ return scalar;
26
+ }
21
27
  if (typeof value === "object") {
22
28
  try {
23
- return JSON.stringify(value, (_, sub) => stringify(sub));
29
+ return JSON.stringify(value, (_, sub) => {
30
+ const s = stringify_scalar(sub);
31
+ return s !== undefined ? s : sub;
32
+ });
24
33
  }
25
34
  catch {
26
35
  return "[Object (circular or unserializable)]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proby",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Standard library test runner",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",