Skip to content

Commit eaa0dbe

Browse files
committed
Assert: Restore assert.push() without deprecation.
Reverts commit 41383db. It's still used by numerous plugins that have no other reason to break. It's trivial to map to the new method and requires no maintenance or increased complexity, and we're not under any size constraints. Let's keep it around.
1 parent 3597c17 commit eaa0dbe

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docs/api/assert/push.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ title: assert.push()
44
excerpt: Report the result of a custom assertion.
55
groups:
66
- deprecated
7-
- removed
87
redirect_from:
98
- "/config/QUnit.push/"
109
- "/extension/QUnit.push/"
1110
- "/api/extension/QUnit.push/"
1211
version_added: "1.0.0"
1312
version_deprecated: "2.1.1"
14-
version_removed: "unreleased"
1513
---
1614

1715
`push( result, actual, expected, message )`
@@ -35,7 +33,6 @@ To safely report a global error from inside a plugin or other integration layer,
3533

3634
## Changelog
3735

38-
| UNRELEASED | Removed.
3936
| [QUnit 2.1.0](https://github.com/qunitjs/qunit/releases/tag/2.1.0) | Deprecated. Use `assert.pushResult` instead.
4037
| [QUnit 2.0.0](https://github.com/qunitjs/qunit/releases/tag/2.0.0)| Remove `QUnit.push` alias.
4138
| [QUnit 1.15.0](https://github.com/qunitjs/qunit/releases/tag/1.15.0) | Rename `QUnit.push` to `QUnit.assert.push`, with alias.

src/assert.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ class Assert {
8181
});
8282
}
8383

84+
push (result, actual, expected, message, negative) {
85+
const currentAssert = this instanceof Assert ? this : config.current.assert;
86+
return currentAssert.pushResult({
87+
result,
88+
actual,
89+
expected,
90+
message,
91+
negative
92+
});
93+
}
94+
8495
// Public API to internal test.pushResult()
8596
pushResult (resultInfo) {
8697
// Destructure of resultInfo = { result, actual, expected, message, negative }

0 commit comments

Comments
 (0)