bombs 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/index.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# bombs
|
|
2
|
+
|
|
3
|
+
Schedule deterministic runtime faults and timed assertions to test error handling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Plant timed faults (exceptions, promise rejections, process exits) to exercise error paths
|
|
8
|
+
- Deterministic scheduling with optional seed for reproducible faults
|
|
9
|
+
- Context-aware injection for async flows to surface race conditions and timeouts
|
|
10
|
+
- Simple integration hooks for test runners (Mocha, Jest, AVA) and CI
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
npm install bombs
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
const bombs = require('bombs');
|
|
20
|
+
|
|
21
|
+
// Create a bombs controller with an optional seed for reproducibility
|
|
22
|
+
const controller = bombs.create({ seed: 42 });
|
|
23
|
+
|
|
24
|
+
// Plant a bomb to throw an exception after 100ms
|
|
25
|
+
controller.plant(100, { type: 'exception', message: 'simulated-fault' });
|
|
26
|
+
|
|
27
|
+
// In a test, run your code; the injected fault will trigger during execution
|
|
28
|
+
// Example with async handler
|
|
29
|
+
await myAsyncHandler();
|
|
30
|
+
|
|
31
|
+
// Clear any remaining bombs (useful in afterEach hooks)
|
|
32
|
+
controller.clear();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// bombs
|
|
1
|
+
// bombs — Schedule deterministic runtime faults and timed assertions to test error handling.
|
|
2
2
|
module.exports = {};
|
package/package.json
CHANGED