mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-24 06:14:01 +08:00
- Enforce oxlint and oxfmt for owned JavaScript and TypeScript with independent CI checks. - Preserve compiler import boundaries and protected fixtures while cleaning up lint findings. - Standardize source formatting and validate import, fixture, and embedded-source protections.
32 lines
950 B
TypeScript
32 lines
950 B
TypeScript
import { expect, test } from "vitest";
|
|
import { wasiGuestPath } from "../src/wasi-paths.js";
|
|
|
|
test("WASI guest paths follow the cwd and temp preopens", () => {
|
|
expect(wasiGuestPath("/work/repo/tests/main.cjs", "/work/repo", "/host/tmp", "posix")).toBe(
|
|
"/tests/main.cjs",
|
|
);
|
|
expect(wasiGuestPath("/host/tmp/build/main.cjs", "/work/repo", "/host/tmp", "posix")).toBe(
|
|
"/tmp/build/main.cjs",
|
|
);
|
|
expect(wasiGuestPath("/opt/source/main.cjs", "/work/repo", "/host/tmp", "posix")).toBeNull();
|
|
});
|
|
|
|
test("WASI guest paths normalize Windows host separators", () => {
|
|
expect(
|
|
wasiGuestPath(
|
|
"C:\\work\\repo\\tests\\main.cjs",
|
|
"C:\\work\\repo",
|
|
"C:\\Users\\runner\\Temp",
|
|
"win32",
|
|
),
|
|
).toBe("/tests/main.cjs");
|
|
expect(
|
|
wasiGuestPath(
|
|
"C:\\Users\\runner\\Temp\\build\\main.cjs",
|
|
"C:\\work\\repo",
|
|
"C:\\Users\\runner\\Temp",
|
|
"win32",
|
|
),
|
|
).toBe("/tmp/build/main.cjs");
|
|
});
|