fancive_obsidian-parallel-r.../scripts/run-tests.mjs
wujunchen 0801b644f6 fix: address CR findings — bump script, test runner, temp cleanup
- bump-version.mjs: reject duplicate versions (use --force to override),
  auto git-add manifest.json + versions.json for npm version hook
- run-tests.mjs: use execFileSync to handle paths with spaces
- test-setup.js: clean up esbuild temp directory on process exit

Change-Id: I44410b550d09487dd7f5e30a8f9385a2c500252a
2026-04-27 20:19:53 +08:00

24 lines
593 B
JavaScript

import { execFileSync } from 'child_process';
import { readdirSync } from 'fs';
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 filePath = join(testsDir, file);
try {
execFileSync('node', [filePath], { 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.`);