feat(tooling): enforce indexed access checks in root tests (#105223)

* feat(tooling): enforce indexed access checks in root tests

* style(tooling): clarify scoped package guard
This commit is contained in:
Peter Steinberger
2026-07-12 10:42:07 +01:00
committed by GitHub
parent 251f54baec
commit e0f45bfbf0
55 changed files with 465 additions and 192 deletions

View File

@@ -58,7 +58,9 @@ function expectDeclaredDispatchInputs(command: string): void {
on?: { workflow_dispatch?: { inputs?: Record<string, unknown> } };
};
const declared = new Set(Object.keys(workflow.on?.workflow_dispatch?.inputs ?? {}));
const emitted = [...command.matchAll(/(?:^|\s)-f\s+([a-z0-9_]+)=/gu)].map((match) => match[1]);
const emitted = [...command.matchAll(/(?:^|\s)-f\s+([a-z0-9_]+)=/gu)].flatMap((match) =>
match[1] === undefined ? [] : [match[1]],
);
expect(emitted.length).toBeGreaterThan(0);
for (const input of emitted) {
expect(declared.has(input), `undeclared workflow_dispatch input: ${input}`).toBe(true);