Skip to content

jest/no-standalone-expect Correctness

What it does

Prevents expect statements outside of a test or it block. An expect within a helper function (but outside of a test or it block) will not trigger this rule.

Statements like expect.hasAssertions() will NOT trigger this rule since these calls will execute if they are not in a test block.

Example

javascript
describe("a test", () => {
  expect(1).toBe(1);
});

References

Released under the MIT License.