From 94d130bd5a0ba05f40ccaa10f6af7ba0a593b069 Mon Sep 17 00:00:00 2001 From: UNIFINED <134551880+Wilsmac@users.noreply.github.com> Date: Sun, 8 Oct 2023 08:19:38 -0600 Subject: [PATCH] Add files via upload Signed-off-by: UNIFINED <134551880+Wilsmac@users.noreply.github.com> --- test.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test.js diff --git a/test.js b/test.js new file mode 100644 index 0000000..d1bf81f --- /dev/null +++ b/test.js @@ -0,0 +1,29 @@ +import fs from 'fs'; +import path, {dirname} from 'path'; +import assert from 'assert'; +import {spawn} from 'child_process'; +import syntaxError from 'syntax-error'; +import {fileURLToPath} from 'url'; +import {createRequire} from 'module'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const require = createRequire(__dirname); +const folders = ['.', ...Object.keys(require(path.join(__dirname, './package.json')).directories)]; +const files = []; +for (const folder of folders) { + for (const file of fs.readdirSync(folder).filter((v) => v.endsWith('.js'))) { + files.push(path.resolve(path.join(folder, file))); + } +} +for (const file of files) { + if (file == __filename) continue; + console.error('Checking', file); + const error = syntaxError(fs.readFileSync(file, 'utf8'), file, { + sourceType: 'module', + allowReturnOutsideFunction: true, + allowAwaitOutsideFunction: true, + }); + if (error) assert.ok(error.length < 1, file + '\n\n' + error); + assert.ok(file); + console.log('Done', file); +}