diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-03-27 09:40:53 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-03-27 09:40:53 -0400 |
commit | 2c43548ac629467596ee64d0c614a0cef3169852 (patch) | |
tree | 9f290afbab8013c3020ddeee68dd455c722c4004 /tests/unit/testsuite.js | |
parent | ecd6a25a83b15d0c5af306c44befb9e652c82f37 (diff) | |
download | jquery-ui-2c43548ac629467596ee64d0c614a0cef3169852.tar.gz jquery-ui-2c43548ac629467596ee64d0c614a0cef3169852.zip |
Tests: Handle globals in .jshintrc.
Diffstat (limited to 'tests/unit/testsuite.js')
-rw-r--r-- | tests/unit/testsuite.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index d2403beeb..ddc59ed08 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -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(); }) |