/
tests.js
40 lines (31 loc) · 1.01 KB
/
tests.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
process.env.DEBUG = '1';
require('./src/Component/Autoloader');
const Debug = Jymfony.Component.Debug.Debug;
const Runner = Jymfony.Component.Testing.Framework.Runner;
Debug.enable();
let [ , , ...argv ] = [ ...process.argv ];
if (0 === argv.length) {
argv.push('src/*/test/**/*.js', 'src/{Component,Bundle}/*/test/**/*.js');
} else {
const convert = string => string
.replace(/-/g, ' ')
.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, $1 => $1.toUpperCase())
.replace(/ /g, '');
for (const i in argv) {
if (-1 !== argv[i].indexOf('/') || -1 !== argv[i].indexOf('\\')) {
continue;
}
let name = convert(argv[i]);
if ('Util' === name) {
name = name.toLowerCase();
}
argv.splice(~~i, 1, 'src/' + name + '/test/**/*.js" "src/{Component,Bundle}/' + name + '/test/**/*.js');
}
argv = argv.join('" "').split(/"\s+"/g);
}
process.argv = argv;
try {
new Runner().run();
} catch (e) {
console.error(e);
}