-
Notifications
You must be signed in to change notification settings - Fork 2
/
cli.js
executable file
·46 lines (38 loc) · 1.13 KB
/
cli.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
#! /usr/bin/env node
/*
* perfbudget
* https://github.com/oliverfarrell/perfbudget
*
* Licensed under the MIT license.
*/
'use strict';
var argv = require('minimist')(process.argv.slice(2)),
colors = require('colors'),
options = require('./lib/normalizeCli')(argv),
perfbudget = require('./perfbudget');
perfbudget.runTest(options, function(err, result) {
if (err) {
console.log(err);
process.exit(1);
}
// output our header and results
if (!result.pass) {
console.log(
'\n-----------------------------------------------' +
'\nTest for ' + result.options.url + ' \t ' + colors.red('[FAILED]') +
'\n-----------------------------------------------\n'
);
console.log(result.msg);
console.log('Summary: ' + result.summary);
process.exit(1);
} else {
console.log(
'\n-----------------------------------------------' +
'\nTest for ' + result.options.url + ' \t ' + colors.green('[PASSED]') +
'\n-----------------------------------------------\n'
);
console.log(result.msg);
console.log('Summary: ' + result.summary);
process.exit();
}
});