(code: string, env: Record<string, string>)
| 64 | `; |
| 65 | |
| 66 | const spawnScript = (code: string, env: Record<string, string>): ChildOutput => { |
| 67 | const child = spawn(process.execPath, ["-e", code], { |
| 68 | cwd: appRoot, |
| 69 | env: { |
| 70 | ...process.env, |
| 71 | NODE_ENV: "test", |
| 72 | ...env, |
| 73 | }, |
| 74 | stdio: "pipe", |
| 75 | }); |
| 76 | |
| 77 | const output: ChildOutput = { child, stdout: "", stderr: "" }; |
| 78 | child.stdout.setEncoding("utf-8"); |
| 79 | child.stderr.setEncoding("utf-8"); |
| 80 | child.stdout.on("data", (chunk: string) => { |
| 81 | output.stdout += chunk; |
| 82 | }); |
| 83 | child.stderr.on("data", (chunk: string) => { |
| 84 | output.stderr += chunk; |
| 85 | }); |
| 86 | return output; |
| 87 | }; |
| 88 | |
| 89 | const waitForChildClose = async ( |
| 90 | output: ChildOutput, |
no outgoing calls
no test coverage detected