- Introduced live smoke tests for Edge Gateways, verifying gateway routes and destructive-action prevention. - Added e2e scenarios for deep-link navigation, unavailable gateway recovery, token rotation, and background page refresh. - Refactored test helpers for streamlined functional validation in gateway scenarios. - Updated `EdgeGatewayTerminal.vue` with test IDs for enhanced testability. - Added and configured Husky pre-commit hooks for automated test file formatting and validation.
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import path from "node:path";
|
|
import { spawnSync } from "node:child_process";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = path.resolve(scriptDir, "..");
|
|
const huskyBin = path.join(repoRoot, "node_modules", "husky", "bin.js");
|
|
|
|
function run(command, args, options = {}) {
|
|
const result = spawnSync(command, args, {
|
|
cwd: repoRoot,
|
|
encoding: "utf8",
|
|
...options,
|
|
});
|
|
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
const worktreeResult = run("git", ["rev-parse", "--show-toplevel"]);
|
|
|
|
if (worktreeResult.status !== 0) {
|
|
console.log("Skipping Husky install because front-end-vue is not attached to a Git worktree.");
|
|
process.exit(0);
|
|
}
|
|
|
|
const gitRoot = path.resolve(worktreeResult.stdout.trim());
|
|
|
|
if (gitRoot !== repoRoot) {
|
|
console.log(`Skipping Husky install because Git root is ${gitRoot}, not ${repoRoot}.`);
|
|
process.exit(0);
|
|
}
|
|
|
|
const huskyResult = run(process.execPath, [huskyBin], { stdio: "inherit" });
|
|
process.exit(huskyResult.status ?? 1);
|