blob: 6a9297820e4534c913a41d853805cb2341235085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import fs from 'node:fs';
import { execSync } from 'node:child_process';
function recursiveScanDir(path, f)
{
let dirs = [];
for (let dirent of fs.readdirSync(path, { withFileTypes: true })) {
if (dirent.isDirectory()) dirs.push(`${path}/${dirent.name}`);
else f(`${path}/${dirent.name}`);
}
for (let dir of dirs) {
recursiveScanDir(dir, f);
}
}
recursiveScanDir('.', fname => {
if (fname.endsWith('.test.js')) {
console.log(`======== ${fname} ========`);
execSync(`node ${fname}`, { stdio: 'inherit' });
console.log('');
}
});
|