HTML Reporter: Add support for instant rendering#1793
Merged
Conversation
When projects use the recommended structure for the HTML test suite, in which qunit.js is loaded at the end of the `<body>` we now render the UI immediately instead of waiting for all source code and test suites to load first, which can take a while in large projects. * /demos/qunit-onerror-early.html Add an "boomBegin" option, to allow separate testing of "normal" early early errors, and errors from QUnit.begin(). * /test/config-reporters.html Move `<div id=qunit>` up so that we cover code for disabling QUnit.config.reporters after qunit.js. This code previously existed in QUnit.start(), but now that we've moved to happen earlier, this was now testing a less interesting scenario.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For the last ten years, our HTML examples have looked something like this. With
qunit.jsgenerally recommended as the first script, but always after the<div id="qunit">element, toward the end of the HTML<body>element:As of this PR, we now leverage this fact to instantly render the UI, instead of waiting for all source code and test suites to load first, which can take a while in large projects. Additionally, if a project has only synchronous tests, the page would previously remain blank for whole extra second (or until all tests have completed running) until the first render yield point (
config.updateRate).This requires changing the HTML Reporter to have its initial rendering not depend on the complete module list from
QUnit.begin(). As a first step, I've simply omitted the toolbar from the first render.Minor changes:
/demos/qunit-onerror-early.html
Add an "boomBegin" option, to allow separate testing of "general" early uncaught errors, from early errors inside
QUnit.begin()callbacks./test/config-reporters.html
Move
<div id=qunit>up so that we cover code for disabling QUnit.config.reporters after qunit.js. This code previously existed in QUnit.start(), but now that we've moved to happen earlier, this was now testing a less interesting scenario.As an example, the
/demos/q4000-qunit.htmlis an intentionally large test suite that takes a while to load, and are all synchronous tests.Before this change, the page remains blank for about half a second after the first, final, and singular frame is painted; rendering the entire UI, green completed status bar, and all test results.
After this change, the following renders almost instantly at http://localhost:4000/demos/q4000-qunit.html, while the tests run and complete in the same time as otherwise: