chore: format everything with oxfmt

This commit is contained in:
Aarnav Tale
2026-04-26 20:33:21 -04:00
parent b961b339bb
commit 5a2098eea5
49 changed files with 1584 additions and 1696 deletions
+26 -26
View File
@@ -1,40 +1,40 @@
import { vi } from 'vitest';
import { vi } from "vitest";
const fakeFs = new Map<string, string>();
export function createFakeFile(path: string, content: string) {
fakeFs.set(path, content);
fakeFs.set(path, content);
}
export function clearFakeFiles() {
fakeFs.clear();
fakeFs.clear();
}
// @ts-expect-error: I have no clue why vitest's types are wrong here
vi.mock(import('node:fs/promises'), async (importOrig) => {
const orig = await importOrig();
return {
...orig,
readFile: (path, options) => {
const p = path.toString();
if (fakeFs.has(p)) {
const content = fakeFs.get(p)!;
if (typeof options === 'string' || options?.encoding) {
return Promise.resolve(content);
}
vi.mock(import("node:fs/promises"), async (importOrig) => {
const orig = await importOrig();
return {
...orig,
readFile: (path, options) => {
const p = path.toString();
if (fakeFs.has(p)) {
const content = fakeFs.get(p)!;
if (typeof options === "string" || options?.encoding) {
return Promise.resolve(content);
}
return Promise.resolve(Buffer.from(content));
}
return Promise.resolve(Buffer.from(content));
}
return orig.readFile.call(this, path, options);
},
return orig.readFile.call(this, path, options);
},
access: (path, mode) => {
const p = path.toString();
if (fakeFs.has(p)) {
return Promise.resolve();
}
access: (path, mode) => {
const p = path.toString();
if (fakeFs.has(p)) {
return Promise.resolve();
}
return orig.access.call(this, path, mode);
},
};
return orig.access.call(this, path, mode);
},
};
});