Skip to content

createCaptureOutput

Generated reference page for the createCaptureOutput function export.

Signatures

ts
function createCaptureOutput(options?: Omit<OutputOptions, "stdout" | "stderr">): [out: Out, captured: CapturedOutput];
ParameterTypeDescription
optionsOmit<OutputOptions, "stdout" | "stderr"> | undefinedOptional OutputOptions (minus stdout/stderr,
which are wired to the capture buffers automatically).

Members

Members

createCaptureOutput

Create an output channel that captures all output into arrays.

Useful in tests to assert on what a handler wrote without touching real I/O.

ts
(options?: Omit<OutputOptions, "stdout" | "stderr">): [out: Out, captured: CapturedOutput];

Examples

ts
const [out, captured] = createCaptureOutput();
out.log('hello');
out.warn('danger');
expect(captured.stdout).toEqual(['hello\n']);
expect(captured.stderr).toEqual(['danger\n']);

See Also

Released under the MIT License.