From 0deb5594d5855896f829784430aa87f1301ce153 Mon Sep 17 00:00:00 2001 From: bastien Date: Mon, 28 Sep 2026 16:57:47 +0200 Subject: [PATCH] fix(floor-guard): word-bound the bare Jasmine skip patterns skip_kind matched SKIP_SUBSTRINGS as plain substrings, so 'xit(' hit exit(, SystemExit( and process.exit(, and 'fit(' hit model.fit( and profit(, flagging FLOOR SKIP on ordinary test-file lines (BLK-023). The four bare identifiers (xit, fit, xdescribe, fdescribe) now match through SKIP_IDENT_RE with an identifier-boundary lookbehind; the dotted and decorator forms stay substrings. Flip-test fixtures cover the false positive (RED before, GREEN after) and the three focus/skip calls. --- lib/floor-guard.sh | 14 +++++++++++--- lib/tests/floor-guard.test.sh | 31 +++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/lib/floor-guard.sh b/lib/floor-guard.sh index a573fe0..6a35df9 100755 --- a/lib/floor-guard.sh +++ b/lib/floor-guard.sh @@ -97,9 +97,15 @@ SUPPRESS_SUBSTRINGS = ( TS_EXPECT_ERROR = '@ts-expect-error' # floor-guard: allow pattern table SKIP_SUBSTRINGS = ( - '.skip(', '.only(', 'xit(', 'xdescribe(', 'fit(', 'fdescribe(', - 'it.todo(', '@pytest.mark.skip', '@unittest.skip', 't.Skip(', + '.skip(', '.only(', 'it.todo(', '@pytest.mark.skip', '@unittest.skip', + 't.Skip(', ) +# bare Jasmine/Jest focus-or-skip calls (xit/fit/xdescribe/fdescribe); the +# lookbehind keeps `exit(`, `SystemExit(`, `model.fit(` out (BLK-023). +SKIP_IDENT_RE = re.compile(r'(? {});" >> "$d/sample.test.js" out=$(cd "$d" && bash "$LIB" "$base" 2>&1); rc=$? check_kind SKIP "$rc" 2 "$out" 'FLOOR SKIP' +# ── SKIP_EXIT_CLEAN ─────────────────────────────────────────────────────── +d=$(mk_repo skipexit); base=$(git -C "$d" rev-parse HEAD) +{ + echo 'process.exit(1); // sys.exit(1)' # floor-guard: allow flip-test fixture + echo 'model.fit(x);' # floor-guard: allow flip-test fixture + echo 'const p = profit(1);' # floor-guard: allow flip-test fixture +} >> "$d/sample.test.js" +out=$(cd "$d" && bash "$LIB" "$base" 2>&1); rc=$? +check_kind SKIP_EXIT_CLEAN "$rc" 0 "$out" 'FLOOR GUARD: clean' + +# ── SKIP_XIT_FLAGS / SKIP_FIT_FLAGS / SKIP_FDESCRIBE_FLAGS ──────────────── +d=$(mk_repo skipxit); base=$(git -C "$d" rev-parse HEAD) +echo " xit('skipped', () => {});" >> "$d/sample.test.js" # floor-guard: allow flip-test fixture +out=$(cd "$d" && bash "$LIB" "$base" 2>&1); rc=$? +check_kind SKIP_XIT_FLAGS "$rc" 2 "$out" 'FLOOR SKIP' + +d=$(mk_repo skipfit); base=$(git -C "$d" rev-parse HEAD) +echo "fit('focused', () => {});" >> "$d/sample.test.js" # floor-guard: allow flip-test fixture +out=$(cd "$d" && bash "$LIB" "$base" 2>&1); rc=$? +check_kind SKIP_FIT_FLAGS "$rc" 2 "$out" 'FLOOR SKIP' + +d=$(mk_repo skipfdescribe); base=$(git -C "$d" rev-parse HEAD) +echo "fdescribe('focused', () => {});" >> "$d/sample.test.js" # floor-guard: allow flip-test fixture +out=$(cd "$d" && bash "$LIB" "$base" 2>&1); rc=$? +check_kind SKIP_FDESCRIBE_FLAGS "$rc" 2 "$out" 'FLOOR SKIP' + # ── DELETED_TEST ────────────────────────────────────────────────────────── d=$(mk_repo deleted); base=$(git -C "$d" rev-parse HEAD) rm "$d/sample.test.js"