forked from minsoju/karma-selenium-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·45 lines (40 loc) · 971 Bytes
/
Gruntfile.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
var hostInterfaces = require("os").networkInterfaces;
var getHostName = function(interfaces){
var result = '';
interfaces = interfaces || [];
for(var index in interfaces){
var interface = interfaces[index];
if(!result){
result = searchHostFamily.apply(null, interface);
}
break;
}
};
var searchHostFamily = function(){
var result = '';
for(var argument of arguments){
if(argument.internal === false && argument.family === 'IPv4'){
result = argument.address;
};
}
return result;
}
module.exports = function(grunt) {
process.env.BASE_PATH = __dirname;
var config = {
pkg: grunt.file.readJSON('package.json'),
karma: {
options: {
configFile: 'examples/karma.conf.js',
hostname: getHostName(hostInterfaces),
port: 8000
},
dev: {
singleRun: false,
autoWatch: true
}
}
}
grunt.initConfig(config);
grunt.loadNpmTasks('grunt-karma');
}