// Tsdown config tests protect package artifact build contracts. import { describe, expect, it } from "vitest"; import config from "../../tsdown.config.ts"; const configs = Array.isArray(config) ? config : [config]; type TsdownConfig = (typeof configs)[number]; type OutExtensions = NonNullable; describe("tsdown config", () => { it("enables declaration output explicitly for package artifact builds", () => { expect(configs).not.toHaveLength(0); expect(configs.map((entry) => entry.dts)).toEqual(configs.map(() => true)); }); it("keeps node package artifacts on the declared js and dts extensions", () => { const nodePackageConfigs = configs.filter((entry) => entry.fixedExtension === false); expect(nodePackageConfigs).not.toHaveLength(0); const context = { format: "es", options: {}, pkgType: "module", } as Parameters[0]; for (const entry of nodePackageConfigs) { expect(entry.outExtensions?.(context)).toEqual({ js: ".js", dts: ".d.ts" }); } }); });