Tests: Handle globals in .jshintrc.

This commit is contained in:
Scott González 2013-03-27 09:40:53 -04:00
parent ecd6a25a83
commit 2c43548ac6

View 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;
}
var globals, passed, errors,
jshintrc = hintArgs[ 0 ],
source = srcArgs[ 0 ];
return "[L" + error.line + ":C" + error.character + "] " +
error.reason + "\n" + error.evidence + "\n";
}).join( "\n" );
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();
})