Replies: 2 comments 1 reply
-
I think this exists to ensure there is always some stack trace. I am not sure why it is 6 though. (maybe it's the amount of stacks to the actual source?) Also it actually limits the stack trace to only 6 (the first line is the message): vitest/packages/vitest/src/runtime/console.ts Line 155 in 790bc31 I think we can remove this limitation and just always send the full stack.
The docs are also incorrectly show I think this function should also apply to the stack printed by
This is kind of expected of Errors, no? We can add this to docs for those who are unaware of |
Beta Was this translation helpful? Give feedback.
-
I think that would be great
Should I make a PR?
I didn't even know stack traces come from Errors (Eg that there isn't a separate API), let alone that there's a default limit. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, I love vitest, thanks for maintaining it!
Based on the docs here:
https://vitest.dev/config/#onstacktrace
It's not obvious that this only applies to errors and not to the
printConsoleTraceoption. And I'm also not sure if the default option does indeed print an unlimited number of frames, as I can't find anywhere where thestackTraceLimitis being set high enough.https://vitest.dev/config/#printconsoletrace => this option also doesn't specify that it arbitrarily limits the stack trace in these cases to the default + 6 here:
vitest/packages/vitest/src/runtime/console.ts
Line 152 in 790bc31
I wish the docs told me that
Error.stackTraceLimitalso plays a role.I also wish that this would be more configurable, maybe even turning on stack traces only for warnings/errors.
I'd be happy to contribute some patches if this is a welcome change
Beta Was this translation helpful? Give feedback.
All reactions