getting stderr through vitest

last updated: Jun 18, 2024

vitest (which is otherwise quite good) clobbers stderr, and its developers do not seem to understand how stderr works so it's not considered a problem.

This can cause problems in development where your code is writing errors out to stderr, but vitest is hiding them from you.

If you want to see stderr output, the best you can do is use the dot reporter, which unfortunately can still overwrite your stream, or tap which will buffer all output but doesn't seem to overwrite your output.

vitest run test/something.ts --reporter=dot

Alternately, you can force everything to use stdout, but that can be quite painful.

↑ up