"""Run only the affected guarded dossier/Balcao regression; write sanitized test-reporter output.""" import json import subprocess import sys from pathlib import Path root = Path(__file__).resolve().parent.parent out = root / 'storage/app/private/investmoz-v2/portal-audit' command = ['C:/Users/macbook/.config/investmoz/php-8.5.11/php.exe', 'vendor/bin/phpunit'] if '--source-before' in sys.argv: command += ['tests/Feature/PortalServicesTest.php', '--filter', 'service_intake_preserves_same_origin_entry_page'] filename = 'form-entry-source-before-fix-qa.json' else: command += ['tests/Feature/InvestorPathTest.php', 'tests/Feature/PortalServicesTest.php', '--filter', 'InvestorPathTest|service_intake_preserves_same_origin_entry_page'] filename = 'ab-country-final-regression-qa.json' command += ['--no-progress'] result = subprocess.run(command, cwd=root, capture_output=True) receipt = json.loads(result.stdout.decode('utf-8-sig')) (out / filename).write_text(json.dumps(receipt, ensure_ascii=False, indent=2), encoding='utf-8') print(json.dumps({'exit': result.returncode, 'tests': receipt['tests'], 'assertions': receipt['assertions'], 'failures': receipt.get('failures', [])}, ensure_ascii=True)) sys.exit(result.returncode)