Build a stub deps bag; records `execFileText` invocations in `calls`.
(opts: StubOpts)
| 42 | |
| 43 | /** Build a stub deps bag; records `execFileText` invocations in `calls`. */ |
| 44 | function stubDeps(opts: StubOpts): { deps: LoginShellPathDeps; calls: unknown[][] } { |
| 45 | const calls: unknown[][] = []; |
| 46 | return { |
| 47 | calls, |
| 48 | deps: { |
| 49 | platform: opts.platform ?? 'darwin', |
| 50 | env: opts.env ?? { SHELL: '/bin/zsh' }, |
| 51 | userShell: () => opts.userShell, |
| 52 | execFileText: |
| 53 | opts.execFileText ?? |
| 54 | (async (file, args, timeoutMs) => { |
| 55 | calls.push([file, args, timeoutMs]); |
| 56 | return opts.execFileResult; |
| 57 | }), |
| 58 | }, |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | describe('probeLoginShellPath', () => { |
| 63 | it('runs $SHELL -l -c /usr/bin/env and returns its PATH', async () => { |
no test coverage detected