fixture.ts 527 B

12345678910111213141516
  1. import { mkdtemp, realpath, rm } from "node:fs/promises"
  2. import path from "node:path"
  3. import os from "node:os"
  4. import type { ThemeSource } from "../../src/context/theme"
  5. export const emptyThemeSource: ThemeSource = { discover: () => Promise.resolve({}) }
  6. export async function tmpdir() {
  7. const directory = await realpath(await mkdtemp(path.join(os.tmpdir(), "opencode-tui-test-")))
  8. return {
  9. path: directory,
  10. async [Symbol.asyncDispose]() {
  11. await rm(directory, { recursive: true, force: true })
  12. },
  13. }
  14. }