@frost.js/test
v0.1.2
Published
Test utilities for Frost: mock-request handlers, route rendering, loader/action callers
Maintainers
Readme
@frost.js/test
Test utilities for Frost: run the real request pipeline against in-memory route modules — no filesystem, Vite, or browser required.
Install
npm install -D @frost.js/testExample
import { describe, it, expect } from "vitest";
import { createTestHandler, callLoader } from "@frost.js/test";
import { discoverRoutes } from "@frost.js/router";
import * as page from "../src/app/page.js";
const handler = createTestHandler({
routes: await discoverRoutes("src/app"),
modules: { "src/app/page.tsx": page },
});
describe("GET /", () => {
it("returns html", async () => {
const res = await handler(new Request("http://localhost/"));
expect(res.status).toBe(200);
});
});Also exports renderRoute, callAction, and RenderRouteOptions.
