Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.25 KB

no-assert-equal-boolean.md

File metadata and controls

40 lines (26 loc) · 1.25 KB

Require use of boolean assertions (qunit/no-assert-equal-boolean)

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

The boolean assertion functions assert.true() and assert.false() are available as of QUnit 2.11. These assertions can be stricter and clearer about intent when compared to using other assertion functions for boolean comparisons.

Rule Details

The following patterns are considered warnings:

QUnit.test('Name', function (assert) { assert.equal(a, true); });
QUnit.test('Name', function (assert) { assert.strictEqual(a, true); });
QUnit.test('Name', function (assert) { assert.deepEqual(false, a); });

The following patterns are not considered warnings:

QUnit.test('Name', function (assert) { assert.true(a); });
QUnit.test('Name', function (assert) { assert.false(a); });

Further Reading