mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-16 13:44:44 +00:00
test: make process cwd check cross-platform (#16594)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
import { Process } from "../../src/util/process"
|
import { Process } from "../../src/util/process"
|
||||||
|
import { tmpdir } from "../fixture/fixture"
|
||||||
|
|
||||||
function node(script: string) {
|
function node(script: string) {
|
||||||
return [process.execPath, "-e", script]
|
return [process.execPath, "-e", script]
|
||||||
@@ -58,10 +59,11 @@ describe("util.process", () => {
|
|||||||
}, 3000)
|
}, 3000)
|
||||||
|
|
||||||
test("uses cwd when spawning commands", async () => {
|
test("uses cwd when spawning commands", async () => {
|
||||||
|
await using tmp = await tmpdir()
|
||||||
const out = await Process.run(node("process.stdout.write(process.cwd())"), {
|
const out = await Process.run(node("process.stdout.write(process.cwd())"), {
|
||||||
cwd: "/tmp",
|
cwd: tmp.path,
|
||||||
})
|
})
|
||||||
expect(out.stdout.toString()).toBe("/tmp")
|
expect(out.stdout.toString()).toBe(tmp.path)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("merges environment overrides", async () => {
|
test("merges environment overrides", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user