QUnitGS2 icon indicating copy to clipboard operation
QUnitGS2 copied to clipboard

Tests with uncaught exceptions disappear

Open brcsw opened this issue 3 years ago • 2 comments

Repro: Run a test that throws an uncaught exception, for example:

var QUnit = QUnitGS2.QUnit;

function doGet() {
   QUnitGS2.init();

   // Just to demonstrate that QUnitGS2 plumbing is hooked up correctly.
   QUnit.test("simple numbers", function( assert ) {
     assert.equal(1 + 1, 2, "addition");
   });

   QUnit.test("exception", function( assert ) {
     Logger.log("before exception");
     throw "uh oh";
     Logger.log("after exception");
   });

   QUnit.start();
   return QUnitGS2.getHtml();
}

function getResultsFromServer() {
   return QUnitGS2.getResultsFromServer();
}

I'm using the V8 runtime; not sure if that matters.

Expected: something shows up in the results page, or at least in the log that indicates an exception was thrown.

Actual: no indication in the UI that the test was even defined:

html screenshot

logs screenshot

brcsw avatar Nov 14 '21 23:11 brcsw

Just ran into the same problem. It took me a while to realize I'd made an error in my "before" test setup.

tomhallman avatar Dec 27 '21 20:12 tomhallman

Worked on (around) this for a few hours, and basically any assert.throws() call needs a try/catch else the other tests aren't run.

Not sure if this is related, but the test suite page points to the live test results, which fails at line 45.

tomhallman avatar Dec 28 '21 00:12 tomhallman