Run the shipped resolver in Windows PowerShell against the stand-in (async: the stand-in runs here).
(pinned: string)
| 75 | |
| 76 | /** Run the shipped resolver in Windows PowerShell against the stand-in (async: the stand-in runs here). */ |
| 77 | function resolveVersion(pinned: string): Promise<{ code: number; stdout: string; stderr: string }> { |
| 78 | const script = [ |
| 79 | "$ErrorActionPreference = 'Stop'", |
| 80 | "$ProgressPreference = 'SilentlyContinue'", |
| 81 | extractResolver(), |
| 82 | `Resolve-CodeGraphVersion ${psq(pinned)} ${psq(REPO)} ${psq(base)} ${psq(base)}`, |
| 83 | ].join('\n'); |
| 84 | const encoded = Buffer.from(script, 'utf16le').toString('base64'); |
| 85 | return new Promise((resolve) => { |
| 86 | execFile( |
| 87 | 'powershell.exe', |
| 88 | ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', encoded], |
| 89 | { windowsHide: true, timeout: 60_000 }, |
| 90 | (err, stdout, stderr) => { |
| 91 | const code = err ? (typeof err.code === 'number' ? err.code : 1) : 0; |
| 92 | resolve({ code, stdout: stdout.trim(), stderr }); |
| 93 | }, |
| 94 | ); |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | it('reads the latest release from the redirect: one HEAD, not followed, no API call', async () => { |
| 99 | const r = await resolveVersion(''); |
no test coverage detected