Files
OmniRoute/tests/unit/compression/rtk-render-testgreen.test.ts
Diego Rodrigues de Sa e Souza 7c23dab64d Release v3.8.40
v3.8.40 cycle integration → main. All test gates green (Unit/Integration/Coverage/Node-compat/Quality-Ratchet). The only red check, 'PR Test Policy', is the test-masking heuristic firing on the cumulative ~57-commit release diff (legitimate assert consolidations already reviewed per-PR — Gemini CLI removal #5246, retired GPT models #5280, provider catalog refreshes); overridden with --admin per the documented release-PR convention. CodeQL/SonarQube advisory scans non-blocking; #5278's code already passed CodeQL on main. Homologated on VPS 192.168.0.15 (v3.8.40 healthy).
2026-06-29 08:40:06 -03:00

41 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from "node:test";
import assert from "node:assert/strict";
import { renderTestGreen } from "../../../open-sse/services/compression/engines/rtk/renderers/testGreen.ts";
const det = (t: string) => ({
type: t,
command: "",
confidence: 1,
category: "test",
matchedPatterns: [],
});
test("pytest all-green collapses to summary", () => {
const input = `============ test session starts ============
collected 142 items
tests/a.py ....................
tests/b.py ....................
============ 142 passed in 3.21s ============`;
const r = renderTestGreen(input, det("test-pytest"));
assert.equal(r.changed, true);
assert.ok(r.text.includes("142 passed"));
assert.ok(!r.text.includes("...................."));
});
test("any failure ⇒ no-op (preserve diagnostics)", () => {
const input = `tests/a.py ..F..
=== 1 failed, 4 passed in 1.0s ===
E AssertionError: nope`;
const r = renderTestGreen(input, det("test-pytest"));
assert.equal(r.changed, false);
});
test("ANSI-colored FAIL with no numeric failed-count ⇒ no-op (regression: \\bFAIL\\b defeated by ANSI)", () => {
// jest/vitest emit a colored FAIL header; the ESC[31m byte 'm' before 'F' kills the
// word boundary. With the per-test failed-count line already stripped by an upstream
// filter, the ANSI strip in the guard is the only thing preventing a collapsed failure.
const input = "FAIL src/auth.test.ts\nTests: 3 passed, 3 total";
const r = renderTestGreen(input, det("test-jest"));
assert.equal(r.changed, false);
});