| 1 | import assert from "node:assert/strict" |
| 2 | import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs" |
| 3 | import { tmpdir } from "node:os" |
| 4 | import { dirname, join } from "node:path" |
| 5 | import { describe, it } from "node:test" |
| 6 | import { materializeFixture } from "../materialize.mts" |
| 7 | |
| 8 | describe("runtimeperf fixture materialization", () => { |
| 9 | it("preserves relative fixture dependencies", () => { |
| 10 | const root = mkdtempSync(join(tmpdir(), "effect-runtimeperf-materialize-")) |
| 11 | try { |
| 12 | const fixturePath = join(root, "fixtures", "fixture.mts") |
| 13 | mkdirSync(dirname(fixturePath), { recursive: true }) |
| 14 | writeFileSync(join(dirname(fixturePath), "data.mts"), "export const value = 1\n") |
| 15 | writeFileSync(fixturePath, 'import { value } from "./data.mts"\nexport { value }\n') |
| 16 | |
| 17 | const materialized = materializeFixture(join(root, "target"), { fixturePath }) |
| 18 | |
| 19 | assert.equal(existsSync(join(dirname(materialized), "data.mts")), true) |
| 20 | } finally { |
| 21 | rmSync(root, { recursive: true, force: true }) |
| 22 | } |
| 23 | }) |
| 24 | }) |