📝 Disallow assert.throws() with block, string, and message args.
💼 This rule is enabled in the ✅ recommended config.
QUnit 2.0 has deprecated the assert.throws(block, string, message) form of
assert.throws(). This rule can be used to flag uses of the deprecated form
and convert them to use a regular expression or some other predicate.
The following patterns are considered warnings:
QUnit.test('test', function (assert) {
assert.throws(function () {
// code
}, "error message", "An error should have been thrown");
});The following patterns are not warnings:
QUnit.test('test', function (assert) {
assert.throws(function () {
// code
}, /error message/, "An error should have been thrown");
});
QUnit.test('test', function (assert) {
assert.throws(function () {
// code
}, "An error should have been thrown");
});
QUnit.test('test', function (assert) {
assert.throws(function () {
// code
}, function (err) { return true; }, "An error should have been thrown");
});This rule can be safely disabled if you are not using QUnit 2.0.