|
1 | 1 | import { spawn } from "child_process" |
2 | 2 | import type { ChildProcessWithoutNullStreams } from "node:child_process" |
| 3 | +import fs from "node:fs" |
3 | 4 | import path from "node:path" |
4 | 5 | import { sleep } from "bun" |
5 | 6 | import { describe, expect, test } from "bun:test" |
@@ -80,11 +81,20 @@ describe("RPCChannel Test", () => { |
80 | 81 | await runWorker(workerDeno) |
81 | 82 | }) |
82 | 83 | test("NodeStdio", async () => { |
83 | | - const workerBun = spawn("node", [path.join(testsPath, "scripts/node-api.js")]) |
| 84 | + const jsScriptPath = path.join(testsPath, "scripts/node-api.js") |
| 85 | + if (!fs.existsSync(jsScriptPath)) { |
| 86 | + await Bun.build({ |
| 87 | + entrypoints: [path.join(testsPath, "scripts/node-api.ts")], |
| 88 | + outdir: path.join(testsPath, "scripts"), |
| 89 | + sourcemap: "inline", |
| 90 | + minify: true |
| 91 | + }) |
| 92 | + } |
| 93 | + const workerBun = spawn("node", [jsScriptPath]) |
| 94 | + await runWorker(workerBun) |
| 95 | + }) |
| 96 | + test("NodeStdio with bun", async () => { |
| 97 | + const workerBun = spawn("bun", [path.join(testsPath, "scripts/node-api.ts")]) |
84 | 98 | await runWorker(workerBun) |
85 | 99 | }) |
86 | | - // test("NodeStdio with bun", async () => { |
87 | | - // const workerBun = spawn("bun", [path.join(testsPath, "scripts/node-api.ts")]) |
88 | | - // await runWorker(workerBun) |
89 | | - // }) |
90 | 100 | }) |
0 commit comments