diff --git a/reporter/html.js b/reporter/html.js index 5d8b7ffbd..96de76338 100644 --- a/reporter/html.js +++ b/reporter/html.js @@ -1,5 +1,7 @@ import QUnit from "../src/core"; +import Test from "../src/test"; import { extractStacktrace } from "../src/core/stacktrace"; +import { now } from "../src/core/utilities"; import { window, navigator } from "../src/globals"; import "./urlparams"; @@ -735,6 +737,29 @@ export function escapeText( s ) { return nameHtml; } + function getProgressHtml( runtime, stats, total ) { + var completed = stats.passedTests + + stats.skippedTests + + stats.todoTests + + stats.failedTests; + + return [ + "
", + completed, + " / ", + total, + " tests completed in ", + runtime, + " milliseconds, with ", + stats.failedTests, + " failed, ", + stats.skippedTests, + " skipped, and ", + stats.todoTests, + " todo." + ].join( "" ); + } + QUnit.testStart( function( details ) { var running, bad; @@ -751,7 +776,8 @@ export function escapeText( s ) { bad ? "Rerunning previously failed test:
" : "Running:
", - getNameHtml( details.name, details.module ) + getNameHtml( details.name, details.module ), + getProgressHtml( now() - config.started, stats, Test.count ) ].join( "" ); } diff --git a/test/reporter-html/reporter-html.js b/test/reporter-html/reporter-html.js index 4b9b294b7..8cc5506fd 100644 --- a/test/reporter-html/reporter-html.js +++ b/test/reporter-html/reporter-html.js @@ -50,6 +50,18 @@ QUnit.test( "running test name displayed", function( assert ) { ); } ); +QUnit.test( "running test suite progress displayed", function( assert ) { + assert.expect( 1 ); + + var displaying = document.getElementById( "qunit-testresult" ); + + var expected = /\d+ \/ \d+ tests completed in \d+ milliseconds, with \d+ failed, \d+ skipped, and \d+ todo./; + assert.ok( + expected.test( displaying.innerHTML ), + "Expect test suite progress to be found in displayed text" + ); +} ); + QUnit.module( "timing", { getPreviousTest: function( assert ) { return document.getElementById( "qunit-test-output-" + assert.test.testId ) @@ -136,7 +148,6 @@ QUnit.test( "logs location", function( assert ) { ); } ); - QUnit.test( "disables autocomplete on module filter", function( assert ) { var moduleFilterSearch = document.getElementById( "qunit-modulefilter-search" );