Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.31 KB

no-async-test.md

File metadata and controls

47 lines (27 loc) · 1.31 KB

Disallow the use of asyncTest or QUnit.asyncTest (qunit/no-async-test)

💼 This rule is enabled in the ✅ recommended config.

QUnit 2.0 is deprecating QUnit.asyncTest() in favor of assert.async() within tests. This rule will flag asyncTest and QUnit.asyncTest calls and recommend that you use assert.async() instead.

Rule Details

The following patterns are considered warnings:

asyncTest("Asynchronous test", function () { });

QUnit.asyncTest("Asynchronous test", function () { });

The following patterns are not considered warnings:

test("Synchronous test", function () { });

test("Asynchronous test", function (assert) {
    var done = assert.async();
    done();
});

QUnit.test("Synchronous test", function () { });

QUnit.test("Asynchronous test", function (assert) {
    var done = assert.async();
    done();
});

When Not to Use It

This rule can be safely disabled if you want to tolerate asynchronous test declarations, especially if your codebase does not use QUnit 2.0 syntax yet.

Further Reading