-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobehave.js
More file actions
executable file
·36 lines (30 loc) · 1.26 KB
/
obehave.js
File metadata and controls
executable file
·36 lines (30 loc) · 1.26 KB
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
#!/usr/bin/env node
var test = require('./test');
var program = require('commander');
var helpers = require('./helpers');
// Hide ugly stack traces from the user.
process.on('uncaughtException', err => {
console.log(`\n${err}\n`);
process.exit(1)
});
program
.version(require('./package.json').version);
program
.command('test')
.description('run your obehave test suite')
.option('-k, --api-key <string>', 'API key, see https://app.obehave.io/settings/api')
.option('-s, --secure', 'if your server uses https (defaults to http)')
.option('-h, --host <string>', 'host your server runs on (defaults to "localhost")')
.option('-p, --port <integer>', 'port your server runs on (detaults to "80")', helpers.tryParseInt)
.action(function (options) {
var port = options.port || process.env.OBEHAVE_PORT;
var apiKey = options.apiKey || process.env.OBEHAVE_APIKEY;
var host = options.host || process.env.OBEHAVE_HOST;
var protocol = (options.secure || process.env.secure) ? 'https' : 'http';
return test(apiKey, protocol, host, port);
});
program.parse(process.argv);
// If some arguments haven't been consumed then the user has done something wrong.
if (program.args.length === 0) {
return program.help();
}