jest
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:
.neverinstead of.not(reserved keyword)jest.fn()returns two values: mock object + forwarding function0,"",{}are truthy in Luau (onlyfalseandnilare falsy)- All globals (
describe,expect,jest, etc.) must be explicitly imported .eachuses table syntax, not tagged template literals- Custom matchers take
selfas 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
| Topic | Description | Reference |
|---|---|---|
| Async Testing | Promises, done callbacks, .resolves/.rejects | feature-async-testing |
| Custom Matchers | expect.extend(), self parameter, isNever | feature-custom-matchers |
| Test Filtering | testMatch, testPathPattern, testNamePattern | feature-test-filtering |
Mocking
| Topic | Description | Reference |
|---|---|---|
| Timer Mocks | useFakeTimers, Roblox timers, engineFrameTime | feature-timer-mocks |
| Global Mocks | jest.globalEnv, spyOn globals, library mocks | feature-global-mocks |
| Module Mocking | jest.mock(), isolateModules, resetModules | feature-module-mocking |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Benchmarking | benchmark(), Reporter, Profiler, CustomReporters | advanced-benchmarking |
More from christopher-buss/rbxts-jest-transformer
tsdown
Bundle TypeScript and JavaScript libraries with blazing-fast speed powered by Rolldown. Use when building libraries, generating type declarations, bundling for multiple formats, or migrating from tsup.
1pnpm
Node.js package manager with strict dependency resolution. Use when running
1vitest
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
1roblox-ts
|
1humanizer
|
1isentinel
|
1