Skip to content

Commit 2c43548

Browse files
committed
Tests: Handle globals in .jshintrc.
1 parent ecd6a25 commit 2c43548

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/unit/testsuite.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,22 @@ TestHelpers.testJshint = function( module ) {
7777
dataType: "text"
7878
})
7979
).done(function( hintArgs, srcArgs ) {
80-
var passed = JSHINT( srcArgs[ 0 ], hintArgs[ 0 ] ),
81-
errors = $.map( JSHINT.errors, function( error ) {
82-
// JSHINT may report null if there are too many errors
83-
if ( !error ) {
84-
return;
85-
}
86-
87-
return "[L" + error.line + ":C" + error.character + "] " +
88-
error.reason + "\n" + error.evidence + "\n";
89-
}).join( "\n" );
80+
var globals, passed, errors,
81+
jshintrc = hintArgs[ 0 ],
82+
source = srcArgs[ 0 ];
83+
84+
globals = jshintrc.globals || {};
85+
delete jshintrc.globals;
86+
passed = JSHINT( source, jshintrc, globals ),
87+
errors = $.map( JSHINT.errors, function( error ) {
88+
// JSHINT may report null if there are too many errors
89+
if ( !error ) {
90+
return;
91+
}
92+
93+
return "[L" + error.line + ":C" + error.character + "] " +
94+
error.reason + "\n" + error.evidence + "\n";
95+
}).join( "\n" );
9096
ok( passed, errors );
9197
start();
9298
})

0 commit comments

Comments
 (0)