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.
| 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 |
Testen von Roblox/Luau-Code mit Jest Roblox. Verwenden Sie diese Option, wenn Sie Tests schreiben, Funktionen verspotten, Werte bestätigen oder Testsuiten in Luau mit Jest Roblox konfigurieren. NICHT JavaScript Jest – verwendet .never anstelle von .not, jest.fn() gibt zwei Werte zurück, 0 ist wahr. Quelle: christopher-buss/skills.