mirror of
https://github.com/block/buzz.git
synced 2026-11-01 15:01:12 +00:00
test(e2e): require explicit origin bootstrap
Signed-off-by: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
This commit is contained in:
24
web/scripts/check-e2e-bootstrap.mjs
Normal file
24
web/scripts/check-e2e-bootstrap.mjs
Normal file
@@ -0,0 +1,24 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const projectRoot = path.resolve(import.meta.dirname, "..");
|
||||
const specs = fs
|
||||
.readdirSync(path.join(projectRoot, "tests/e2e"))
|
||||
.filter((name) => /\.(spec|perf)\.ts$/.test(name));
|
||||
const exempt = new Set(["agents-everywhere.live.spec.ts"]);
|
||||
const violations = [];
|
||||
for (const name of specs) {
|
||||
if (exempt.has(name)) continue;
|
||||
const source = fs.readFileSync(
|
||||
path.join(projectRoot, "tests/e2e", name),
|
||||
"utf8",
|
||||
);
|
||||
if (!source.includes('from "../helpers/test"')) continue;
|
||||
if (!/await\s+bootstrapE2ePage\(/.test(source)) violations.push(name);
|
||||
}
|
||||
if (violations.length) {
|
||||
console.error(
|
||||
`E2E specs must register bootstrapE2ePage after their setup:\n${violations.join("\n")}`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user