Skip to content

feat(jest): add no-error-equal rule - #2332

Merged
fansenze merged 2 commits into
mainfrom
feat/port-jest-no-error-equal
Sep 28, 2026
Merged

fansenze merged 2 commits into
mainfrom
feat/port-jest-no-error-equal

Conversation

@elecmonkey

Copy link
Copy Markdown
Member

Motivation

toEqual and toStrictEqual compare errors only by their message, so an assertion on an error can pass even when its type is wrong.

Changes

Add jest/no-error-equal, which reports toEqual and toStrictEqual when the expect() subject has an Error type. The rule requires type information and is not added to the recommended preset, matching upstream.

Credits

Port from eslint-plugin-jest@29.16.6's no-error-equal.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦀📦 Binary size

Commit 8e01a30 merged into base c8bc531 — feat(unicorn): add prefer-array-last-methods rule (#2317).

Binary Base This PR Change
rslint (linux-x64-gnu) 39.47 MiB 39.47 MiB +4.00 KiB (+0.01%)

Stripped go build -ldflags="-s -w" ./cmd/rslint, Go 1.27.0, linux/amd64 · run · 2026-09-28 08:56 UTC

Comment thread internal/plugins/jest/rules/no_error_equal/no_error_equal.md Outdated
@fansenze
fansenze enabled auto-merge (squash) September 28, 2026 08:58
@fansenze
fansenze merged commit 2b81df1 into main Sep 28, 2026
15 checks passed
@fansenze
fansenze deleted the feat/port-jest-no-error-equal branch September 28, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants