From f82f540a0cf07e8fd95e36dea10a49aa839832d0 Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 31 May 2022 22:54:59 -0500 Subject: move test.js and package.json to the root --- test.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test.js (limited to 'test.js') diff --git a/test.js b/test.js new file mode 100644 index 0000000..6a92978 --- /dev/null +++ b/test.js @@ -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(''); + } +}); -- cgit v1.2.1