Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tests: Handle globals in .jshintrc.

  • Loading branch information...
commit 2c43548ac629467596ee64d0c614a0cef3169852 1 parent ecd6a25
@scottgonzalez scottgonzalez authored
Showing with 16 additions and 10 deletions.
  1. +16 −10 tests/unit/testsuite.js
View
26 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();
})
Please sign in to comment.
Something went wrong with that request. Please try again.