diff options
Diffstat (limited to 'tests/specs/run/error_019_stack_function')
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/specs/run/error_019_stack_function/__test__.jsonc b/tests/specs/run/error_019_stack_function/__test__.jsonc new file mode 100644 index 000000000..5e272ee49 --- /dev/null +++ b/tests/specs/run/error_019_stack_function/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run error_019_stack_function.ts", + "output": "error_019_stack_function.ts.out", + "exitCode": 1 +} diff --git a/tests/specs/run/error_019_stack_function/error_019_stack_function.ts b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts new file mode 100644 index 000000000..a6a69d146 --- /dev/null +++ b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts @@ -0,0 +1,12 @@ +function foo(): never { + throw new Error("function"); +} + +try { + foo(); +} catch (error) { + if (error instanceof Error) { + console.log(error.stack); + } + throw error; +} diff --git a/tests/specs/run/error_019_stack_function/error_019_stack_function.ts.out b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts.out new file mode 100644 index 000000000..edaff27c0 --- /dev/null +++ b/tests/specs/run/error_019_stack_function/error_019_stack_function.ts.out @@ -0,0 +1,8 @@ +[WILDCARD]Error: function + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] +error: Uncaught (in promise) Error: function + throw new Error("function"); + ^ + at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD]) + at [WILDCARD]/error_019_stack_function.ts:[WILDCARD] |