Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display progress and runtime while test suite is executing #1398

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion reporter/html.js
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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 [
"<br />",
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;

Expand All @@ -751,7 +776,8 @@ export function escapeText( s ) {
bad ?
"Rerunning previously failed test: <br />" :
"Running: <br />",
getNameHtml( details.name, details.module )
getNameHtml( details.name, details.module ),
getProgressHtml( now() - config.started, stats, Test.count )
].join( "" );
}

Expand Down
13 changes: 12 additions & 1 deletion test/reporter-html/reporter-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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" );

Expand Down