Captures writes to stdout and stderr, including console warnings intercepted by Vitest.
Call restore in a finally block. This replaces process globals and must not be used in concurrent tests.
Prefer withCapturedStandardStreams, which also disables unit-test output suppression while it runs.
Returns StandardStreamsMock
Captured output and a function to restore the original writers.
Captures writes to stdout and stderr, including console warnings intercepted by Vitest. Call restore in a finally block. This replaces process globals and must not be used in concurrent tests. Prefer withCapturedStandardStreams, which also disables unit-test output suppression while it runs.