Skip to content

jest/no-mocks-import Style

What it does

This rule reports imports from a path containing a mocks component.

Why is this bad?

Manually importing mocks from a __mocks__ directory can lead to unexpected behavior.

Example

Examples of incorrect code for this rule:

ts
import thing from "./__mocks__/index";
require("./__mocks__/index");

Examples of correct code for this rule:

ts
import thing from "thing";
require("thing");

References

Released under the MIT License.