source-coupled-test
Disallow raw repository source text as a test oracle; parse or execute the artifact instead.
Why
Substring and regex checks can pass on comments or unreachable configuration and fail after behavior-preserving formatting changes.
Fix
Reuse adequate existing validation; otherwise assert a distinct parsed or runtime contract. Preserve deliberate representation contracts with an exact justified suppression.
Examples
import { readFileSync } from "node:fs";test("policy", () => { const source = readFileSync("workflow.yml", "utf8"); expect(source).toMatch(/permissions/);});import { readFileSync } from "node:fs";test("policy", () => { const policy = JSON.parse(readFileSync("policy.json", "utf8")); expect(validate(policy)).toEqual([]);});