feat(generators): add core-package entry + dispatch table (empty)
Registers pnpm turbo gen core-package with an empty choices list and a dispatch table that throws for unknown names. Adds vitest config + test script to turbo/generators and adds it to the pnpm workspace so tests run via pnpm --filter @repo/turbo-generators test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
turbo/generators/config.test.ts
Normal file
20
turbo/generators/config.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import type { PlopTypes } from "@turbo/gen";
|
||||
import generator from "./config";
|
||||
|
||||
describe("core-package generator", () => {
|
||||
it("is registered with an empty choices list initially", () => {
|
||||
const captured: Array<{ name: string; def: PlopTypes.PlopGeneratorConfig }> = [];
|
||||
const plopMock = {
|
||||
setHelper: () => {},
|
||||
setGenerator: (name: string, def: PlopTypes.PlopGeneratorConfig) =>
|
||||
captured.push({ name, def }),
|
||||
} as unknown as PlopTypes.NodePlopAPI;
|
||||
generator(plopMock);
|
||||
const corePkg = captured.find((c) => c.name === "core-package");
|
||||
expect(corePkg).toBeDefined();
|
||||
const prompts = corePkg!.def.prompts as Array<{ name: string; choices: unknown[] }>;
|
||||
expect(prompts[0]!.name).toBe("name");
|
||||
expect(prompts[0]!.choices).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user