UNPKG

plugify-plugins-types-generator

Version:

tool to generate d.ts for plugify plugins by pplugin file (ESM)

27 lines (26 loc) 964 B
import { describe, it, expect, afterAll } from "vitest"; import { existsSync, mkdirSync, readFileSync, rmSync } from "fs"; import { usePlugifyParser } from "../index.js"; const plugifyPlugins = [ "polyhook", "s2sdk", ]; afterAll(() => { rmSync("./test/dts", { recursive: true }); }); describe("Plugify DTS Generator", () => { for (const plugin of plugifyPlugins) { it(`${plugin} shapshot match`, () => { expect(usePlugifyParser(`./test/${plugin}.pplugin`, undefined, false)) .toBe(readFileSync(`./test/__snapshots__/plugify-${plugin}.d.ts`, "utf8")); }); } for (const plugin of plugifyPlugins) { it(`Create ${plugin}.d.ts file`, () => { const dtsFolder = "./test/dts/"; mkdirSync(dtsFolder, { recursive: true }); usePlugifyParser(`./test/${plugin}.pplugin`, dtsFolder, true); expect(existsSync(dtsFolder)).toBe(true); }); } });