fixture.test.ts 703 B

1234567891011121314151617181920212223242526
  1. import { $ } from "bun"
  2. import { describe, expect, test } from "bun:test"
  3. import fs from "fs/promises"
  4. import { tmpdir } from "./fixture"
  5. describe("tmpdir", () => {
  6. test("disables fsmonitor for git fixtures", async () => {
  7. await using tmp = await tmpdir({ git: true })
  8. const value = (await $`git config core.fsmonitor`.cwd(tmp.path).quiet().text()).trim()
  9. expect(value).toBe("false")
  10. })
  11. test("removes directories on dispose", async () => {
  12. const tmp = await tmpdir({ git: true })
  13. const dir = tmp.path
  14. await tmp[Symbol.asyncDispose]()
  15. const exists = await fs
  16. .stat(dir)
  17. .then(() => true)
  18. .catch(() => false)
  19. expect(exists).toBe(false)
  20. })
  21. })