This repository was archived by the owner on Jul 29, 2024. It is now read-only.
File tree 3 files changed +19
-8
lines changed
3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ var log_ = function() {
25
25
var Plugins = function ( config ) {
26
26
var self = this ;
27
27
28
- this . pluginConfs = config . plugins ;
28
+ this . pluginConfs = config . plugins || [ ] ;
29
29
this . pluginObjs = [ ] ;
30
30
this . pluginConfs . forEach ( function ( pluginConf ) {
31
31
var path ;
@@ -72,7 +72,7 @@ Plugins.printPluginResults = function(specResults) {
72
72
}
73
73
}
74
74
}
75
- }
75
+ } ;
76
76
77
77
function pluginFunFactory ( funName ) {
78
78
return function ( ) {
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ var q = require('q'),
13
13
* exports.config = {
14
14
* ...
15
15
* plugins: [{
16
- * chromeA11YDevTools: true,
16
+ * chromeA11YDevTools: {
17
+ * treatWarningsAsFailures: true
18
+ * },
17
19
* path: 'node_modules/protractor.plugins/accessiblity'
18
20
* }]
19
21
* }
@@ -165,7 +167,7 @@ function runTenonIO(config) {
165
167
* failed tests
166
168
* @private
167
169
*/
168
- function runChromeDevTools ( ) {
170
+ function runChromeDevTools ( config ) {
169
171
170
172
var data = fs . readFileSync ( AUDIT_FILE , 'utf-8' ) ;
171
173
data = data + ' return axs.Audit.run();' ;
@@ -202,10 +204,17 @@ function runChromeDevTools() {
202
204
203
205
return audit . forEach ( function ( result , index ) {
204
206
if ( result . result === 'FAIL' ) {
205
- result . passed = false ;
206
- testOut . failedCount ++ ;
207
-
208
207
var label = result . elementCount === 1 ? ' element ' : ' elements ' ;
208
+ if ( result . rule . severity !== 'Warning'
209
+ || config . chromeA11YDevTools . treatWarningsAsFailures ) {
210
+ result . passed = false ;
211
+ testOut . failedCount ++ ;
212
+ } else {
213
+ result . passed = true ;
214
+ result . rule . heading = '\x1b[33m(WARNING) '
215
+ + result . rule . heading + ' (' + result . elementCount
216
+ + label + 'failed)' ;
217
+ }
209
218
result . output = '\n\t\t' + result . elementCount + label + 'failed:' ;
210
219
211
220
// match elements returned via promises
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ exports.config = {
13
13
} ,
14
14
printAll : false
15
15
} ,
16
- chromeA11YDevTools : true ,
16
+ chromeA11YDevTools : {
17
+ treatWarningsAsFailures : true
18
+ } ,
17
19
path : '../index.js'
18
20
} ]
19
21
} ;
You can’t perform that action at this time.
0 commit comments