summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/eslint-plugin-mozilla/reject-requires-await.rst
blob: 2a8618939f61085d109b12460064095c2af0cd28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
reject-requires-await
=====================

`Assert.rejects` must be preceded by an `await`, otherwise the assertion
may not be completed before the test finishes, might not be caught
and might cause intermittent issues in other tests.

Examples of incorrect code for this rule:
-----------------------------------------

.. code-block:: js

    Assert.rejects(myfunc(), /startup failed/, "Should reject");

Examples of correct code for this rule:
---------------------------------------

.. code-block:: js

    await Assert.rejects(myfunc(), /startup failed/, "Should reject");