💼 This rule is enabled in the ✅ recommended
config.
QUnit 2.0 is deprecating and removing global QUnit assertions such as ok()
, requiring consumers to instead use scoped assertions provided on the test callback argument.
The following patterns are considered warnings:
ok(true);
equal(a, b);
strictEqual(a, b);
deepEqual(a, b);
propEqual(a, b);
notEqual(a, b);
notStrictEqual(a, b);
notDeepEqual(a, b);
notPropEqual(a, b);
raises(function () {}, TypeError);
throws(function () {}, TypeError);
The following patterns are not considered warnings:
assert.ok(true);
assert.equal(a, b);
assert.strictEqual(a, b);
assert.deepEqual(a, b);
assert.propEqual(a, b);
assert.notEqual(a, b);
assert.notStrictEqual(a, b);
assert.notDeepEqual(a, b);
assert.notPropEqual(a, b);
assert.raises(function () {}, TypeError);
assert.throws(function () {}, TypeError);
Where assert
is the name of the first argument to your test callback.
This rule can be safely disabled if you want to tolerate global assertions, especially if your codebase does not use QUnit 2.0 syntax yet.