-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
168 lines (151 loc) · 4.64 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
/*
* grunt-yellowlabtools
* https://github.com/gmetais/grunt-yellowlabtools
*
* Copyright (c) 2014 Gaël Métais
* Licensed under the GPL license.
*/
'use strict';
module.exports = function(grunt) {
// Load all grunt modules
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/**/*.js',
'test/**/*.js'
],
options: {
node: true,
mocha: true
}
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp']
},
// Configuration to be run (and then tested).
yellowlabtools: {
twitterLocal: {
urls: [
'https://twitter.com',
'https://twitter.com/tos'
],
failConditions: [
'fail if at least one url has a global score < 1/100'
],
options: {
locally: true
}
},
twitterDistant: {
urls: [
'https://twitter.com',
'https://twitter.com/tos'
],
failConditions: [
'fail if at least one url has a global score < 1/100'
],
options: {
locally: false
}
},
github: {
urls: [
'http://github.com/',
'https://github.com/features'
],
failConditions: [
'fail if at least one url has a global score < 80/100',
'fail if at least one url has a rule score < 40/100',
'fail if at least one url has a cssOldPropertyPrefixes score < 90/100',
'fail if at least one url has a cssImportants score < 20/100',
'ignore jsErrors',
'fail if at least one url has a DOMelementsCount > 300'
]
},
ecommerce: {
urls: [
'Amazon.com',
'Ebay.com',
'Netflix.com',
'www.etsy.com/',
'Walmart.com',
'Ikea.com',
'Homedepot.com',
'Bestbuy.com',
'Target.com',
'Groupon.com',
'Store.steampowered.com',
'Newegg.com',
'Macys.com',
'Lowes.com',
'Gap.com',
'6pm.com',
'Nordstrom.com',
'Hm.com',
'Kohls.com',
'Nike.com'
]
},
news: {
urls: [
'Reuters.com',
'Wunderground.com',
'Nbcnews.com',
'Latimes.com',
'Reddit.com',
'News.yahoo.com',
'Cnn.com',
'Nytimes.com',
'Weather.com',
'news.google.com/',
'Theguardian.com',
'Timesofindia.indiatimes.com',
'Bbc.co.uk/news/',
'Foxnews.com',
'Washingtonpost.com',
'Shutterstock.com',
'Individual.com',
'Usatoday.com',
'Bloomberg.com',
'Accuweather.com'
]
}
},
express: {
testSuite: {
options: {
port: 8388,
bases: 'test/www'
}
}
},
// Unit tests.
mochaTest: {
test: {
options: {
reporter: 'spec',
},
src: ['test/*Test.js']
}
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test', [
'jshint',
'clean',
'express:testSuite',
'mochaTest'
]);
// By default, lint and run all tests.
grunt.registerTask('default', [
'jshint',
'test'
]);
};