Initial commit
This commit is contained in:
16
tests/test-helpers.mjs
Normal file
16
tests/test-helpers.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createServer } from "vite";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
export const root = resolve(new URL("..", import.meta.url).pathname);
|
||||
export async function loadModule(path) {
|
||||
const vite = await createServer({
|
||||
root,
|
||||
logLevel: "error",
|
||||
resolve: { alias: { "~": resolve(root, "app") } },
|
||||
});
|
||||
try {
|
||||
return await vite.ssrLoadModule(`/${path}`);
|
||||
} finally {
|
||||
await vite.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user