-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
32 lines (27 loc) · 1.01 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let fs = require('fs')
let path = require('path')
let assert = require('assert')
let { spawn } = require('child_process')
const RESET = '\x1b[0m'
const BRIGHT = '\x1b[1m'
const DIM = '\x1b[2m'
const RED = '\x1b[31m'
const GREEN = '\x1b[32m'
const BLUE = '\x1b[34m'
let folders = ['.', ...Object.keys(require('./package.json').directories)]
let files = []
for (let folder of folders) {
for (let file of fs.readdirSync(folder).filter(v => v.endsWith('.js'))) {
files.push(path.resolve(path.join(folder, file)))
}
}
for (let file of files) {
if (file == path.join(__dirname, __filename)) continue
console.error(`${BRIGHT}${BLUE}Checking${RESET} ${file}`) // Highlight "Checking" in console logs with blue color
spawn(process.argv0, ['-c', file])
.on('close', () => {
assert.ok(file)
console.log(`${BRIGHT}${GREEN}Done${RESET} ${file} ${BRIGHT}${Math.floor(Math.random() * 100)}%${RESET}`)
})
.stderr.on('data', chunk => assert.ok(chunk.length < 1, `${RED}${DIM}${file}\n\n${chunk}${RESET}`))
}