summaryrefslogtreecommitdiff
path: root/js/console_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/console_test.ts')
-rw-r--r--js/console_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/console_test.ts b/js/console_test.ts
index cfe75dafe..94a627a5f 100644
--- a/js/console_test.ts
+++ b/js/console_test.ts
@@ -91,3 +91,17 @@ test(function consoleTestStringifyCircular() {
"Console { printFunc: [Function], debug: [Function: log], info: [Function: log], error: [Function: warn] }"
);
});
+
+test(function consoleTestError() {
+ class MyError extends Error {
+ constructor(msg: string) {
+ super(msg);
+ this.name = "MyError";
+ }
+ }
+ try {
+ throw new MyError("This is an error");
+ } catch (e) {
+ assertEqual(stringify(e).split("\n")[0], "MyError: This is an error");
+ }
+});