Files
houseplan-card/scripts/backend-test-guard.mjs
Codexandclaude[bot] 51beeeb2c4 ci: mutant selection sees wrapper defaults, guard imports, fixtures and registry edits
guardInputs() replaces guardFiles() in selection and fingerprints: the
files named in the guard, the GUARD_INPUTS a wrapper declares (read
statically — the wrappers run on import), and the closure of imports and
path literals of every guard file, stopping at src/** which stays the
patch side. A diff that touches the registry itself selects every added or
changed definition against the base registry read from git. Five mutants
guard the manifest and this selection.

Issue: #492
User-Visible: no
2026-09-08 21:55:07 +00:00

23 lines
972 B
JavaScript

#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
const pattern = process.argv[2];
if (!pattern) {
console.error('usage: node scripts/backend-test-guard.mjs <pytest-k-pattern>');
process.exit(2);
}
/**
* Входы обёртки для отбора мутантов (#492 §6.1): без третьего аргумента гард
* бежит по этому файлу, и правка файла обязана отбирать таких свидетелей.
* Явно переданный файл попадает в отбор из самой строки гарда.
*/
export const GUARD_INPUTS = ['tests_backend/test_ha_import_export.py'];
const testFile = process.argv[3] || GUARD_INPUTS[0];
const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
const result = spawnSync(python, [
'-m', 'pytest', testFile, '-q', '-k', pattern,
], { stdio: 'inherit' });
process.exit(result.status ?? 2);