Builder
ChaosConfigBuilder creates readable configs for larger scenarios.
import { ChaosConfigBuilder } from '@chaos-maker/core';
const config = new ChaosConfigBuilder() .failRequests('/api/checkout', 503, 0.5) .addLatency('/api/', 1500, 0.3) .corruptResponses('/api/cart', 'malformed-json', 0.2) .failGraphQLOperation('GetUser', 503, 1, '/graphql') .delaySSE('/events', 500, 1, 'token') .assaultUi('button[type="submit"]', 'disable', 0.1) .build();Builder output is a normal ChaosConfig. You can still add seed at the root:
const config = { ...new ChaosConfigBuilder().failRequests('/api/payments', 503, 1).build(), seed: 42,};Prefer plain objects for small tests and the builder when a scenario spans several chaos primitives.
GraphQL shortcuts default urlPattern to '*' when you omit the fourth argument. SSE shortcuts accept an optional eventType after the probability.