Skip to content

Commit 2f7b0ae

Browse files
committed
fix: unittest
1 parent f8aa1c5 commit 2f7b0ae

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

deno.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kkrpc/__tests__/stdio-rpc.test.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { spawn } from "child_process"
22
import type { ChildProcessWithoutNullStreams } from "node:child_process"
3+
import fs from "node:fs"
34
import path from "node:path"
45
import { sleep } from "bun"
56
import { describe, expect, test } from "bun:test"
@@ -80,11 +81,20 @@ describe("RPCChannel Test", () => {
8081
await runWorker(workerDeno)
8182
})
8283
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")])
8498
await runWorker(workerBun)
8599
})
86-
// test("NodeStdio with bun", async () => {
87-
// const workerBun = spawn("bun", [path.join(testsPath, "scripts/node-api.ts")])
88-
// await runWorker(workerBun)
89-
// })
90100
})

turbo.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)