blob: d25a6a4e127ab9a3d96c73a718f2952354d8f3eb (
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
26
27
|
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')
}
})
})
|