#!/usr/bin/env bash # Failing-test NAME set for a node:test suite, via the stable TAP reporter (locale-independent). # Extracted from 99-dryrun.sh's inline capture_fails (mirrors the sc2-regression.sh extraction, 5d112cb) so # the SAME capture feeds BOTH the dry-run rehearsal (99-dryrun.sh) and the live operator-window gate # (41-validate-or-regression.sh) — a single source of truth prevents the gate and the rehearsal from # disagreeing on what "failing" means (the exact class of drift that let the strict window STOP on red the # dry-run had blessed). # # Prints sorted-unique failing test names, one per line. Empty output = the suite reported no `not ok` lines. # The caller distinguishes "ran clean" from "did not run": sc2-regression.sh treats a missing capture FILE # as a hard error, but an empty-yet-present file is a legitimate zero-failure set. No pipefail: a no-match # grep (zero failures) must exit 0, not leak a spurious non-zero up to the caller. # # Usage: capture-fails.sh set -u dir="${1:?dir}" cmd="${2:?node --test command}" tapcmd="${cmd/node --test/node --test --test-reporter=tap}" ( cd "$dir" && eval "$tapcmd" ) 2>&1 \ | grep -E '^not ok ' | sed -E 's/^not ok [0-9]+ - //; s/ #.*$//' | sort -u