From 900c66e82b811902a51b716fd574d69e1976bd6a Mon Sep 17 00:00:00 2001 From: step2yeung Date: Fri, 3 May 2019 11:53:03 -0700 Subject: [PATCH] HTML Reporter: Check for undefined `testItem` in testDone callback For added robustness, allow the DOM node to be missing at this point just in case. Extracted from https://github.com/qunitjs/qunit/pull/1391. --- src/html-reporter/html.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/html-reporter/html.js b/src/html-reporter/html.js index 7b737b5c1..79968f16c 100644 --- a/src/html-reporter/html.js +++ b/src/html-reporter/html.js @@ -902,16 +902,15 @@ export function escapeText( s ) { } ); QUnit.testDone( function( details ) { - var testTitle, time, testItem, assertList, status, + var testTitle, time, assertList, status, good, bad, testCounts, skipped, sourceName, - tests = id( "qunit-tests" ); + tests = id( "qunit-tests" ), + testItem = id( "qunit-test-output-" + details.testId ); - if ( !tests ) { + if ( !tests || !testItem ) { return; } - testItem = id( "qunit-test-output-" + details.testId ); - removeClass( testItem, "running" ); if ( details.failed > 0 ) {