bombs
v0.1.1
Published
Schedule deterministic runtime faults and timed assertions to test error handling.
Readme
bombs
Schedule deterministic runtime faults and timed assertions to test error handling.
Features
- Plant timed faults (exceptions, promise rejections, process exits) to exercise error paths
- Deterministic scheduling with optional seed for reproducible faults
- Context-aware injection for async flows to surface race conditions and timeouts
- Simple integration hooks for test runners (Mocha, Jest, AVA) and CI
Install
npm install bombs
Quick Start
const bombs = require('bombs');
// Create a bombs controller with an optional seed for reproducibility
const controller = bombs.create({ seed: 42 });
// Plant a bomb to throw an exception after 100ms
controller.plant(100, { type: 'exception', message: 'simulated-fault' });
// In a test, run your code; the injected fault will trigger during execution
// Example with async handler
await myAsyncHandler();
// Clear any remaining bombs (useful in afterEach hooks)
controller.clear();License
MIT
