|
1 | 1 | import { execFile, spawnSync } from "node:child_process"; |
2 | | -import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; |
| 2 | +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; |
3 | 3 | import { createServer, request as forwardRequest, type Server } from "node:http"; |
4 | 4 | import { createConnection, type AddressInfo, type Socket } from "node:net"; |
5 | 5 | import { tmpdir } from "node:os"; |
@@ -142,7 +142,12 @@ describe("core HTTP across Node, native Bun and compiled binaries", () => { |
142 | 142 | proxyUrl = `http://127.0.0.1:${(proxy.address() as AddressInfo).port}`; |
143 | 143 | probeDirectory = mkdtempSync(join(tmpdir(), "bl-native-http-")); |
144 | 144 | scriptPath = join(probeDirectory, "probe.mts"); |
145 | | - binaryPath = join(probeDirectory, process.platform === "win32" ? "probe.exe" : "probe"); |
| 145 | + // Keep the executable at a stable path for local security approvals. |
| 146 | + binaryPath = join( |
| 147 | + repositoryRoot, |
| 148 | + "test/native-http-probe", |
| 149 | + process.platform === "win32" ? "probe.exe" : "probe", |
| 150 | + ); |
146 | 151 | writeFileSync( |
147 | 152 | scriptPath, |
148 | 153 | ` |
@@ -218,6 +223,7 @@ try { |
218 | 223 | )("%s", (runtime) => { |
219 | 224 | beforeAll(async () => { |
220 | 225 | if (runtime !== "binary") return; |
| 226 | + mkdirSync(dirname(binaryPath), { recursive: true }); |
221 | 227 | const target = `bun-${process.platform === "win32" ? "windows" : process.platform}-${process.arch}`; |
222 | 228 | await execFileAsync( |
223 | 229 | bun, |
|
0 commit comments