Context : a parser/validator module requiring 40 atomic tests, which are run with minified code for efficiency, using grunt/uglify for minification.
When one test fails, I need to use the QUnit/rerun function of that very atomic test, but with an alternate code, in order to get extensive parsing logs in the console (1000+ log lines for one of those tests).
The best solution I found is to grab the 'filter' url query parameter added by Qunit on rerun to detect if we currently are in a rerun, like so :
Is that the right way to do it ?
var soloTest; function getParameterByName(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) { return ""; } else { return decodeURIComponent(results[1].replace(/\+/g, " ")); } } function getResult(caseName) { var soloTest = getParameterByName('filter') ? 1 : 0; if (soloTest) { return myParser.validate({docRootPath: '#' + caseName}); } else { return myParserMin.validate({docRootPath: '#' + caseName}); } } // ... test(caseName, function () { expect(1); equal(effectiveResult, expectedResult, 'effectiveResult : \n' + effectiveResult + '\nexpectedResult,\n' + expectedResult); });