forked from KevinSheedy/jquery.alphanum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
207 lines (189 loc) · 6.69 KB
/
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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
module.exports = function(grunt) {
//var request = require('request');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 9001,
base: '.'
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
eslint: {
files: ['.eslintrc.js', '*.js', 'unit/**/*.js', 'e2e/**/*.js'],
tasks: ['eslint:dev']
},
karma: {
files: ['jquery.alphanum.js', 'lib/**/*.js', 'unit/*'],
tasks: ['karma']
},
mocha: {
files: ['jquery.alphanum.js', 'lib/**/*.js', 'e2e/**/*.js', 'e2e/**/*.html'],
tasks: ['mochaWebdriver:phantom']
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
captureFile: 'log/results.txt', // Optionally capture the reporter output to a file
quiet: false, // Optionally suppress output to standard out (defaults to false)
clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
},
src: ['e2e/tests.js']
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true,
reporters: ['dots'],
background: false
}
},
eslint: {
options: {
//outputFile: 'reports/eslint.report'
//cache: false
},
dev: {
src: ['*.js', 'unit/**/*.js', 'e2e/**/*.js']
}
},
'saucelabs-qunit': {
all: {
options: {
username: process.env.SAUCE_USERNAME, // if not provided it'll default to ENV SAUCE_USERNAME (if applicable)
key: function() {return process.env.SAUCE_ACCESS_KEY;}, // if not provided it'll default to ENV SAUCE_ACCESS_KEY (if applicable)
urls: ['http://localhost:9001/unit' /*, 'www.example.com/mochaTests'*/],
build: process.env.CI_BUILD_NUMBER,
testname: 'Unit Tests for jquery.alphanum',
browsers: [
// // Chrome Windows
['Windows 10', 'chrome', 'beta'],
// ['Windows 8.1', 'chrome', 'beta'],
// ['Windows 8', 'chrome', 'beta'],
// ['Windows 7', 'chrome', 'beta'],
// ['macOS 10.13', 'chrome', 'beta'],
['OS X 10.9', 'chrome', 'beta'],
['Linux', 'chrome', '48.0'],
// ['Windows 7', 'chrome', '40'],
// // Chrome Firefox
['Windows 10', 'firefox', 'beta'],
// ['Windows 8.1', 'firefox', 'beta'],
// ['Windows 8', 'firefox', 'beta'],
// ['Windows 7', 'firefox', 'beta'],
// ['macOS 10.13', 'firefox', 'beta'],
['OS X 10.9', 'firefox', 'beta'],
// // MS Edge
// ['Windows 10', 'microsoftedge', '16.16299'],
// // IE
['Windows 10', 'internet explorer', '11'],
['Windows 8', 'internet explorer', '10'],
// ['Windows 7', 'internet explorer', '9'],
// // Opera
['', 'opera', '12'],
// ['', 'opera', '11'],
// // Safari
['macOS 10.13', 'safari', '11.0'],
// ['macOS 10.12', 'safari', '10.1'],
// ['OS X 10.11', 'safari', '10.0'],
// ['OS X 10.11', 'safari', '9.0'],
// ['OS X 10.10', 'safari', '8.0'],
['OS X 10.9', 'safari', '7.0']
]
}
}
},
sauce_connect: {
dev: {
options: {
username: process.env.SAUCE_USERNAME,
accessKey: process.env.SAUCE_ACCESS_KEY,
tunnelIdentifier: 'tunnel-jquery-alphanum-' + process.pid
}
}
},
mochaWebdriver: {
options: {
timeout: 1000 * 60 * 3
},
sauce: {
src: ['e2e/tests-wd.js'],
options: {
testName: 'e2e Tests for jquery.alphanum',
concurrency: 2,
usePromises: true,
browsers: [
{browserName: 'internet explorer', platform: 'Windows 7', version: '9'},
{browserName: 'opera', platform: '', version: '12'},
{browserName: 'safari', platform: '', version: '8'},
//{browserName: 'firefox', platform: '', version: '35'},
//{browserName: 'android', platform: 'Linux', version: '5'},
//{browserName: 'internet explorer', platform: 'Windows 7', version: '8'},
{browserName: 'chrome', platform: 'Windows 7', version: ''}
]
}
},
phantom: {
src: ['e2e/tests-wd.js'],
options: {
testName: 'e2e Tests for jquery.alphanum',
usePhantom: true,
usePromises: true
}
},
chrome: {
src: ['e2e/tests-wd.js'],
options: {
testName: 'e2e Tests for jquery.alphanum',
hostname: '127.0.0.1',
port: '4444',
usePromises: true,
browsers: [
{browserName: 'chrome'}
]
}
},
firefox: {
src: ['e2e/tests-wd.js'],
options: {
testName: 'e2e Tests for jquery.alphanum',
hostname: '127.0.0.1',
port: '4444',
usePromises: true,
browsers: [
{browserName: 'firefox'}
]
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('gruntify-eslint');
require('jit-grunt')(grunt);
grunt.loadNpmTasks('grunt-selenium-webdriver');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-sauce-connect-launcher');
grunt.loadNpmTasks('grunt-mocha-webdriver');
// Default task(s).
//grunt.registerTask('test', ['selenium_start', 'connect', 'karma', 'mochaTest']);
//grunt.registerTask('travis', ['eslint', 'connect', 'saucelabs-qunit', 'sauce_connect:dev', 'mochaTest', 'sauce-connect-close']);
//grunt.registerTask('e2e', ['selenium_start', 'connect', 'mochaTest']);
grunt.registerTask('default', ['connect', 'watch']);
grunt.registerTask('test', ['eslint', 'unit', 'e2e']);
grunt.registerTask('travis', ['eslint', 'connect', 'saucelabs-qunit', 'mochaWebdriver']);
grunt.registerTask('unit', ['karma']);
grunt.registerTask('unit-sauce', ['connect', 'saucelabs-qunit']);
grunt.registerTask('e2e', ['e2e-phantom']);
grunt.registerTask('e2e-phantom', ['connect', 'mochaWebdriver:phantom']);
grunt.registerTask('e2e-sauce', ['connect', 'mochaWebdriver:sauce']);
grunt.registerTask('e2e-chrome', ['selenium_start', 'connect', 'mochaWebdriver:chrome']);
grunt.registerTask('e2e-firefox', ['selenium_start', 'connect', 'mochaWebdriver:firefox']);
grunt.registerTask('e2e-sauce-old', ['sauce_connect:dev', 'connect', 'mochaTest', 'sauce-connect-close']);
};