-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests_check.js
47 lines (43 loc) · 1.66 KB
/
tests_check.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var fs = require('fs');
var tests = require('./TestScenarios.js'); //JSON.parse(fs.readFileSync('tests.json'));
var colors = require('colors');
var written_path = [];
function write_path_and_message(path, message) {
if(written_path.length == 0) {
console.log();
console.log();
console.log();
console.log();
console.log('Please pay attention to not implemented tests:'.blue);
}
for(var i = 0; i < path.length; i++) {
if(written_path[i] != path[i]) {
written_path[i] = path[i];
console.log();
console.log(" " + Array.apply(0, Array(i)).map(function() { return ' ' }).join("") + 'Requirement: '.green + path[i]);
}
}
console.log();
console.log(" " + Array.apply(0, Array(i)).map(function() { return ' ' }).join("") + ' ' + message);
}
(function parseUncompletedTests(base, path) {
if(Object.keys(base).length == 0) {
write_path_and_message(path, "no test scenarios found".red);
}
if(base instanceof Array) {
for(var i = 0; i < base.length; i++) {
var matches = base[i].match(/^(unit|func|e2e)\s+([^:\s]+)\s*:\s*(.+)$/);
var type = matches[1];
var filename = matches[2] + '.' + type + '-test.js';
var description = matches[3];
if(!fs.existsSync('tests/' + filename)) {
write_path_and_message(path, "file not found: ".blue + ' ' + description.red + ' ' + filename.red);
}
}
} else {
Object.keys(base).map(function(key) {
parseUncompletedTests(base[key], path.concat([key]))
})
}
})(tests, []);
console.log();