forked from AvraamMavridis/gulp-louis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlouis.js
46 lines (38 loc) · 1.37 KB
/
louis.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
// Internal dependencies
var analyze = require('./analyze');
// External dependencies
var connect = require('gulp-connect');
var defaultOptions = {
runs: 1,
url: 'http://localhost:8888', // the url to be tested
timeout: 15, //timeout for phantomas run
viewport: '1280x1024',
engine: 'webkit', // experimental webkit, gecko
userAgent: 'Chrome/37.0.2062.120',
noExternals: false, // --no-externals block requests to 3rd party domains
performanceBudget: {} // performanceBudget object
}
var louis = function(options, callback){
options = options || {};
options.runs = defaultOptions.runs;
options.engine = options.engine || defaultOptions.engine;
options.timeout = options.timeout || defaultOptions.timeout;
options.viewport = options.viewport || defaultOptions.viewport;
options.userAgent = options.userAgent || defaultOptions.userAgent;
options.noExternals = options.noExternals || defaultOptions.noExternals;
options.performanceBudget = options.performanceBudget || defaultOptions.performanceBudget;
if(!!options.url)
{
options.url = options.url || defaultOptions.url;
}
else{
options.url = options.url || defaultOptions.url;
connect.server({
port: 8888
});
}
analyze(options, function(){
connect.serverClose();
});
}
module.exports = louis