-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(test): Represent uncaught errors #14513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
fn report_uncaught_error(&mut self, origin: &str, js_error: &JsError) { | ||
if self.current_origin == Some(origin.to_string()) { | ||
self.current_origin = None; | ||
} | ||
let stack = self.stack.remove(origin).unwrap_or_default(); | ||
let err_string = format!( | ||
"Uncaught error from {}: {}\nThis error was not caught from a test and caused the test runner to fail on the referenced module.\nIt most likely originated from a dangling promise, event/timeout handler or top-level code.", | ||
origin, | ||
test::format_test_error(js_error) | ||
); | ||
let messages = as_test_messages(err_string, false); | ||
for t in stack.iter().rev() { | ||
match t { | ||
TestOrTestStepDescription::TestDescription(desc) => { | ||
self.progress(lsp_custom::TestRunProgressMessage::Failed { | ||
test: desc.into(), | ||
messages: messages.clone(), | ||
duration: None, | ||
}); | ||
} | ||
TestOrTestStepDescription::TestStepDescription(desc) => { | ||
self.progress(lsp_custom::TestRunProgressMessage::Failed { | ||
test: desc.into(), | ||
messages: messages.clone(), | ||
duration: None, | ||
}); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the lsp part by just making it fail any running test from that origin. cc @kitsonk
@nayeemrmn I tested this PR in VSCode, but I don't see a difference between this build and latest Deno, all I get is a prompt like this: |
I had forgotten to update the worker orchestration on the lsp side, it's done now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit 4afa14b.
Closes #14449.
cc @bartlomieju