sbrandwoo / grunt-qunit-junit

JUnit compatible XML reporter for QUnit and grunt 0.4
MIT License
16 stars 5 forks source link

Error when using QUnit noGlobals option #20

Closed ArchCodeMonkey closed 9 years ago

ArchCodeMonkey commented 9 years ago

Since updating I've been getting the error:

Fatal error: Unable to write "test\reports\javascript\TEST-utilities.html?noglobals=.xml" file (Error code: ENOENT).

error

If I remove the noGlobals option from the qunit task then the report file is written successfully.

noglobals

I believe it is failing because the default for option.fileNamer uses the regex /\.html$/ and this does not account for the query string after the file name. I was able to use the fileNamer option to remove the extra text and successfully write the report file.

fileNamer: function (sTestPath)
{
   var sFileName = sTestPath.substring(sTestPath.lastIndexOf('/') + 1);
   var nEndIndex = sFileName.indexOf('.html');
   return (nEndIndex === -1) ? sFileName : sFileName.substring(0, nEndIndex);;
},

filenamer

jonnyreeves commented 9 years ago

Thanks for the detailed bug report @ArchCodeMonkey.

Your suggestion of modifying the default fileNamer function to chomp everything after the query sounds sensible and should be fairly trivial to address over the weekend.