Files
toolLooper/tests/run-all.js

33 lines
887 B
JavaScript

#!/usr/bin/env node
import { spawn } from 'node:child_process';
import path from 'node:path';
const tests = [
'tests/run-tests.js',
'tests/run-readfile-tests.js',
'tests/run-listfiles-tests.js',
'tests/run-ripgrep-tests.js',
];
function runOne(scriptPath) {
return new Promise((resolve) => {
const abs = path.resolve(process.cwd(), scriptPath);
const child = spawn(process.execPath, [abs], { stdio: 'inherit' });
child.on('close', (code) => resolve({ script: scriptPath, code }));
child.on('error', (err) => resolve({ script: scriptPath, code: 1, error: err }));
});
}
async function main() {
let anyFailed = false;
for (const t of tests) {
const res = await runOne(t);
if (res.code !== 0) anyFailed = true;
}
process.exit(anyFailed ? 1 : 0);
}
main().catch((err) => { console.error('Fatal error in run-all:', err); process.exit(1); });