Skip to content

installWarningsAsErrors

Registers a process 'warning' listener that turns every Node warning into a test failure.

Idempotent: calling it more than once (e.g. from several setup files sharing one worker) registers the listener at most once, so it does not itself trigger a MaxListenersExceededWarning. The check is by marker rather than by function identity, so it holds across module realms as well — under a VM-backed pool each test file evaluates this module separately and an identity check would miss.

Import:

import { installWarningsAsErrors } from '@mnaoumov/typescript-test-toolkit/warnings-as-errors';

Signature:

function installWarningsAsErrors(): void

Returns: void