@@ -156,15 +156,17 @@ exports.init = function(grunt) {
156156 var reporterOutputDir ;
157157 // Get reporter output directory for relative paths in reporters
158158 if ( options . hasOwnProperty ( 'reporterOutput' ) ) {
159- reporterOutputDir = path . dirname ( options . reporterOutput ) ;
159+ if ( options . reporterOutputRelative ) {
160+ reporterOutputDir = path . dirname ( options . reporterOutput ) ;
161+ }
160162 delete options . reporterOutput ;
161163 }
162164
163165 // Select a reporter to use
164166 var reporter = exports . selectReporter ( options ) ;
165167
166168 // Remove bad options that may have came in from the cli
167- [ 'reporter' , 'jslint-reporter' , 'checkstyle-reporter' , 'show-non-errors' ] . forEach ( function ( opt ) {
169+ [ 'reporter' , 'reporterOutputRelative' , ' jslint-reporter', 'checkstyle-reporter' , 'show-non-errors' ] . forEach ( function ( opt ) {
168170 if ( options . hasOwnProperty ( opt ) ) {
169171 delete options [ opt ] ;
170172 }
@@ -194,9 +196,11 @@ exports.init = function(grunt) {
194196 var allData = [ ] ;
195197 cliOptions . args = files ;
196198 cliOptions . reporter = function ( results , data ) {
197- results . forEach ( function ( datum ) {
198- datum . file = reporterOutputDir ? path . relative ( reporterOutputDir , datum . file ) : datum . file ;
199- } ) ;
199+ if ( reporterOutputDir ) {
200+ results . forEach ( function ( datum ) {
201+ datum . file = path . relative ( reporterOutputDir , datum . file ) ;
202+ } ) ;
203+ }
200204 reporter ( results , data , options ) ;
201205 allResults = allResults . concat ( results ) ;
202206 allData = allData . concat ( data ) ;
0 commit comments