Open osher opened 2 months ago
I do not think it makes sense to support stack as an array as it is a very obscure edge case. But Vitest shouldn't crash here at least. To do that, we need to ignore all non-string stack
traces found on Errors.
I also do not think we should add options to bypass this for the same reason - the use case is too obscure to support. But maybe we can print non-string stacks as a property in that case:
I can agree with that :)
The basic "contract" with a test-runner is that the true error is visible. That's a must. All the "flying colors" and formatting can be done under SLA of best-effort.
As log as the information get to the screen - that would be good enough :)
If you could give me in the PR a hint on how you expect it be done in the PR - I'll be grateful :) Also - there's the macos check that I suspect to be flaky. If there's anything I can do to mend it - LMK, I'll include it.
Describe the bug
Description
I'm trying to evaluate migration to
vitest
frommocha
All the projects of this codebase use a module that adds
Error.prototype.toJSON
that represents stack as an array, (the string stack split by\n
). We're getting it from packages whose purpose is to make sure that when errors are serialized when sent to ELK and it's like - they comes with all data, and it makes the stacks represented as arrays - which:vitest: options.frameFilter
does)However, when I add a setup file that calls this aforementioned module - I get these violent crashes that hide the real error: e.g.:
I tried to do a quick PR https://github.com/vitest-dev/vitest/pull/6407, but this does not seem to be a one-liner fix, so I fall back to the full procedure 🤷
I really hope we can find a solution for this in the time I have left for this migration POC task, or all these projects will have to continue with mocha ...
The project looks amazing - Keep up the good work!
Reproduction
The minimalist form I could find. Please note we don't do it this way, we're using packages that do that and more (stated above).
Steps:
globals: true
invitest.config.js
System Info
If it matters - the diagnosis is partial - it's actually a WSL on win11Pro :P
Used Package Manager
npm
Validations