(numTaps, kind, bailAt)
| 11 | const { AsyncSeriesBailHook } = tapable; |
| 12 | |
| 13 | function makeHook(numTaps, kind, bailAt) { |
| 14 | const hook = new AsyncSeriesBailHook(["a"]); |
| 15 | for (let i = 0; i < numTaps; i++) { |
| 16 | const idx = i; |
| 17 | const name = `plugin-${idx}`; |
| 18 | if (kind === "sync") { |
| 19 | hook.tap(name, (v) => (idx === bailAt ? v : undefined)); |
| 20 | } else { |
| 21 | hook.tapAsync(name, (v, cb) => cb(null, idx === bailAt ? v : undefined)); |
| 22 | } |
| 23 | } |
| 24 | hook.callAsync(1, () => {}); |
| 25 | return hook; |
| 26 | } |
| 27 | |
| 28 | const INNER_ITERATIONS = 200; |
| 29 |