Files
OmniRoute/tests/unit/build/check-complexity.test.ts
Diego Rodrigues de Sa e Souza ad4338449c fix(quality): complexity gate covers bin/+electron + tracked-artifacts in pre-commit (#4318)
* fix(quality): complexity gate varre bin/ + electron (6A.11, fake-green fix)

ESLINT_ARGS passava só 'src open-sse', mas o config eslint.complexity.config.mjs
e o complexity-baseline.json já documentavam o escopo src+open-sse+electron+bin.
A edição do scan nunca tinha sido aplicada: o gate alegava cobrir bin/electron e
nunca os varria (fake-green — uma god-function nova em bin/ passava verde).

- exporta ESLINT_ARGS + adiciona 'electron' e 'bin' (casa o config)
- teste de build trava o escopo do scan
- baseline 1887->1888: electron+bin medem 0 (widening 0-custo); o +1 é drift
  pré-existente de src/open-sse da base a23d0d678 (#4308 et al.), não do widening

* fix(quality): check:tracked-artifacts no pre-commit (6A.12)

O gate estava no CI + pre-push, mas faltava no pre-commit — e o incidente do
symlink (artefato de build trackeado) acontece no 'git add'. Fecha o buraco no
ponto mais cedo.
2026-06-19 21:34:59 -03:00

23 lines
1.2 KiB
TypeScript

// tests/unit/build/check-complexity.test.ts
// TDD test for check-complexity.mjs: the complexity ratchet must scan the SAME first-party
// scope documented in eslint.complexity.config.mjs `files` and in complexity-baseline.json
// (src + open-sse + electron + bin). Task 6A.11 re-baselined the count claiming bin/electron
// coverage, but ESLINT_ARGS only passed src+open-sse — a fake-green gap (a god-function added
// under bin/ would pass the gate unseen). This test locks the scan scope to the documented one.
import test from "node:test";
import assert from "node:assert/strict";
import { ESLINT_ARGS } from "../../../scripts/check/check-complexity.mjs";
test("check-complexity scans the full documented scope (src, open-sse, electron, bin)", () => {
assert.ok(
ESLINT_ARGS.includes("bin"),
"ESLINT_ARGS must include 'bin' — a new god-function under bin/ must not pass the gate green",
);
assert.ok(
ESLINT_ARGS.includes("electron"),
"ESLINT_ARGS must include 'electron' to match eslint.complexity.config.mjs `files` and the baseline scope",
);
assert.ok(ESLINT_ARGS.includes("src"), "ESLINT_ARGS must include 'src'");
assert.ok(ESLINT_ARGS.includes("open-sse"), "ESLINT_ARGS must include 'open-sse'");
});