From 036ac2333d06682642ee9405df2bd2145bacb60d Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 13 Mar 2021 23:00:48 +0000 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. Co-authored-by: step2yeung --- 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 ) {