Skip to content

Latest commit

Β 

History

History
378 lines (319 loc) Β· 26.6 KB

CHANGELOG.md

File metadata and controls

378 lines (319 loc) Β· 26.6 KB

Jest Lua Changelog

Unreleased Changes

  • fix warning when multiple configuration are found (#8)
  • fix error message when no tests are found (#7)

3.6.1 (2024-01-16)

  • Re-release of 3.6.0 with widened promise dependency that includes older versions for maximum flexibility (#378)

3.6.0 (2024-01-09)

  • πŸ› οΈ 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 with task.delays (#368)

3.5.0 (2023-11-01)

  • πŸ› οΈ 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 against nil and undefined values

3.4.1 (2023-08-25)

  • πŸ› οΈ 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 through JestBenchmark.benchmark instead of JestBenchmark.benchmark.benchmark

3.4.0 (2023-08-17)

3.3.0 (2023-04-26)

  • ✨ pretty-format: Added printInstanceDefaults 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)

3.2.5 (2023-01-19)

  • πŸ› Fix error when obsolete snapshots and no file system access (#334)

3.2.4 (2023-01-13)

  • πŸ› Fix separateMessageFromStack not working when there is no stack available (#332)

3.2.3 (2023-01-12)

  • πŸ› 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)

3.2.2 (2023-01-04)

  • πŸ› Fix debugging capabilities broken recently (#325)

3.2.1 (2022-12-08)

  • πŸ› Fix loadmodule environment table separation (#320)

3.2.0 (2022-12-06)

  • ✨ Added jest.mock and jest.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

3.1.1 (2022-11-1)

  • πŸ› Fix require throwing on ModuleScripts that return nil and not throwing on ModuleScripts that return multiple values #292

3.1.0 (2022-10-26)

  • πŸ› Fix typing for expect matchers #271
  • ✨ export additional expectExtended from JestGlobals to allow use of custom matchers #271
  • ✨ Added support for expect.resolves and expect.rejects #262
  • ✨ Remove the need for return {} for test files #279

3.0.0 (2022-09-30)

  • ✨ Added expect.assertions(number) and expect.hasAssertions() functions (#256)

3.0.0 rc 1 (2022-09-23)

  • 🚨 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)

3.0.0 rc 0 (2022-09-09)

  • ✨ Added task.delay() and time() 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)

3.0.0 alpha 0 (2022-08-11)

  • ✨ 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)

2.5.0 alpha 0 (2022-06-30)

  • ✨ Port jest-runner (#197)
  • ✨ Port jest-runtime (#178)
  • ✨ Create jest-environment-luau, based on jest-environment-node (#197)
  • πŸ› οΈ Add integration test of ported libraries, using jest's runner to run tests. (#197)

2.4.1 (2022-05-20)

  • πŸ› οΈ Disable chalk-lua when running in Studio environment
  • πŸ› οΈ Extract AssertionError to LuauPolyfill (#186)
  • πŸ› Fix custom throwing matchers failing when throwing strings (#186)
  • πŸ› Fix Jest reporters not reporting test failure to TestService (#188)

2.4.0 (2022-05-18)

  • ✨ 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 and picomatch (#144 #154)
  • πŸ› Clean up assertion errors warning (#181)
  • πŸ› οΈ Apply stylua to the whole repo and enable check on CI (#147)

2.3.1 (2021-11-30)

  • πŸ› Fix error reporters not outputting captured errors when using non-default reporters (#131)

2.3.0 (2021-11-19)

  • ✨ 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 in roact-alignment (#128)

2.2.1 (2021-10-20)

  • πŸ› Check that thrown message is a string when matching against a thrown string (#124)

2.2.0 (2021-10-18)

  • ✨ Introduced strong Luau typing (#102)
  • ✨ Realigned package versions (#102)
    • diff-sequences realigned to v27.2.5
    • jest realigned to v27.2.5
    • jest-diff realigned to v27.2.5
    • jest-fake-timers realigned to v27.0.6
    • jest-matcher-utils realigned to v27.2.5
    • jest-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)

2.1.4 (2021-09-30)

2.1.3 (2021-09-22)

  • πŸ› οΈ Bump LuauPolyfill to 0.2.5 to fix static analysis issues on lua-apps

2.1.2 (2021-09-16)

  • πŸ› οΈ Bump RegExp to 0.1.3 and LuauPolyfill to 0.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

2.1.1 (2021-09-03)

  • πŸ› Resolve dependency cycle in JestSnapshot and Expect

2.1.0 (2021-09-03)

  • ✨ 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/jest-roblox@2.1.0"
    
    local JestDiff = require(Packages.JestDiff)
    
  • 🚨 Due of the above change, JestRoblox is now used by pulling the JestGlobals package in your rotriever.toml:
    • Change your rotriever.toml dependency to
    + JestGlobals = "github.com/Roblox/jest-roblox@2.1.0"
    - JestRoblox = "github.com/Roblox/jest-roblox@2.0.1"
    • Now that the dependency is JestGlobals, you no longer need to get the Globals member of JestRoblox
    + local JestGlobals = require(Packages.JestGlobals)
    + local expect = JestGlobals.expect
    - local JestRoblox = require(Packages.JestRoblox).Globals
    - local expect = JestRoblox.expect
  • πŸ› οΈ 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 where FileSystemService does not exist (#103)
  • πŸ› Fix for snapshot names with special characters (#108)

2.0.1 (2021-08-04)

  • πŸ› Fix for snapshot matchers not correctly throwing when the matcher fails (#92)

2.0.0 (2021-08-02)

  • ✨ 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 be all (by default), or new to only add new snapshots, this can be enabled with an --updateSnapshot flag in Jest Lua CLI
  • 🚨 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 recognize jest.fn as callable (#87)

1.1.2 (2021-06-11)

  • πŸ› Fix for JestSnapshot so that the init file returns a value (#71)

1.1.1 (2021-06-07)

  • πŸ› Fix in getType for objects with a throwing __index metamethod (#69)

1.1.0 (2021-05-28)

  • ✨ Added toStrictEqual matcher
  • 🚨 Changed syntax for intializing mock functions from jest:fn() to jest.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 with nil arguments would not be handled correctly (#53)

1.0.0 (2021-03-30)

  • ✨ 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 from Globals and has the following methods:
      • .fn()
      • .clearAllMocks()
      • .resetAllMocks()
      • .restoreAllMocks()
  • πŸ› οΈ Added Error type to JestGetType (#45)
  • πŸ› Bugfix in .toMatch where strings go into the RegEx check (#41)
  • πŸ› Bugfix for .toThrow not matching Error object with same message (#44)

0.7.1 (2021-03-12)

  • ✨ Added chalk-enabled error output (#38)
  • πŸ› οΈ Added userdata and thread Luau types to JestGetType (#39)
  • πŸ› Fix for checking for an asymmetricMatch method for objects that override __index metamethod (#39)

0.7.0 (2021-03-02)

  • ✨ Added expect.extend() (#35)
  • πŸ› οΈ Added RegExp support to matchers (#32)
  • πŸ› οΈ Added prototype information to matchers (#34)

0.6.0 (2021-02-22)

  • ✨ Added expect().toThrow() (#30)

0.5.0 (2021-01-29)

  • ✨ Initial release of Jest Lua, TestEZ has been rebranded as of this release.
  • ✨ Added expect aligned to Jest's expect (26.5.3)
    • Requires an explicit require from JestRoblox.Globals to use
    • Refer to the Jest documentation on expect for usage documentation. Refer to the README.md in src/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 a asymmetricMatch(self, other) method
    • Negative variants of all the above matchers with the keyword never, i.e. expect().never.toBe() or expect.never.stringContaining()
    • TestEZ expect will be removed soon

TestEZ Changelog

0.4.1 (2020-10-30)

  • afterEach blocks now run their code after it blocks fail or error

0.4.0 (2020-10-02)

  • Added expect.extend which allows projects to register their own, opinionated expectations that integrates into expect. (#142)
    • Modeled after jest's implementation.
    • Matchers are functions that should return an object with with two keys, boolean pass and a string message
    • Like context, matchers introduced via expect.extend will be present on all nodes below the node that introduces the matchers.
    • Limitations:
      • expect.extend cannot be called from within describe 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.
  • Fix debugging of tests in Studio

0.3.3 (2020-09-25)

  • Remove the lifecycle hooks from the session tree. This prevents the [?] spam from the reporter not recognizing these nodes.

0.3.2 (2020-08-10)

  • 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.

0.3.1 (2020-06-22)

  • Further simplify beforeAll handling.
    • beforeAll now runs on entering the block, rather than on the first it encountered after entering the block. The major difference for the moment is that a beforeAll will now run even if there are no it blocks under it, which is now consistent with how afterAll worked.
    • beforeAll and afterAll now report errors by creating a dummy node in the results to contain the error. Previously, errors in afterAll were not reported.
    • A failure in a beforeAll block will now halt all further test execution within its enclosing describe block except for any remaining beforeAll blocks and any afterAll blocks. Multiple beforeAll or afterAll blocks within one describe 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.

0.3.0 (2020-06-12)

  • Remove the try node type.
    • Remove the step alias for it since that's meant for use with try.
  • 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 and it blocks with duplicate descriptions will now not overwrite the earlier copies of those nodes.
    • Duplicate it nodes within one describe will raise an error.
    • TestPlanBuilder was removed from the API.
  • Fixed a bug with how beforeAll and afterAll 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.

0.2.0 (2020-03-04)

  • 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)

0.1.1 (2020-01-23)

  • Added beforeAll, beforeEach, afterEach, afterAll lifecycle hooks for testing
    • The setup and teardown behavior of these hooks attempt to reach feature parity with jest.

0.1.0 (2019-11-01)

  • Initial release.