@@ -21,13 +21,13 @@ var Promise = global.Promise;
2121// Shared functions
2222
2323// Allow an error message to retain its color when split across multiple lines.
24- function formatMessage ( message ) {
24+ function formatMessage ( message ) {
2525 var str = String ( message ) ;
2626 if ( typeof message === 'object' && / ^ \[ o b j e c t .* \] $ / . test ( str ) ) {
2727 // try to use the JSON as a better string representation
2828 try {
2929 str = JSON . stringify ( message , null , 2 ) ;
30- } catch ( _ ) {
30+ } catch ( _ ) {
3131 }
3232 }
3333 return String ( str ) . split ( '\n' )
@@ -38,7 +38,7 @@ function formatMessage (message) {
3838}
3939
4040
41- function createRunEnd ( ) {
41+ function createRunEnd ( ) {
4242 return {
4343 status : 'passed' ,
4444 testCounts : {
@@ -80,7 +80,7 @@ function generateMessage(combined) {
8080}
8181
8282// Copied from QUnit source code
83- function generateHash ( module ) {
83+ function generateHash ( module ) {
8484 var hex ;
8585 var i = 0 ;
8686 var hash = 0 ;
@@ -104,7 +104,7 @@ function generateHash (module) {
104104}
105105
106106function getPath ( url ) {
107- if ( url . substr ( 0 , 7 ) === 'http://' || url . substr ( 0 , 8 ) === 'https://' ) {
107+ if ( url . substr ( 0 , 7 ) === 'http://' || url . substr ( 0 , 8 ) === 'https://' ) {
108108 return url ;
109109 }
110110
@@ -127,7 +127,7 @@ module.exports = function(grunt) {
127127 var asset = path . join . bind ( null , __dirname , '..' ) ;
128128
129129 // If options.force then log an error, otherwise exit with a warning
130- function warnUnlessForced ( message ) {
130+ function warnUnlessForced ( message ) {
131131 if ( options && options . force ) {
132132 grunt . log . error ( message ) ;
133133 } else {
@@ -231,7 +231,7 @@ module.exports = function(grunt) {
231231 combinedRunEnd . status = 'failed' ;
232232 } ) ;
233233
234- eventBus . on ( 'qunit.on.error' , function ( err ) {
234+ eventBus . on ( 'qunit.on.error' , function ( err ) {
235235 // It is the responsibility of QUnit to ensure a run is marked as failure
236236 // if there are (unexpected) messages received from window.onerror.
237237 //
@@ -250,7 +250,7 @@ module.exports = function(grunt) {
250250 grunt . event . emit ( 'qunit.error.onError' , err ) ;
251251 } ) ;
252252
253- eventBus . on ( 'error.onError' , function ( msg ) {
253+ eventBus . on ( 'error.onError' , function ( msg ) {
254254 // This is important in addition to `QUnit.on('error')` to catch uncaught
255255 // errors that happen before the bridge is in effect (which in practice
256256 // will happen at DOMContentLoaded, after qunit.js and test files have done
@@ -296,7 +296,7 @@ module.exports = function(grunt) {
296296 // Read the content of the specified bridge files
297297 var bridgeFiles = Array . isArray ( options . inject ) ? options . inject : [ options . inject ] ;
298298 var bridgContents = [
299- " __grunt_contrib_qunit_timeout__ = " + JSON . stringify ( options . timeout ) + ";"
299+ ' __grunt_contrib_qunit_timeout__ = ' + JSON . stringify ( options . timeout ) + ';'
300300 ] ;
301301
302302 for ( var i = 0 ; i < bridgeFiles . length ; i ++ ) {
@@ -329,7 +329,7 @@ module.exports = function(grunt) {
329329 done ( success ) ;
330330 }
331331
332- function appendToUrls ( queryParam , value ) {
332+ function appendToUrls ( queryParam , value ) {
333333 // Append the query param to all urls
334334 urls = urls . map ( function ( testUrl ) {
335335 var parsed = url . parse ( testUrl , true ) ;
@@ -415,7 +415,14 @@ module.exports = function(grunt) {
415415 // Tell the client that when DOMContentLoaded fires, it needs to tell this
416416 // script to inject the bridge. This should ensure that the bridge gets
417417 // injected before any other DOMContentLoaded or window.load event handler.
418- page . evaluateOnNewDocument ( 'if (window.QUnit) {\n' + bridgContents . join ( ";" ) + '\n} else {\n' + 'document.addEventListener("DOMContentLoaded", function() {\n' + bridgContents . join ( ";" ) + '\n});\n}\n' ) ;
418+ page . evaluateOnNewDocument (
419+ 'if (window.QUnit) {\n' +
420+ bridgContents . join ( ';' ) +
421+ '\n} else {\n' +
422+ 'document.addEventListener("DOMContentLoaded", function() {\n' +
423+ bridgContents . join ( ';' ) +
424+ '\n});\n}\n'
425+ ) ;
419426
420427 for ( const url of urls ) {
421428 // Reset current module.
@@ -453,7 +460,7 @@ module.exports = function(grunt) {
453460 } )
454461 . catch ( function ( err ) {
455462 // If anything goes wrong, terminate the grunt task
456- grunt . log . error ( " There was an error with headless chrome" ) ;
463+ grunt . log . error ( ' There was an error with headless chrome' ) ;
457464 grunt . fail . fatal ( err ) ;
458465 finishTask ( false ) ;
459466 } ) ;
0 commit comments