MCPcopy Create free account
hub / github.com/awslabs/llrt / testExitCode

Function testExitCode

tests/unit/child_process.test.ts:164–178  ·  view source on GitHub ↗
(
      exitCodeValue: number | string,
      expectedCode: number
    )

Source from the content-addressed store, hash-verified

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);

Callers 1

Calls 3

spawnFunction · 0.85
onMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected