Skip to content

Files

Latest commit

 

History

History
31 lines (23 loc) · 612 Bytes

valid-describe-callback.md

File metadata and controls

31 lines (23 loc) · 612 Bytes

Pattern: Invalid describe callback

Issue: -

Description

The callback function passed to describe() must be synchronous, have no parameters, and not return any values. Using async callbacks, parameters, or return statements can lead to unexpected test behavior.

Examples

Example of incorrect code:

describe("suite", async () => {
  test("case", () => {});
});

describe("suite", (done) => {
  test("case", () => {});
});

describe("suite", () => 
  test("case", () => {})
);

Example of correct code:

describe("suite", () => {
  test("case", () => {});
});