1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | exports.default = (code = 0) => ({
|
10 | run() {
|
11 | throw new Error(`Expected hook to exit with code ${code} but it ran without exiting`);
|
12 | },
|
13 | catch(ctx) {
|
14 | const err = ctx.error;
|
15 | if (!err['cli-ux'] || typeof err['cli-ux'].exit !== 'number')
|
16 | throw err;
|
17 | if (err['cli-ux'].exit !== code) {
|
18 | throw new Error(`Expected hook to exit with ${code} but exited with ${err['cli-ux'].exit}`);
|
19 | }
|
20 | }
|
21 | });
|
22 |
|
\ | No newline at end of file |