( scriptPath: string, wrapperPath: string, cwd: string, env: NodeJS.ProcessEnv, )
| 30 | } |
| 31 | |
| 32 | function writeEnvLaunchScript( |
| 33 | scriptPath: string, |
| 34 | wrapperPath: string, |
| 35 | cwd: string, |
| 36 | env: NodeJS.ProcessEnv, |
| 37 | ): void { |
| 38 | const exportedVars = Object.entries(env) |
| 39 | .filter(([, value]) => value !== undefined) |
| 40 | .sort(([left], [right]) => left.localeCompare(right)) |
| 41 | .map(([key, value]) => `export ${key}=${shellQuote(String(value))}`) |
| 42 | .join('\n') |
| 43 | |
| 44 | writeFileSync( |
| 45 | scriptPath, |
| 46 | [ |
| 47 | '#!/usr/bin/env bash', |
| 48 | 'set -euo pipefail', |
| 49 | `cd ${shellQuote(cwd)}`, |
| 50 | exportedVars, |
| 51 | `exec ${shellQuote(wrapperPath)}`, |
| 52 | '', |
| 53 | ].join('\n'), |
| 54 | 'utf8', |
| 55 | ) |
| 56 | } |
| 57 | |
| 58 | function createFixture(options: { |
| 59 | readonly prefix: string |
no test coverage detected