Back to Qunit

assert.push()

docs/api/assert/push.md

2.25.01.3 KB
Original Source

push( result, actual, expected, message )

Report the result of a custom assertion.

<p class="note note--warning" markdown="1">This method is __deprecated__ and it's recommended to use [`assert.pushResult()`](../assert/pushResult.md) instead.</p>
namedescription
result (boolean)Result of the assertion
actualExpression being tested
expectedKnown comparison value
message (string)A short description of the assertion

QUnit.assert.push() relies on global state to push the assertion to the currently running test. This may leak assertions from asynchronous tests into an unrelated test.

To create a QUnit assertion plugin, refer to assert.pushResult().

To safely report a global error from inside a plugin or other integration layer, without needing to know whether or which test is running, use QUnit.onUncaughtException() instead.

Changelog

| QUnit 2.1.0 | Deprecated. Use assert.pushResult instead. | QUnit 2.0.0| Remove QUnit.push alias. | QUnit 1.15.0 | Rename QUnit.push to QUnit.assert.push, with alias.