mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix(console): missing cause property on non-error objects (#26061)
Fixes https://github.com/denoland/deno/issues/26047
This commit is contained in:
parent
053894b9e0
commit
2d488e4bfb
2 changed files with 18 additions and 1 deletions
|
@ -1301,7 +1301,9 @@ function getKeys(value, showHidden) {
|
|||
ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, filter));
|
||||
}
|
||||
}
|
||||
keys = ArrayPrototypeFilter(keys, (key) => key !== "cause");
|
||||
if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, value)) {
|
||||
keys = ArrayPrototypeFilter(keys, (key) => key !== "cause");
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
|
|
@ -1913,6 +1913,21 @@ Deno.test(function consoleLogWhenCauseIsAssignedShouldNotPrintCauseTwice() {
|
|||
});
|
||||
});
|
||||
|
||||
Deno.test(function consoleLogCauseNotFilteredOnNonError() {
|
||||
mockConsole((console, out) => {
|
||||
const foo = {
|
||||
a: 1,
|
||||
b: 2,
|
||||
cause: 3,
|
||||
};
|
||||
console.log(foo);
|
||||
|
||||
const result = stripAnsiCode(out.toString());
|
||||
const expected = "{ a: 1, b: 2, cause: 3 }\n";
|
||||
assertEquals(result.trim(), expected.trim());
|
||||
});
|
||||
});
|
||||
|
||||
// console.log(new Proxy(new RegExp(), {}))
|
||||
Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedRegExp() {
|
||||
mockConsole((console, out) => {
|
||||
|
|
Loading…
Reference in a new issue