blob: ae5fd02acd470bf2be57cdf061ab39e1da786a69 (
plain) (
blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#! /usr/bin/env node
/** imports */
var Mocha = require('mocha');
var fs = require('fs');
var fsPath = require('path');
var debug = require('debug')('cli');
/** server configurations */
var configurations = JSON.parse(require('fs').readFileSync(
__dirname + '/servers.json', 'utf8'
));
var configTypes = Object.keys(configurations);
var program = require('commander');
/** default tests */
var tests = [
'home_test.js',
'resources_test.js',
'query_test.js'
];
/** cli::setup */
program.option(
'-s, --server <name>',
'target server: ' +
'[ ' + configTypes.join(', ') + ' ]'
);
program.on('--help', function() {
console.log(' Logging:');
console.log();
console.log(' Use DEBUG=caldav:* to show all test logs');
console.log();
});
program.parse(process.argv);
testEnv = {
serverConfig: configurations[program.server],
server: program.server
};
/** load tests */
var inputTests = program.args;
if (inputTests.length)
tests = inputTests;
tests = tests.map(function(test) {
if (test[0] !== '/') {
test = fsPath.join(process.cwd(), test);
}
debug('loading', test);
return test;
});
/** run mocha tests */
var mocha = new Mocha();
mocha.files = tests;
mocha.ui('tdd');
mocha.reporter(program.reporter || 'spec');
mocha.run(process.exit);
|