diff options
author | sanine <sanine.not@pm.me> | 2022-05-31 22:54:59 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-05-31 22:54:59 -0500 |
commit | f82f540a0cf07e8fd95e36dea10a49aa839832d0 (patch) | |
tree | a0855b56182f521781a0b33247e5f08a23604f1f /test.js | |
parent | 5efc7885e1c3959aa165be640858ffb3f8a5860b (diff) |
move test.js and package.json to the root
Diffstat (limited to 'test.js')
-rw-r--r-- | test.js | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,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(''); + } +}); |