diff options
-rw-r--r-- | cli/tests/integration/repl_tests.rs | 4 | ||||
-rw-r--r-- | cli/tests/testdata/npm/esm_import_cjs_default/main.out | 12 | ||||
-rw-r--r-- | cli/tests/testdata/npm/tarball_with_global_header/main.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/run/070_location.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/run/071_location_unset.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/run/top_level_await/loop.out | 4 | ||||
-rw-r--r-- | cli/tests/unit/console_test.ts | 2 | ||||
-rw-r--r-- | ext/console/02_console.js | 7 |
8 files changed, 21 insertions, 14 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs index f69f71398..43e601739 100644 --- a/cli/tests/integration/repl_tests.rs +++ b/cli/tests/integration/repl_tests.rs @@ -375,7 +375,7 @@ fn typescript_decorators() { Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); - assert_ends_with!(out, "undefined\n[Function: Test]\n2\n"); + assert_ends_with!(out, "undefined\n[Class: Test]\n2\n"); assert!(err.is_empty()); } @@ -943,7 +943,7 @@ fn npm_packages() { ); assert_contains!(out, "Module {"); - assert_contains!(out, "Chalk: [Function: Chalk],"); + assert_contains!(out, "Chalk: [Class: Chalk],"); assert!(err.is_empty()); } diff --git a/cli/tests/testdata/npm/esm_import_cjs_default/main.out b/cli/tests/testdata/npm/esm_import_cjs_default/main.out index 4b73328f3..2e90049d8 100644 --- a/cli/tests/testdata/npm/esm_import_cjs_default/main.out +++ b/cli/tests/testdata/npm/esm_import_cjs_default/main.out @@ -1,11 +1,11 @@ Node esm importing node cjs =========================== -{ default: [Function], named: [Function], MyClass: [Function: MyClass] } +{ default: [Function], named: [Function], MyClass: [Class: MyClass] } { default: [Function], named: [Function] } Module { - MyClass: [Function: MyClass], + MyClass: [Class: MyClass], __esModule: true, - default: { default: [Function], named: [Function], MyClass: [Function: MyClass] }, + default: { default: [Function], named: [Function], MyClass: [Class: MyClass] }, named: [Function] } Module { @@ -17,11 +17,11 @@ Module { static method Deno esm importing node cjs =========================== -{ default: [Function], named: [Function], MyClass: [Function: MyClass] } +{ default: [Function], named: [Function], MyClass: [Class: MyClass] } Module { - MyClass: [Function: MyClass], + MyClass: [Class: MyClass], __esModule: true, - default: { default: [Function], named: [Function], MyClass: [Function: MyClass] }, + default: { default: [Function], named: [Function], MyClass: [Class: MyClass] }, named: [Function] } =========================== diff --git a/cli/tests/testdata/npm/tarball_with_global_header/main.out b/cli/tests/testdata/npm/tarball_with_global_header/main.out index 2f309499e..caf351e2e 100644 --- a/cli/tests/testdata/npm/tarball_with_global_header/main.out +++ b/cli/tests/testdata/npm/tarball_with_global_header/main.out @@ -1 +1 @@ -[Function: Client] +[Class: Client] diff --git a/cli/tests/testdata/run/070_location.ts.out b/cli/tests/testdata/run/070_location.ts.out index 692d7c976..8b2f9e49d 100644 --- a/cli/tests/testdata/run/070_location.ts.out +++ b/cli/tests/testdata/run/070_location.ts.out @@ -1,4 +1,4 @@ -[WILDCARD][Function: Location] +[WILDCARD][Class: Location] Location {} Location { hash: "#bat", diff --git a/cli/tests/testdata/run/071_location_unset.ts.out b/cli/tests/testdata/run/071_location_unset.ts.out index 99f87a7fc..dc67c5578 100644 --- a/cli/tests/testdata/run/071_location_unset.ts.out +++ b/cli/tests/testdata/run/071_location_unset.ts.out @@ -1,4 +1,4 @@ -[WILDCARD][Function: Location] +[WILDCARD][Class: Location] Location {} undefined /bar diff --git a/cli/tests/testdata/run/top_level_await/loop.out b/cli/tests/testdata/run/top_level_await/loop.out index 70e621e45..7f72048c2 100644 --- a/cli/tests/testdata/run/top_level_await/loop.out +++ b/cli/tests/testdata/run/top_level_await/loop.out @@ -1,5 +1,5 @@ loading [WILDCARD]a.js -loaded Module { default: [Function: Foo] } +loaded Module { default: [Class: Foo] } loading [WILDCARD]b.js -loaded Module { default: [Function: Bar] } +loaded Module { default: [Class: Bar] } all loaded diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 1abacc9ad..ccc8638d2 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -237,7 +237,7 @@ Deno.test(function consoleTestStringifyCircular() { arrowFunc: [Function: arrowFunc], extendedClass: Extended { a: 1, b: 2 }, nFunc: [Function], - extendedCstr: [Function: Extended], + extendedCstr: [Class: Extended], o: { num: 2, bool: false, diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 1720fe7e2..a9ec52488 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -47,6 +47,7 @@ StringPrototypeToString, StringPrototypeTrim, StringPrototypeIncludes, + StringPrototypeStartsWith, TypeError, NumberParseInt, RegExp, @@ -82,6 +83,7 @@ ArrayPrototypeFilter, ArrayPrototypeFind, FunctionPrototypeBind, + FunctionPrototypeToString, Map, MapPrototype, MapPrototypeHas, @@ -347,6 +349,11 @@ // use generic 'Function' instead. cstrName = "Function"; } + const stringValue = FunctionPrototypeToString(value); + // Might be Class + if (StringPrototypeStartsWith(stringValue, "class")) { + cstrName = "Class"; + } // Our function may have properties, so we want to format those // as if our function was an object |