(
exitCodeValue: number | string,
expectedCode: number
)
| 162 | |
| 163 | it("should have a process exitCode", async () => { |
| 164 | const testExitCode = async ( |
| 165 | exitCodeValue: number | string, |
| 166 | expectedCode: number |
| 167 | ) => { |
| 168 | const proc = spawn(process.argv0, [ |
| 169 | "-e", |
| 170 | `process.exitCode = ${exitCodeValue}`, |
| 171 | ]); |
| 172 | await new Promise<void>((resolve) => { |
| 173 | proc.on("exit", (code) => { |
| 174 | expect(code).toEqual(expectedCode); |
| 175 | resolve(); |
| 176 | }); |
| 177 | }); |
| 178 | }; |
| 179 | |
| 180 | await testExitCode(241212341, 181); |
| 181 | await testExitCode(-1, 255); |
no test coverage detected