Files
fusion/packages/cli/src/__tests__/version.test.ts
gsxdsm bc56ab287e fix: align tests with recent source changes on main
Fix 6 failing tests caused by intentional source changes that landed
without updating dependent test assertions:

- Core test-project: taskPrefix default changed from "FN" to undefined
  (commit 800f845e1, derived from project name at runtime)
- Dashboard ScriptsModal.css: replace banned --text-primary with --text
- CLI package-config: update expected pi dep version ^0.79.1 -> ^0.79.9
- CLI skill-sync: document 4 new engine tools in engine-tools.md
- CLI version: update expected release:version script to include
  run-ci-distill.mjs
- CLI bundled-plugin-freshness: rebuild stale dist directories
2026-06-25 00:13:29 -07:00

63 lines
2.8 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { readFileSync, existsSync } from "node:fs";
import { join } from "node:path";
const repoRoot = join(import.meta.dirname!, "..", "..", "..", "..");
describe("Changeset configuration", () => {
// Release guardrail: These tests protect the @runfusion/fusion release pipeline
// by ensuring changeset configuration required for npm publishing remains intact.
// If these tests fail, the automated release workflow will break.
it("should have a valid .changeset/config.json", () => {
const configPath = join(repoRoot, ".changeset", "config.json");
expect(existsSync(configPath)).toBe(true);
const config = JSON.parse(readFileSync(configPath, "utf-8"));
expect(config).toBeDefined();
expect(typeof config).toBe("object");
});
it("should have baseBranch set to 'main' for the default branch", () => {
const configPath = join(repoRoot, ".changeset", "config.json");
const config = JSON.parse(readFileSync(configPath, "utf-8"));
expect(config.baseBranch).toBe("main");
});
it("should have changeset scripts in root package.json", () => {
// These scripts drive the changesets CLI workflow: changeset (add), version (bump), release:version (apply + sync workspace version)
const pkgPath = join(repoRoot, "package.json");
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
expect(pkg.scripts.changeset).toBe("changeset");
expect(pkg.scripts.version).toBe("changeset version");
// FNXC:ReleasePipeline 2026-06-24-23:50: release:version now includes run-ci-distill.mjs to distill changelog entries after version bump.
expect(pkg.scripts["release:version"]).toBe("changeset version && node scripts/sync-workspace-version.mjs && node scripts/run-ci-distill.mjs");
});
it("should keep the workspace package.json version aligned with the published CLI package", () => {
const workspacePkgPath = join(repoRoot, "package.json");
const cliPkgPath = join(repoRoot, "packages", "cli", "package.json");
const workspacePkg = JSON.parse(readFileSync(workspacePkgPath, "utf-8"));
const cliPkg = JSON.parse(readFileSync(cliPkgPath, "utf-8"));
expect(workspacePkg.version).toBe(cliPkg.version);
});
it("should have .github/workflows/version.yml configured for manual releases", () => {
const workflowPath = join(
repoRoot,
".github",
"workflows",
"version.yml",
);
expect(existsSync(workflowPath)).toBe(true);
const content = readFileSync(workflowPath, "utf-8");
// Guardrail: workflow must use changesets/action for npm publishing
expect(content).toContain("changesets/action");
// Guardrail: workflow must be manually triggered (auto-trigger disabled for safety)
expect(content).toContain("workflow_dispatch");
expect(content).toContain("Auto-trigger disabled");
});
});