-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno.test: shorter stack traces #13586
Comments
I have actually previously proposed we do this for all stack traces in the runtime (remove all stack entries coming from |
Personally, I think this would be a great idea. A long time ago, I've written in detail about how This also seems like it's quite common behaviour everywhere else in the JS ecosystem. For reference, Jest also does it. I'd be happy to contribute with this feature if maintainers do decide to go forward with it (in case they'd be happy for me to do so) 😊 |
@lucasfcosta yes, this is desired behavior. If you'd like to work on it then great, PRs are always greatly appreciated! |
I believe we can close this one because the desired behaviour has already been implemented. It seems to be implemented through the op below which is called when formatting a callsite: Lines 41 to 68 in 6fad5c3
We may want to implement this behaviour only when a particular flag is set though. Also, I double-checked that internal frames are indeed cut-off by running the following two tests, one with function t() {
throw new Error("example");
}
t(); import { fail } from "https://deno.land/[email protected]/testing/asserts.ts";
Deno.test("example", () => fail()); No internal frames appeared in both cases. |
Ah I was looking for this issue but couldn't find it. Indeed this issue was fixed by #14302 |
I've created a related feature request in #27553 and would welcome feedback. |
Deno.test
currently prints the entire stack for errors in failures but this is typically unnecessary and is noise (unless you're troubleshootingdeno test
itself).I suggest omitting deno-cli-specific stack information and, if needed, provide an opt-in flag for printing the entire stack but to not print it by default.
This should make it easier for developers to understand why their tests failed and not be concerned about Deno's internal runtime details, etc.
e.g.
current output:
desired output:
diff:
The text was updated successfully, but these errors were encountered: