Record source and release ownership, keep source line endings consistent, and exclude local build/config backups from version control. Restore default Next type paths, normalize CI checks across line endings, and use portable Playwright and postbuild entry points on Windows/Linux. Align the stale timeout fixture with the existing production timeout policy. Application runtime files remain identical to production-snapshot-48-20261030. Production build and focused regressions passed; pre-existing full-repository lint findings remain documented instead of relaxing lint rules.
61 lines
2.3 KiB
JavaScript
61 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { readFileSync } from "node:fs";
|
|
|
|
const packageJson = JSON.parse(readFileSync("package.json", "utf8"));
|
|
const helpersConfig = readFileSync("playwright.helpers.config.ts", "utf8");
|
|
const testRunner = readFileSync("scripts/run-playwright.mjs", "utf8");
|
|
const violations = [];
|
|
|
|
const expectIncludes = (source, expected, reason) => {
|
|
if (!source.includes(expected)) {
|
|
violations.push(`missing ${reason}: ${expected}`);
|
|
}
|
|
};
|
|
|
|
const expectNotIncludes = (source, forbidden, reason) => {
|
|
if (source.includes(forbidden)) {
|
|
violations.push(`unexpected ${reason}: ${forbidden}`);
|
|
}
|
|
};
|
|
|
|
const testHelpersScript = packageJson.scripts?.["test:helpers"] ?? "";
|
|
const qualityScript = packageJson.scripts?.["check:quality"] ?? "";
|
|
|
|
expectIncludes(testRunner, 'PLAYWRIGHT: "True"', "Playwright test env flag");
|
|
expectIncludes(testHelpersScript, "node --conditions=react-server scripts/run-playwright.mjs", "cross-platform server-only helper runner");
|
|
expectIncludes(testHelpersScript, "--config=playwright.helpers.config.ts", "dedicated helper Playwright config");
|
|
expectIncludes(qualityScript, "pnpm test:helpers", "helper tests in quality gate");
|
|
|
|
expectIncludes(helpersConfig, 'testDir: "./tests"', "tests directory");
|
|
expectIncludes(
|
|
helpersConfig,
|
|
"/routes\\/canvas-chat-helpers\\.test\\.ts/",
|
|
"canvas helper test target"
|
|
);
|
|
expectIncludes(
|
|
helpersConfig,
|
|
"/routes\\/agent-main-ai-template-entry\\.test\\.ts/",
|
|
"agent AI template regression target"
|
|
);
|
|
expectIncludes(
|
|
helpersConfig,
|
|
"/routes\\/canvas-layout-replace-entry\\.test\\.ts/",
|
|
"canvas PSD template regression target"
|
|
);
|
|
expectIncludes(helpersConfig, 'reporter: process.env.CI ? "github" : "list"', "fast non-html reporter");
|
|
expectIncludes(helpersConfig, "timeout: 60 * 1000", "bounded helper test timeout");
|
|
|
|
expectNotIncludes(helpersConfig, "webServer", "Next dev server in helper tests");
|
|
expectNotIncludes(helpersConfig, "devices[", "browser device dependency in helper tests");
|
|
expectNotIncludes(helpersConfig, "projects:", "multi-project helper test expansion");
|
|
expectNotIncludes(helpersConfig, "testMatch: /e2e", "e2e tests in helper gate");
|
|
|
|
if (violations.length > 0) {
|
|
console.error("Test hygiene check failed. Keep helper tests fast, no-server, and wired into check:quality.");
|
|
console.error(violations.join("\n"));
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log("Test hygiene check passed.");
|