Skip to content

Config Reference

interface ChaosConfig {
network?: NetworkConfig;
ui?: UiConfig;
websocket?: WebSocketConfig;
sse?: SSEConfig;
seed?: number;
}

seed controls probability-driven chaos decisions. The same seed plus the same interaction sequence produces the same normalized event sequence.

interface NetworkConfig {
failures?: NetworkFailureConfig[];
latencies?: NetworkLatencyConfig[];
aborts?: NetworkAbortConfig[];
corruptions?: NetworkCorruptionConfig[];
cors?: NetworkCorsConfig[];
}

Each network rule supports urlPattern, optional methods, probability, optional request counting, and optional GraphQL operation matching.

interface RequestCountingOptions {
onNth?: number;
everyNth?: number;
afterN?: number;
}
interface NetworkRuleMatchers {
urlPattern: string;
methods?: string[];
graphqlOperation?: string | RegExp;
}

graphqlOperation is an additional matcher. It matches an operationName field, a named query / mutation / subscription, or a persisted-query GET parameter. Anonymous operations do not match a non-null matcher. If a request body cannot be parsed for GraphQL operation detection (for example multipart, streaming, or XHR Blob bodies), Chaos Maker emits a diagnostic event with reason: 'graphql-body-unparseable' and applied: false.

interface UiConfig {
assaults?: UiAssaultConfig[];
}
interface UiAssaultConfig {
selector: string;
action: 'disable' | 'hide' | 'remove';
probability: number;
}
interface WebSocketConfig {
drops?: WebSocketDropConfig[];
delays?: WebSocketDelayConfig[];
corruptions?: WebSocketCorruptConfig[];
closes?: WebSocketCloseConfig[];
}
type WebSocketDirection = 'inbound' | 'outbound' | 'both';
type WebSocketCorruptionStrategy = 'truncate' | 'malformed-json' | 'empty' | 'wrong-type';
interface SSEConfig {
drops?: SSEDropConfig[];
delays?: SSEDelayConfig[];
corruptions?: SSECorruptConfig[];
closes?: SSECloseConfig[];
}
type SSEEventTypeMatcher = string | '*';
type SSECorruptionStrategy = 'truncate' | 'malformed-json' | 'empty' | 'wrong-type';

Drop, delay, and corruption rules accept optional eventType. The default is message; use a named event like token or the '*' wildcard for all data events.

interface ChaosEvent {
type: ChaosEventType;
timestamp: number;
applied: boolean;
detail: Record<string, unknown>;
}

Use applied to distinguish “matched and rolled false” from “chaos actually changed browser behavior”. sse:drop, sse:delay, and sse:corrupt events include detail.eventType; sse:close includes detail.reason instead. GraphQL-aware network events include detail.operationName when one was identified.