Skip to content

Build and test cycle

Terminal window
npm install # @embabel/runtime-types from git, typescript, vitest
npm run typecheck # tsc --noEmit
npm test # vitest run — mockGateway against your handlers
npm run build # tsc → dist/*.js (CommonJS) + manifest.json

mockGateway<WorldTools> lets you write hermetic tests in pure Node:

import { mockGateway } from "@embabel/runtime-types";
import type { WorldTools } from "../.embabel/gateway";
import { getOutline } from "../src/api/docs-editor";
it("extracts headings", async () => {
const gateway = mockGateway<WorldTools>({
docs: { documentsGet: vi.fn().mockResolvedValue({ revisionId: "r1", body: { content: [/* … */] } }) },
});
const outline = await getOutline(gateway, { documentId: "abc" });
expect(outline.spans).toHaveLength(2);
});

No host running, no Docker, no live API.