test(locale-agents): set process.exitCode so the summary always flushes

Review feedback on #2879. stdout is async when it is a pipe, which is exactly
how tests/run-all.js runs these files, and process.exit() does not wait for
pending writes — so exiting that way can drop the Passed:/Failed: lines the
aggregator totals, defeating the point of printing them. The sibling
tests/ci/ito-*-skill.test.js files already use process.exitCode.

Still exits 1 on drift and 0 when clean.
This commit is contained in:
Nguyen Thanh Dat
2026-08-25 18:35:26 +07:00
parent 5f79c39687
commit 787154775e
+4 -1
View File
@@ -195,7 +195,10 @@ function main() {
console.log(`\n Checked ${localeFiles.length} locale docs against ${canonical.size} agents`);
console.log(` Passed: ${passed}`);
console.log(` Failed: ${failed}`);
if (failed > 0) process.exit(1);
// exitCode, not exit(1): stdout is async when it is a pipe, which is how
// tests/run-all.js runs this, and process.exit() does not wait for pending
// writes — it could drop the two lines above, which the aggregator totals.
if (failed > 0) process.exitCode = 1;
}
main();