| name | jest |
| description | 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.
|
| metadata | {"author":"Christopher Buss","version":"2026.5.4","source":"Generated from https://github.com/Roblox/jest-roblox, scripts located at https://github.com/christopher-buss/skills"} |
Based on Jest Roblox v3.x, generated 2026-02-07.
Jest Roblox is a Luau port of Jest for the Roblox platform. It closely follows
the upstream Jest API but has critical deviations due to Luau language
constraints.
Critical deviations from JS Jest:
.never instead of .not (reserved keyword)
jest.fn() returns two values: mock object + forwarding function
0, "", {} are truthy in Luau (only false and nil are falsy)
- All globals (
describe, expect, jest, etc.) must be explicitly imported
.each uses table syntax, not tagged template literals
- Custom matchers take
self as first parameter
Read core-deviations first when working with
this codebase.
Core References
| Topic | Description | Reference |
|---|
| Deviations | All Luau/Roblox differences from JS Jest | core-deviations |
| Test Structure | describe, test/it, hooks, .each, .only/.skip | core-test-structure |
| Matchers | toBe, toEqual, toContain, toThrow, mock matchers | core-matchers |
| Asymmetric Matchers | expect.anything/any/nothing/callable, .resolves/.rejects | core-asymmetric-matchers |
| Mocking | jest.fn(), spyOn, mock.calls, return values | core-mocking |
| Configuration | jest.config.lua, runCLI, reporters, options | core-configuration |
Features
Testing Patterns
Mocking
Extended Matchers
| Topic | Description | Reference |
|---|
| Jest Extended | When core matchers aren't expressive enough: exact booleans, ranges, membership, entries, call order, side effects | feature-jest-extended |
Advanced
| Topic | Description | Reference |
|---|
| Benchmarking | benchmark(), Reporter, Profiler, CustomReporters | advanced-benchmarking |