mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00: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));
|
ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, filter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ObjectPrototypeIsPrototypeOf(ErrorPrototype, value)) {
|
||||||
keys = ArrayPrototypeFilter(keys, (key) => key !== "cause");
|
keys = ArrayPrototypeFilter(keys, (key) => key !== "cause");
|
||||||
|
}
|
||||||
return keys;
|
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(), {}))
|
// console.log(new Proxy(new RegExp(), {}))
|
||||||
Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedRegExp() {
|
Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedRegExp() {
|
||||||
mockConsole((console, out) => {
|
mockConsole((console, out) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue