Files
openclaw/test/scripts/oxlint-boundary-guards.test.ts
Sash Zats ff95d0c269 improve(ci): replace boundary guards with focused Oxlint rules (#95368)
* perf(ci): move boundary guards to oxlint

Co-authored-by: Sash Zats <sash@zats.io>

* fix(ci): avoid dead editor URL export

Co-authored-by: Sash Zats <sash@zats.io>

* fix(ci): declare path-loaded boundary guard roots

Co-authored-by: Sash Zats <sash@zats.io>

* fix(ci): model Oxlint plugin export in Knip

Co-authored-by: Sash Zats <sash@zats.io>

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-17 11:37:35 +01:00

42 lines
1.1 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { describe, expect, it } from "vitest";
const FIXTURES = "test/fixtures/oxlint-boundary-guards";
const cases = [
{
rule: "openclaw-boundaries/no-register-http-handler-call",
violation: `${FIXTURES}/register-http-handler-violation.ts`,
violations: 3,
},
{
rule: "openclaw-boundaries/no-raw-window-open-call",
violation: `${FIXTURES}/raw-window-open-violation.ts`,
violations: 5,
},
];
function runGuard(target: string) {
return spawnSync(
process.execPath,
[
"scripts/run-oxlint.mjs",
"--openclaw-focused-config",
"--config",
"config/oxlint/boundary-guards.json",
target,
],
{ encoding: "utf8" },
);
}
describe("oxlint boundary guards", () => {
it.each(cases)("matches legacy call-only semantics for $rule", (testCase) => {
const violation = runGuard(testCase.violation);
const output = `${violation.stdout}${violation.stderr}`;
expect(violation.status).toBe(1);
expect(output.split(`${testCase.rule.replace("/", "(")})`)).toHaveLength(
testCase.violations + 1,
);
});
});