mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 17:20:24 +00:00
- Create scripts/run-tests.mjs to auto-discover test files, replacing the 900-char inline test command in package.json (P3-1) - Add test:only script for CI to avoid duplicate build+typecheck (P2-1) - Preserve original SyntaxError as cause in responseJson (P2-3) Change-Id: I51d0c8c51d3b0b648ed5ff4ea282bda070b0d457
24 lines
577 B
JavaScript
24 lines
577 B
JavaScript
import { readdirSync } from 'fs';
|
|
import { execSync } from 'child_process';
|
|
import { join } from 'path';
|
|
|
|
const testsDir = join(import.meta.dirname, '..', 'tests');
|
|
const files = readdirSync(testsDir)
|
|
.filter((f) => f.endsWith('.test.js'))
|
|
.sort();
|
|
|
|
let failed = 0;
|
|
for (const file of files) {
|
|
const path = join(testsDir, file);
|
|
try {
|
|
execSync(`node ${path}`, { stdio: 'inherit' });
|
|
} catch {
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
if (failed > 0) {
|
|
console.error(`\n${failed} test file(s) failed.`);
|
|
process.exit(1);
|
|
}
|
|
console.log(`\nAll ${files.length} test files passed.`);
|