Wraps node's spawn in a Promise.
(...args: Parameters<typeof cp.spawn>)
| 26 | |
| 27 | /** Wraps node's spawn in a Promise. */ |
| 28 | function spawn(...args: Parameters<typeof cp.spawn>): Promise<number> { |
| 29 | const child = cp.spawn(...args); |
| 30 | |
| 31 | return new Promise((resolve, reject) => { |
| 32 | child.on('exit', (code: number) => { |
| 33 | if (code === 0) resolve(0); |
| 34 | else reject(code); |
| 35 | }); |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Promise<number> { |
| 40 | grammarFiles.push(...DUMMY_GRAMMARS); |
no test coverage detected