Qunitjs | pushResult function

The pushResult() is a built-in function of Qunitjs test suite which report the result of a custom assertion.

Some test suites may need to express an expectation that is not defined by any of QUnit’s built-in assertions. This need may be met by encapsulating the expectation in a JavaScript function which returns a Boolean value representing the result; this value can then be passed into QUnit’s ok assertion.

A more readable solution would involve defining a custom assertion. If the expectation function invokes pushResult, QUnit will be notified of the result and report it accordingly.


Qunitjs pushResult() function example

Continue reading: https://api.qunitjs.com/assert/pushResult

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts: