diff options
Diffstat (limited to 'cli/tools/test/fmt.rs')
-rw-r--r-- | cli/tools/test/fmt.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index d66c72239..174155072 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -72,16 +72,24 @@ fn abbreviate_test_error(js_error: &JsError) -> JsError { // This function prettifies `JsError` and applies some changes specifically for // test runner purposes: // +// - hide stack traces if `options.hide_stacktraces` is set to `true` +// // - filter out stack frames: // - if stack trace consists of mixed user and internal code, the frames // below the first user code frame are filtered out // - if stack trace consists only of internal code it is preserved as is -pub fn format_test_error(js_error: &JsError) -> String { +pub fn format_test_error( + js_error: &JsError, + options: &TestFailureFormatOptions, +) -> String { let mut js_error = abbreviate_test_error(js_error); js_error.exception_message = js_error .exception_message .trim_start_matches("Uncaught ") .to_string(); + if options.hide_stacktraces { + return js_error.exception_message; + } format_js_error(&js_error) } |