@vyriy/chaos
v0.4.1
Published
Random failure injection utility for Vyriy projects
Readme
@vyriy/chaos
Random failure helper for local Vyriy development.
Purpose
This package injects development-only failures so callers can exercise error and timeout handling paths before real backend instability happens.
Install
With npm:
npm install @vyriy/chaosWith Yarn:
yarn add @vyriy/chaosUsage
import { chaos } from '@vyriy/chaos';
await chaos({
enabled: process.env.CHAOS_ENABLED === 'true',
probability: 0.2,
strategy: 'random',
timeoutMs: 1500,
});API
chaos(options)resolves when no fault should be injected.chaos(options)throws anErroror waits and throws a timeout when the random check matches.defaultMessageis the default non-timeout error message.defaultProbabilityis the default failure probability.defaultTimeoutMsis the default timeout duration in milliseconds.
