]> source.dussan.org Git - jquery-ui.git/commitdiff
Tests: Handle globals in .jshintrc.
authorScott González <scott.gonzalez@gmail.com>
Wed, 27 Mar 2013 13:40:53 +0000 (09:40 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 27 Mar 2013 13:40:53 +0000 (09:40 -0400)
tests/unit/testsuite.js

index d2403beebf95ef6bc89e06c212f51a5ddb4583b5..ddc59ed0802ec82bcfe70646838fc0ccdd66d38a 100644 (file)
@@ -77,16 +77,22 @@ TestHelpers.testJshint = function( module ) {
                                dataType: "text"
                        })
                ).done(function( hintArgs, srcArgs ) {
-                       var passed = JSHINT( srcArgs[ 0 ], hintArgs[ 0 ] ),
-                               errors = $.map( JSHINT.errors, function( error ) {
-                                       // JSHINT may report null if there are too many errors
-                                       if ( !error ) {
-                                               return;
-                                       }
-
-                                       return "[L" + error.line + ":C" + error.character + "] " +
-                                               error.reason + "\n" + error.evidence + "\n";
-                               }).join( "\n" );
+                       var globals, passed, errors,
+                               jshintrc = hintArgs[ 0 ],
+                               source = srcArgs[ 0 ];
+
+                       globals = jshintrc.globals || {};
+                       delete jshintrc.globals;
+                       passed = JSHINT( source, jshintrc, globals ),
+                       errors = $.map( JSHINT.errors, function( error ) {
+                               // JSHINT may report null if there are too many errors
+                               if ( !error ) {
+                                       return;
+                               }
+
+                               return "[L" + error.line + ":C" + error.character + "] " +
+                                       error.reason + "\n" + error.evidence + "\n";
+                       }).join( "\n" );
                        ok( passed, errors );
                        start();
                })