Skip to content

Commit

Permalink
tests: debugging CI browser failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jan 4, 2025
1 parent f1821a6 commit ce7212d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib.commonjs/_tests/utils-debug.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions lib.commonjs/_tests/utils-debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/_tests/utils-debug.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.esm/_tests/utils-debug.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions lib.esm/_tests/utils-debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.esm/_tests/utils-debug.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions src.ts/_tests/utils-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ function _inspectString(value: any, done: Set<any>): string {
return JSON.stringify(value);
case "symbol":
return `[Symbol ${ String(value) }]`
case "object":
case "object": {
if (value == null) { return "null"; }
return "{ " + Object.keys(value).map((key) => {

const keys = Object.keys(value);
Object.getOwnPropertyNames(value).forEach((key) => {
keys.push(key);
});

return "{ " + keys.map((key) => {
return `${ key }=${ _inspect(value[key], done) }`;
}).join(", ") + " }";
}
}

return `[ unknown type: ${ value } ]`
}

function _inspect(value: any, done: Set<any>): string {
console.log("DEBUG-1", value);
if (done.has(value)) { return "[ Circular ]"; }

done.add(value);
const result = _inspectString(value, done);
console.log("DEBUG-2", result);
done.delete(value);

return result;
Expand Down

0 comments on commit ce7212d

Please sign in to comment.