chore: upgrade bun from 1.3.5 -> 1.3.6, also update types/bun from 1.3.4 -> 1.3.6 and fix type errs (#8499)
Co-authored-by: Github Action <action@github.com>
This commit is contained in:
39
packages/opencode/test/util/filesystem.test.ts
Normal file
39
packages/opencode/test/util/filesystem.test.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import os from "node:os"
|
||||
import path from "node:path"
|
||||
import { mkdtemp, mkdir, rm } from "node:fs/promises"
|
||||
import { Filesystem } from "../../src/util/filesystem"
|
||||
|
||||
describe("util.filesystem", () => {
|
||||
test("exists() is true for files and directories", async () => {
|
||||
const tmp = await mkdtemp(path.join(os.tmpdir(), "opencode-filesystem-"))
|
||||
const dir = path.join(tmp, "dir")
|
||||
const file = path.join(tmp, "file.txt")
|
||||
const missing = path.join(tmp, "missing")
|
||||
|
||||
await mkdir(dir, { recursive: true })
|
||||
await Bun.write(file, "hello")
|
||||
|
||||
const cases = await Promise.all([Filesystem.exists(dir), Filesystem.exists(file), Filesystem.exists(missing)])
|
||||
|
||||
expect(cases).toEqual([true, true, false])
|
||||
|
||||
await rm(tmp, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
test("isDir() is true only for directories", async () => {
|
||||
const tmp = await mkdtemp(path.join(os.tmpdir(), "opencode-filesystem-"))
|
||||
const dir = path.join(tmp, "dir")
|
||||
const file = path.join(tmp, "file.txt")
|
||||
const missing = path.join(tmp, "missing")
|
||||
|
||||
await mkdir(dir, { recursive: true })
|
||||
await Bun.write(file, "hello")
|
||||
|
||||
const cases = await Promise.all([Filesystem.isDir(dir), Filesystem.isDir(file), Filesystem.isDir(missing)])
|
||||
|
||||
expect(cases).toEqual([true, false, false])
|
||||
|
||||
await rm(tmp, { recursive: true, force: true })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user