forked from codewars/codewars-runner-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.js
77 lines (72 loc) · 2.42 KB
/
run.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var config = require('./lib/config' ),
opts = require("nomnom")
.options({
solution: {
abbr: 'c',
help: "solution code to run"
},
solutionFile: {
abbr: 'C',
full: 'solution-file',
help: "solution file to run"
},
fixture: {
abbr: 'f',
help: 'Test fixture code to test with'
},
fixtureFile: {
abbr: 'F',
full: 'fixture-file',
help: 'Test fixture code to test with'
},
setup: {
abbr: 's',
help: 'Setup code to be used for executing the code'
},
setupFile: {
abbr: 'S',
full: 'setup-file',
help: 'Setup file to be used for executing the code'
},
language: {
abbr: 'l',
help: 'The language to execute the code in'
},
languageVersion: {
abbr: 'V',
full: 'language-version',
help: 'The version of the language that you wish to use'
},
testFramework: {
abbr: 't',
full: 'test-framework',
help: 'The language specific framework to run in'
},
timeout: {
help: 'The timeout to be used for running the code. If not specified a language specific default will be used'
},
format: {
help: 'The output format that will be returned. Options are "default" and "json"',
default: 'default',
choices: ['default', 'json'],
abbr: 'fmt'
},
debug: {
abbr: 'd',
help: 'Print debugging info',
flag: true
},
version: {
abbr: 'v',
flag: true,
help: 'Print version and exit',
callback: function () {
return config.version
}
}
})
.help('This utility will run code in a specified language, using the specified testing suite.')
.parse();
require('./lib/opts').process(opts, function(opts) {
if(opts) require('./lib/runners/' + opts.language + '.js').run(opts);
});