Allow test runs with zero assertions to pass #1449
Closed
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.
Fixes #1405
Previous Behaviour
Before this change, test runs that included tests which had in total zero assertions, would fail with a global error. This made it, f.e. not possible to run test cases leveraging other means of assertions than the QUnit built-ins (
assert.ok
,assert.equals
, etc.)For a reproduction example, see also the description of the original issue: #1405
New Behaviour
With this change, QUnit will decide if the current test run is "empty" and should therefore fail based on the number of tests included in the run rather than the number of included assertions. This should allow users to run test sets containing zero assertions, as long as respective test cases are marked as such using the
assert.expect(0)
declaration.How to Test
Run the new example test case containing no assertions to verify the new behaviourL