forked from vaadin/vaadin-combo-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
117 lines (107 loc) · 2.63 KB
/
gulpfile.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
'use strict';
var args = require('yargs').argv;
var chalk = require('chalk');
var wct = require('web-component-tester').test;
var gulp = require('gulp');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var htmlExtract = require('gulp-html-extract');
function cleanDone(done) {
return function(error) {
if (error) {
// Pretty error for gulp.
error = new Error(chalk.red(error.message || error));
error.showStack = false;
}
done(error);
};
}
function localAddress() {
var ip, tun, ifaces = require('os').networkInterfaces();
Object.keys(ifaces).forEach(function(ifname) {
ifaces[ifname].forEach(function(iface) {
if ('IPv4' == iface.family && !iface.internal) {
if (!ip) {
ip = iface.address;
}
if (/tun/.test(ifname)) {
tun = iface.address;
}
}
});
});
return tun || ip;
}
function test(options, done) {
wct(options, cleanDone(done));
}
function testSauce(browsers, done) {
test(
{
expanded: true,
browserOptions: {
name: localAddress() + ' / ' + new Date(),
build: 'vaadin-combo-box'
},
plugins: {
sauce: {
username: args.sauceUsername,
accessKey: args.sauceAccessKey,
browsers: browsers
}
},
extraScripts: args.dom === 'shadow' ? ['test/enable-shadow-dom.js'] : [],
root: '.',
webserver: {
port: 2000,
hostname: localAddress()
}
}, done);
}
gulp.task('test:desktop', function(done) {
testSauce([
'Windows 10/chrome@47',
'Windows 10/firefox@43',
'Windows 10/microsoftedge@20',
'Windows 10/internet explorer@11',
'OS X 10.11/[email protected]'], done);
});
gulp.task('test:mobile', function(done) {
testSauce([
'OS X 10.11/[email protected]',
'OS X 10.11/[email protected]',
'Linux/[email protected]'], done);
});
gulp.task('lint:js', function() {
return gulp.src([
'*.js',
'test/*.js'
])
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(jshint.reporter('fail'))
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'));
});
gulp.task('lint:html', function() {
return gulp.src([
'*.html',
'demo/*.html',
'test/*.html'
])
.pipe(htmlExtract({
sel: 'script, code-example code'
}))
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(jshint.reporter('fail'))
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'));
});
gulp.task('test:shadow', function(done) {
args.dom = 'shadow';
testSauce([
'Windows 10/chrome@45'], done);
});