aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/console/console-log.js
diff options
context:
space:
mode:
authorGravatar Liz <accs@liz3.net> 2023-09-27 04:47:37 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-26 19:47:37 -0700
commitd7b43f8ea17694641a355d5659c00563e60d0acf (patch)
tree5a4115c423ebd6c404fc4e1407914d7ff64acf76 /test/js/web/console/console-log.js
parent648d5aecf3980997c0672746374068033e632e1d (diff)
downloadbun-d7b43f8ea17694641a355d5659c00563e60d0acf.tar.gz
bun-d7b43f8ea17694641a355d5659c00563e60d0acf.tar.zst
bun-d7b43f8ea17694641a355d5659c00563e60d0acf.zip
fix: support console.dir options object correctly (#6059)
* fix: support console,dir options object correctly `console.dir` can be passed a second argument which is a object of options. This implements that logic with the currently supported properties: `depth` and `colors`. I used node as a reference for implementation details. Fixes: https://github.com/oven-sh/bun/issues/6039 * style: format zig file * fix: implement changes from review Implements changes requested from review, like adding more test cases and refactoring code style.
Diffstat (limited to 'test/js/web/console/console-log.js')
-rw-r--r--test/js/web/console/console-log.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/js/web/console/console-log.js b/test/js/web/console/console-log.js
index a70d5e061..95f419781 100644
--- a/test/js/web/console/console-log.js
+++ b/test/js/web/console/console-log.js
@@ -72,3 +72,7 @@ const nestedObject = {
},
};
console.log(nestedObject);
+console.dir({ 1: { 2: { 3: 3 } } }, { depth: 0, colors: false }, "Some ignored arg");
+console.dir({ 1: { 2: { 3: 3 } } }, { depth: -1, colors: false }, "Some ignored arg");
+console.dir({ 1: { 2: { 3: 3 } } }, { depth: 1.2, colors: false }, "Some ignored arg");
+console.dir({ 1: { 2: { 3: 3 } } }, { depth: Infinity, colors: false }, "Some ignored arg");