Skip to content

jest/no-test-return-statement Style ​

What it does ​

Disallow explicitly returning from tests.

Why is this bad? ​

Tests in Jest should be void and not return values. If you are returning Promises then you should update the test to use async/await.

Example ​

javascript
test("one", () => {
  return expect(1).toBe(1);
});

How to use ​

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny jest/no-test-return-statement --jest-plugin
json
{
  "plugins": ["jest"],
  "rules": {
    "jest/no-test-return-statement": "error"
  }
}

References ​

Released under the MIT License.