blob: 99c648e2d094242a7d89483ea144e0a00c8413a9 (
plain)
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
|
const glob = require('glob')
const path = require('path')
glob('./spec/*/**/*.js', (err, tests) => {
if (err) {
throw err
}
glob('./src/**/*.js', (err, files) => {
if (err) {
throw err
}
files = files.map((e) => path.basename(e))
tests = tests.map((e) => path.basename(e))
const difference = files.filter(x => !tests.includes(x))
if (difference.length) {
console.error('The following files dont have a test file:\n\t' + difference.join('\n\t'))
} else {
console.info('All src files are covered by tests')
}
})
})
|