jest/prefer-strict-equal
eslint-plugin-jest
Suggestion
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/prefer-strict-equal": "error",
},
},
];expect({ a: "a", b: undefined }).toEqual({ a: "a" });expect(user).not.toEqual(otherUser);await expect(loadUser()).resolves.toEqual({ name: "Ada" });expect({ a: "a", b: undefined }).toStrictEqual({ a: "a", b: undefined });
expect(user).not.toStrictEqual(otherUser);
await expect(loadUser()).resolves.toStrictEqual({ name: "Ada" });Examples from the Biome documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
jest/prefer-strict-equal
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/prefer-strict-equal": "error",
},
},
];jest/prefer-strict-equal
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/prefer-strict-equal": "error"
}
}nursery/useExpectToStrictEqual
nursery · since 2.6.9
{
"linter": {
"rules": {
"nursery": {
"useExpectToStrictEqual": "error"
}
}
}
}Suggest using toHaveBeenCalledTimes()