Hub rules-jest

rules-jest

v3 public Verified

Jest

Jest is a delightful JavaScript Testing Framework with a focus on simplicity, working with projects using Babel, TypeScript, Node, React, and more. These rules govern unit testing, mocking strategies, and test coverage for AI agents.

@sigmashakeinc 2 pulls 7 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-jest →
Severity
2 error 4 warn 1 info
demo.cast
Jest is a delightful JavaScript Testing Framework with a focus on simplicity, working with projects using Babel, TypeScript, Node, React, and more. These rules govern unit testing, mocking strategies, and test coverage for AI agents.

Rules index

7 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

jest

jest-block-unsafe-patterns warning ask

Potentially unsafe pattern detected in jest code: "jest.disableAutomock()". Review the use case — this may indicate a security risk, a deprecated API, or a misconfiguration. Confirm the write is intentional.

Rule source requires an active Pro or Enterprise subscription.
jest-deprecated-add-matchers info log

jest.addMatchers() is removed in Jest 27+. Use expect.extend({ myMatcher(received, expected) { ... } }) instead.

Rule source requires an active Pro or Enterprise subscription.
jest-no-global-state-mutation warning log

Mutating global/globalThis in tests causes test-order-dependent failures. Use jest.spyOn, jest.fn(), or beforeEach/afterEach to scope mock state, and restore in afterEach or with jest.restoreAllMocks().

Rule source requires an active Pro or Enterprise subscription.
jest-no-hardcoded-secrets-in-tests error log

Hardcoded credential in test code — test files are committed to version control and often lack the same access controls as production configs. Use jest environment variables via a .env.test file (not committed) or mock the credential entirely.

Rule source requires an active Pro or Enterprise subscription.
jest-no-only-in-ci error block

.only / fdescribe / fit causes all other tests in the file to be silently skipped in CI, giving a false green. Remove .only before committing — use a focused test runner invocation locally instead.

Rule source requires an active Pro or Enterprise subscription.
jest-no-real-timers-in-async-tests warning log

Real setTimeout() with long delays slows CI and is non-deterministic under load. Use jest.useFakeTimers() and jest.advanceTimersByTime() to control time in tests without wall-clock waiting.

Rule source requires an active Pro or Enterprise subscription.
jest-no-skip-in-ci warning log

Skipped test detected. Skipped tests mask regressions and accumulate silently over time. Fix or delete failing tests rather than skipping them. If temporarily necessary, add a tracking issue reference in a comment.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Nov 22, 2026
Hash
ba81312432cba686c5c7c91bca2b7757a0012f0f96b53fc8e5dac953efe433ec
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-jest/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-jest. The published version only bumps when a maintainer resyncs.

No commit history available.