Polish: npm test runs every test file, two silent failures now log, Loading placeholders shimmer
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d173555398
commit
551f970721
32 files changed
+68
-47
No files matched your search
@@ -0,0 +1,16 @@
|
||||
// Runs every tools/*-test.js (or only the names given), one after another, and lists the ones that fail.
|
||||
// A new test file is picked up automatically; `smoke` and `frontend` run first because they fail fastest.
|
||||
const { spawnSync } = require('child_process');
|
||||
const fs = require('fs'), path = require('path');
|
||||
const FIRST = ['smoke', 'frontend'];
|
||||
const all = fs.readdirSync(__dirname).filter(f => f.endsWith('-test.js')).map(f => f.slice(0, -'-test.js'.length));
|
||||
const want = process.argv.slice(2);
|
||||
const names = (want.length ? want : all).sort((a, b) => (FIRST.indexOf(a) + 1 || 99) - (FIRST.indexOf(b) + 1 || 99) || a.localeCompare(b));
|
||||
const failed = [];
|
||||
for (const n of names) {
|
||||
if (!all.includes(n)) { console.error('No test named ' + n); process.exit(2); }
|
||||
console.log('\n== ' + n);
|
||||
if (spawnSync(process.execPath, [path.join(__dirname, n + '-test.js')], { stdio: 'inherit' }).status !== 0) failed.push(n);
|
||||
}
|
||||
console.log(failed.length ? '\nFAILED: ' + failed.join(', ') : '\nAll ' + names.length + ' test files passed');
|
||||
process.exit(failed.length ? 1 : 0);
|
||||
Reference in new issue
Block a user