1---2name: jest-33description: Write tests, mock functions, assert values, and configure test suites for Roblox/Luau code using Jest Roblox — a Luau port whose API diverges from JS Jest in subtle, non-obvious ways that LLM training data does not cover. Use whenever encountering Jest in Roblox/Luau code: editing .spec test files, calling jest.fn/jest.mock/spyOn, using describe/it/expect, or debugging Jest tests.4---56> Based on Jest Roblox v3.x, generated 2026-02-07.78Jest Roblox is a Luau port of Jest for the Roblox platform. It closely follows9the upstream Jest API but has critical deviations due to Luau language10constraints.1112**Critical deviations from JS Jest:**1314- `.never` instead of `.not` (reserved keyword)15- `jest.fn()` returns **two values**: mock object + forwarding function16- `0`, `""`, `{}` are **truthy** in Luau (only `false` and `nil` are falsy)17- All globals (`describe`, `expect`, `jest`, etc.) must be explicitly imported18- `.each` uses table syntax, not tagged template literals19- Custom matchers take `self` as first parameter2021Read [core-deviations](references/core-deviations.md) first when working with22this codebase.2324## Core References2526| Topic | Description | Reference |27| ------------------- | -------------------------------------------------------- | ------------------------------------------------------------------ |28| Deviations | All Luau/Roblox differences from JS Jest | [core-deviations](references/core-deviations.md) |29| Test Structure | describe, test/it, hooks, .each, .only/.skip | [core-test-structure](references/core-test-structure.md) |30| Matchers | toBe, toEqual, toContain, toThrow, mock matchers | [core-matchers](references/core-matchers.md) |31| Asymmetric Matchers | expect.anything/any/nothing/callable, .resolves/.rejects | [core-asymmetric-matchers](references/core-asymmetric-matchers.md) |32| Mocking | jest.fn(), spyOn, mock.calls, return values | [core-mocking](references/core-mocking.md) |33| Configuration | jest.config.lua, runCLI, reporters, options | [core-configuration](references/core-configuration.md) |3435## Features3637### Testing Patterns3839| Topic | Description | Reference |40| ---------------- | ----------------------------------------------- | ------------------------------------------------------------------ |41| Async Testing | Promises, done callbacks, .resolves/.rejects | [feature-async-testing](references/feature-async-testing.md) |42| Custom Matchers | expect.extend(), self parameter, isNever | [feature-custom-matchers](references/feature-custom-matchers.md) |43| Snapshot Testing | toMatchSnapshot, property matchers, serializers | [feature-snapshot-testing](references/feature-snapshot-testing.md) |44| Test Filtering | testMatch, testPathPattern, testNamePattern | [feature-test-filtering](references/feature-test-filtering.md) |4546### Mocking4748| Topic | Description | Reference |49| -------------- | --------------------------------------------- | -------------------------------------------------------------- |50| Timer Mocks | useFakeTimers, Roblox timers, engineFrameTime | [feature-timer-mocks](references/feature-timer-mocks.md) |51| Global Mocks | jest.globalEnv, spyOn globals, library mocks | [feature-global-mocks](references/feature-global-mocks.md) |52| Module Mocking | jest.mock(), isolateModules, resetModules | [feature-module-mocking](references/feature-module-mocking.md) |5354### Extended Matchers5556| Topic | Description | Reference |57| ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------- |58| Jest Extended | When core matchers aren't expressive enough: exact booleans, ranges, membership, entries, call order, side effects | [feature-jest-extended](references/feature-jest-extended.md) |5960### Advanced6162| Topic | Description | Reference |63| ------------ | ------------------------------------------------ | ------------------------------------------------------------ |64| Benchmarking | benchmark(), Reporter, Profiler, CustomReporters | [advanced-benchmarking](references/advanced-benchmarking.md) |