- ✨ Added a fallback to use
loadstring
instead ofloadmodule
in lower privileged contexts (#392) - ✨ Added
redactStackTrace
option to improve stability to snapshots that contain stacktraces (#401) - 🛠️ Add more helpful error message when requiring
JestGlobals
outside test environment (#405) - 🛠️ Error when trying to load a nonexistant
PrettyFormat
plugin (#407) - 🛠️ Stabilize
RobloxInstance
serialization tests (#408)
- 🐛 Fix a type analysis error in
JestRuntime
(#403)
- ✨ Support spying on Lua globals with
spyOn
(#397) - 🐛 Expose safe APIs to read and write Roblox Instance properties in the
RobloxInstance
library forPrettyFormat
to serialize Instances safely (#398) - 🛠️ Clean up package manifests, READMEs and documentation (#400 #402)
- 🐛 Fix mismatched test paths between reporter and runner (#396)
- ✨ Mock task.wait (#388)
- ✨ Resolve DOM paths to FS paths if possible in
JestRunner
(#373)
- 🛠️ Re-release of 3.6.0 with widened promise dependency that includes older versions for maximum flexibility (#378)
- 🛠️ Upgrade promise dependency, but keep constraint wide so that all future 3.x versions are valid (#374)
- 🛠️ Fix matching logic for RegExp objects (#371)
- ✨ Added
task.failing
support to easily mark tests that are suppose to fail (#370) - ✨ Added
task.cancel
support to cancel timeouts started withtask.delays
(#368)
- 🛠️ Fix an issue that was hiding error messages in test failure output (#360)
- ✨ Allow toThrow to match on regular expressions if the expected error matches the RegExp type (has a test and exec function) (#357)
- ✨ Add nil asymmetric matcher
expect.nothing()
to match againstnil
and undefined values
- 🛠️ Relax requirement to report a value in a JestBenchmark profiler section
- 🛠️ Catch error in JestBenchmark.HeartbeatReporter when a heartbeat occurs outside of a reporting section
- 🛠️ Export
benchmark
throughJestBenchmark.benchmark
instead ofJestBenchmark.benchmark.benchmark
- ✨ Added the JestBenchmark module
- 🛠️ Upgrade to v28.0.0 (#266)
- ✨
pretty-format
: AddedprintInstanceDefaults
formatting option that toggles whether unmodified Instance properties are printed (#341) - ✨ Added
snapshotFormat
configuration option (#341) - ✨ Added support for a configurable engine frame time for fake timers (#343)
- 🐛 Fix error when obsolete snapshots and no file system access (#334)
- 🐛 Fix separateMessageFromStack not working when there is no stack available (#332)
- 🐛 Fix missing stacktraces when throwing bare strings (#324)
- 🐛 Fix bad error message when test contains syntax error (#326)
- 🐛 Fix setTimeout not mocked with useFakeTimers() (#329)
- 🐛 Fix debugging capabilities broken recently (#325)
- 🐛 Fix
loadmodule
environment table separation (#320)
- ✨ Added
jest.mock
andjest.unmock
(#243) - ✨ Added
jest.requireActual
(#294) - ✨ Jest runner caches loaded module functions to improve runtime (#317)
- 🐛 Fixes error when no config is provided (#314)
- 🛠️ Realigned packages
- 🐛 Fix
require
throwing on ModuleScripts thatreturn nil
and not throwing on ModuleScripts that return multiple values #292
- 🐛 Fix typing for expect matchers #271
- ✨ export additional
expectExtended
fromJestGlobals
to allow use of custom matchers #271 - ✨ Added support for
expect.resolves
andexpect.rejects
#262 - ✨ Remove the need for
return {}
for test files #279
- ✨ Added
expect.assertions(number)
andexpect.hasAssertions()
functions (#256)
- 🚨
jest.resetSnapshotSerializer
removed (#253) - 🐛 Fix
PrettyFormatPluginError
not throwing on invalid plugins (#250) - 🐛 Fix
snapshotSerializers
config option not working (#251) - 🐛 Fix crash when no tests are discovered (#252)
- 🐛 Fix
testPathIgnorePatterns
config option crashing (#259)
- ✨ Added
task.delay()
andtime()
as fake timers (#242) - 🐛 Fix test result message for failing test (#237)
- 🐛 Fix
testNamePattern
config value (#232) - 🐛 Fix
.each
for template syntax (#246) - 🛠️ Update LuauPolyfill to v1.0.0 (#237)
- 🛠️ Update Roact to v17.0.1-rc.16 (#237)
- 🛠️ Explicitly license files (#235)
- ✨ Port
jest-config
(#203) - ✨ Port
jest-core
(#203) - ✨ Port
jest-validate
(#203) - 🛠️ Adjust other modules to work with
jest-core
(#203) - 🛠️ Update LuauPolyfill to v0.4.1 (#215)
- 🛠️ Update Roact to v17.0.1-rc.13 (#215)
- 🛠️ Update Picomatch to v0.3.0 (#215)
- ✨ Port
jest-runner
(#197) - ✨ Port
jest-runtime
(#178) - ✨ Create
jest-environment-luau
, based onjest-environment-node
(#197) - 🛠️ Add integration test of ported libraries, using jest's runner to run tests. (#197)
- 🛠️ Disable
chalk-lua
when running in Studio environment - 🛠️ Extract
AssertionError
toLuauPolyfill
(#186) - 🐛 Fix custom throwing matchers failing when throwing strings (#186)
- 🐛 Fix Jest reporters not reporting test failure to
TestService
(#188)
- ✨ Added adapters for Jest reporters (#179)
- Added ability to pipe together reporters
- ✨ Added ReactTestComponent serializer (#174)
- ✨ Added React element serializer (#170)
- ✨ Port
jest-reporters
(#167) - ✨ Port
jest-console
(#157) - ✨ Port
jest-test-result
(#155) - ✨ Port
jest-types
(#137) - ✨ Realigned package versions to v27.4.7 (#135)
- ✨ Port
jest-environment
(#139) - ✨ Port
jest-each
(#145 #158)- Support array like tables
- Support template like tables
- ✨ Port
jest-util
andpicomatch
(#144 #154) - 🐛 Clean up assertion errors warning (#181)
- 🛠️ Apply
stylua
to the whole repo and enable check on CI (#147)
- 🐛 Fix error reporters not outputting captured errors when using non-default reporters (#131)
- ✨ Added support for Roblox Instance objects (#127)
- Added object serialization for Instances
- Added
.toMatchInstance
matcher to match against Instances .toMatchSnapshot
now serializes and matches against Instances
- 🛠️
jest.fn()
additionally returns a forwarding function for tests that require a mock to be a function - 🛠️ Test reporter is now colorized and reports name of the failing test (#126)
- 🐛 Fix for a bug with throwing matchers and the
Error
polyfill inroact-alignment
(#128)
- 🐛 Check that thrown message is a string when matching against a thrown string (#124)
- ✨ Introduced strong Luau typing (#102)
- ✨ Realigned package versions (#102)
diff-sequences
realigned to v27.2.5jest
realigned to v27.2.5jest-diff
realigned to v27.2.5jest-fake-timers
realigned to v27.0.6jest-matcher-utils
realigned to v27.2.5jest-snapshot
realigned to v27.0.6
- 🐛 Fix for
expect.any
not working with Roblox datatypes (#119) - 🐛 Lazy initialize
game:GetService
calls to avoid throwing in debugger (#122) - 🐛 Fix missing stacktrace entries in nested pcalls (#121)
- ✨ Added support and better output for Roblox datatypes (#117)
- 🛠️ Bump
LuauPolyfill
to0.2.5
to fix static analysis issues onlua-apps
- 🛠️ Bump
RegExp
to0.1.3
andLuauPolyfill
to0.2.4
to remove test files from cached versions - 🛠️ Republish with rotriever
0.5.0-rc.4
to remove tests from rotriever cache - 🛠️ Add typing for
RegExp
- 🐛 Resolve dependency cycle in
JestSnapshot
andExpect
- ✨ Changed project structure to use rotriever
0.5.0
workspaces (#96)- This allows downstream projects to pull individual
JestRoblox
packages as dependencies - For example, to pull the
JestDiff
package as a dependency:
JestDiff = "github.com/Roblox/[email protected]" local JestDiff = require(Packages.JestDiff)
- This allows downstream projects to pull individual
- 🚨 Due of the above change,
JestRoblox
is now used by pulling theJestGlobals
package in yourrotriever.toml
:- Change your
rotriever.toml
dependency to
+ JestGlobals = "github.com/Roblox/[email protected]" - JestRoblox = "github.com/Roblox/[email protected]"
- Now that the dependency is
JestGlobals
, you no longer need to get theGlobals
member ofJestRoblox
+ local JestGlobals = require(Packages.JestGlobals) + local expect = JestGlobals.expect - local JestRoblox = require(Packages.JestRoblox).Globals - local expect = JestRoblox.expect
- Change your
- 🛠️ Support for named functions in error output (#95)
- 🛠️ Support for
LuauPolyfill
Set
object in matchers (#101) - 🛠️ Remove unhelpful lines in error stacktraces (#105)
- 🐛 Fix for snapshot property matchers not working (#93)
- 🐛 Fix snapshot path resolution for snapshot updates on windows (#97)
- 🐛 Fix for
JestSnapshot
throwing in environments whereFileSystemService
does not exist (#103) - 🐛 Fix for snapshot names with special characters (#108)
- 🐛 Fix for snapshot matchers not correctly throwing when the matcher fails (#92)
- ✨ Added
JestSnapshot
functionality- Added
toMatchSnapshot
matcher - Added
toThrowErrorMatchingSnapshot
matcher - Added custom snapshot matchers and property matchers, refer to the "Snapshot Testing" section of the documentation for more info
- Added
UPDATESNAPSHOT
flag for updating snapshots, the value can either beall
(by default), ornew
to only add new snapshots, this can be enabled with an--updateSnapshot
flag in Jest Roblox CLI
- Added
- 🚨 Removed colon syntax alias for initializing mock functions
- 🛠️
--fastFlags.overrides "UseDateTimeType3=true"
removed as it is no longer needed - 🐛 Fix issue with CoreScriptConverter and the Modules directory (#79)
- 🐛 Fix for chalked strings throwing when used with string matchers (#85)
- 🐛
.toThrow
matchers now recognizejest.fn
as callable (#87)
- 🐛 Fix for
JestSnapshot
so that the init file returns a value (#71)
- 🐛 Fix in
getType
for objects with a throwing__index
metamethod (#69)
- ✨ Added
toStrictEqual
matcher - 🚨 Changed syntax for intializing mock functions from
jest:fn()
tojest.fn()
(the colon syntax is left in for compatibility but will be removed in 2.0) - 🚨
RegExp
is pulled out from the LuauPolyfill repo into a separate LuauRegExp repo and lazily loaded (#62) - 🛠️ Added instantiating mock function instance with
mockFn.new()
(#52) - 🛠️ Changed the
ArrayContaining
asymmetric matcher to output curly braces instead of square brackets (#55) - 🛠️ Added proper output formatting for Roblox
Instance
types (#64) - 🐛 Bugfix in
SpyMatchers
where function calls withnil
arguments would not be handled correctly (#53)
- ✨ Added spyMatchers
expect().lastCalledWith() also aliased as expect().toHaveBeenLastCalledWith()
expect().lastReturnedWith() also aliased as expect().toHaveLastReturnedWith()
expect().nthCalledWith() also aliased as expect().toHaveBeenNthCalledWith()
expect().nthReturnedWith() also aliased as expect().toHaveNthReturnedWith()
expect().toBeCalled() also aliased as expect().toHaveBeenCalled()
expect().toBeCalledTimes() also aliased as expect().toHaveBeenCalledTimes()
expect().toBeCalledWith() also aliased as expect().toHaveBeenCalledWith()
expect().toReturn() also aliased as expect().toHaveReturned()
expect().toReturnTimes() also aliased as expect().toHaveReturnedTimes()
expect().toReturnWith() also aliased as expect().toHaveReturnedWith()
- ✨ Added basic
JestMock
functionality- The
jest
object can be imported fromGlobals
and has the following methods:.fn()
.clearAllMocks()
.resetAllMocks()
.restoreAllMocks()
- The
- 🛠️ Added
Error
type toJestGetType
(#45) - 🐛 Bugfix in
.toMatch
where strings go into the RegEx check (#41) - 🐛 Bugfix for
.toThrow
not matchingError
object with same message (#44)
- ✨ Added chalk-enabled error output (#38)
- 🛠️ Added
userdata
andthread
Luau types toJestGetType
(#39) - 🐛 Fix for checking for an
asymmetricMatch
method for objects that override__index
metamethod (#39)
- ✨ Added
expect.extend()
(#35) - 🛠️ Added
RegExp
support to matchers (#32) - 🛠️ Added prototype information to matchers (#34)
- ✨ Added
expect().toThrow()
(#30)
- ✨ Initial release of Jest Roblox, TestEZ has been rebranded as of this release.
- ✨ Added
expect
aligned to Jest's expect (26.5.3)- Requires an explicit
require
fromJestRoblox.Globals
to use - Refer to the Jest documentation on expect for usage documentation. Refer to the
README.md
insrc/Modules/expect
for details on deviations from upstream expect
matchers added:
expect().toBe() expect().toBeCloseTo() expect().toBeDefined() expect().toBeFalsy() expect().toBeGreaterThan() expect().toBeGreaterThanOrEqual() expect().toBeInstanceOf() expect().toBeLessThan() expect().toBeLessThanOrEqual() expect().toBeNan() (aliased as toBeNaN) expect().toBeNil() (aliased as toBeNull) expect().toBeTruthy() expect().toBeUndefined() expect().toContain() expect().toContainEqual() expect().toEqual() expect().toHaveLength() expect().toHaveProperty() expect().toMatch() expect().toMatchObject()
asymmetricMatchers
added:
expect.any() expect.anything() expect.arrayContaining() expect.arrayNotContaining() expect.objectContaining() expect.objectNotContaining() expect.stringContaining() expect.stringNotContaining() expect.stringMatching() expect.stringNotMatching()
- Custom
asymmetricMatchers
for any objects with aasymmetricMatch(self, other)
method - Negative variants of all the above matchers with the keyword
never
, i.e.expect().never.toBe()
orexpect.never.stringContaining()
- TestEZ
expect
will be removed soon
- Requires an explicit
afterEach
blocks now run their code afterit
blocks fail or error
- Added
expect.extend
which allows projects to register their own, opinionated expectations that integrates intoexpect
. (#142)- Modeled after jest's implementation.
- Matchers are functions that should return an object with with two keys, boolean
pass
and a stringmessage
- Like
context
, matchers introduced viaexpect.extend
will be present on all nodes below the node that introduces the matchers. - Limitations:
expect.extend
cannot be called from withindescribe
blocks- Custom matcher names cannot overwrite pre-existing matchers, including default matchers and matchers introduces from previous
expect.extend
calls.
- Change the way errors are collected to call tostring on them before further processing.
- Luau allows non-string errors, but not concatenating non-strings or passing non-strings to
debug.traceback
as a message, so TestRunner needs to do that step. This is a temporary fix as the better solution would be to retain the error in object form for as long as possible to give the reporter more to work with. - This also makes a slight change to what's in the traceback to eliminate the unnecessary line mentioning the error collection function.
- Luau allows non-string errors, but not concatenating non-strings or passing non-strings to
- Fix debugging of tests in Studio
- Remove the lifecycle hooks from the session tree. This prevents the
[?]
spam from the reporter not recognizing these nodes.
- Some cleanup of the TestEZ CLI internals
- Added the ability to pass in a string to expect.to.throw. This will search the error message for a matching substring and report a failure if it's not there.
- Further simplify
beforeAll
handling.beforeAll
now runs on entering the block, rather than on the firstit
encountered after entering the block. The major difference for the moment is that abeforeAll
will now run even if there are noit
blocks under it, which is now consistent with howafterAll
worked.beforeAll
andafterAll
now report errors by creating a dummy node in the results to contain the error. Previously, errors inafterAll
were not reported.- A failure in a
beforeAll
block will now halt all further test execution within its enclosingdescribe
block except for any remainingbeforeAll
blocks and anyafterAll
blocks. MultiplebeforeAll
orafterAll
blocks within onedescribe
block should not count on running in any specific order.afterAll
blocks should account for the possibility of a partially setup state when cleaning up.
- Add a context object visible from lifecycle hooks and
it
blocks. This is a write-once store for whatever you need to communicate between hooks and tests. It can be ignored until you need it.- In particular, you can usually just use upvalues to comminucate between hooks and tests, but that won't work if your hooks are in a separate file (e.g.
init.spec.lua
). - Also, this provides a cleaner alternative to extraEnvironment for passing along helper functions to large numbers of tests as the context can be scoped to particular directories as needed.
- In particular, you can usually just use upvalues to comminucate between hooks and tests, but that won't work if your hooks are in a separate file (e.g.
- Remove the
try
node type.- Remove the
step
alias forit
since that's meant for use withtry
.
- Remove the
- Remove the
include
global function. - Remove
HACK_NO_XPCALL
. With recent changes to the definition of xpcall, this is no longer necessary. Since people are still using it, it will now print out a warning asking them to delete that call instead. - Major changes to the internals of test planning.
- The major visible change is that
describe
andit
blocks with duplicate descriptions will now not overwrite the earlier copies of those nodes. - Duplicate
it
nodes within onedescribe
will raise an error. - TestPlanBuilder was removed from the API.
- The major visible change is that
- Fixed a bug with how
beforeAll
andafterAll
handled nested nodes. - Implemented alphabetical sorting of the entire test tree which provides deterministic tests execution order regardless of platform, architecture or tool used to load tests.
- Fixed interactions with roblox-cli in TestEZ CLI.
- Added support for init.spec.lua. Code in this file is treated as belonging to the directory's node in the test tree. This allows for lifecycle hooks to be attached to all files in a directory.
- Added TestEZ CLI, a Rust tool that bundles TestEZ and Lemur, and can run tests via Lemur or Roblox-CLI (#61)
- Added beforeAll, beforeEach, afterEach, afterAll lifecycle hooks for testing
- The setup and teardown behavior of these hooks attempt to reach feature parity with jest.
- Initial release.