Skip to content

Commit 0ffeba6

Browse files
author
RoFlection Bot
committed
upgrade jest dep to v3 stable (#76)
1 parent bd091bf commit 0ffeba6

File tree

8 files changed

+13
-21
lines changed

8 files changed

+13
-21
lines changed

rotriever.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ LuauPolyfill = "github.com/roblox/luau-polyfill@1"
1111
LuauRegExp = "github.com/Roblox/luau-regexp@0.2.0"
1212
Chalk = "github.com/roblox/chalk-lua@0.2.0"
1313
Promise = "github.com/roblox/roblox-lua-promise@3.3.0"
14-
JestGetType = "github.com/roblox/jest-roblox@3.0.0-rc.0"
15-
PrettyFormat = "github.com/roblox/jest-roblox@3.0.0-rc.0"
16-
RobloxShared = "github.com/roblox/jest-roblox@3.0.0-rc.0"
17-
JestGlobals = "github.com/roblox/jest-roblox@3.0.0-rc.0"
14+
JestGetType = "github.com/roblox/jest-roblox@3.0.0"
15+
PrettyFormat = "github.com/roblox/jest-roblox@3.0.0"
16+
RobloxShared = "github.com/roblox/jest-roblox@3.0.0"
17+
JestGlobals = "github.com/roblox/jest-roblox@3.0.0"
1818

1919
[dev_dependencies]
20-
Jest = "github.com/roblox/jest-roblox@3.0.0-rc.0"
20+
Jest = "github.com/roblox/jest-roblox@3.0.0"

src/__tests__/events.spec.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ local eventTypes = {
7979
props = { Size = UDim2.new(0, 100, 0, 100), Text = "" },
8080
eventProps = { target = { Text = "NewText" } },
8181
listener = "Changed",
82+
listenTo = "Text",
8283
},
8384
},
8485
},
@@ -125,10 +126,9 @@ Array.forEach(eventTypes, function(ref)
125126
local spy = jest.fn()
126127
connection = node[test.listener]:Connect(function(...)
127128
local args = { ... }
128-
if args[1] and Array.includes({ "Parent", "OverlayNativeInput" }, args[1]) then
129-
return
129+
if args[1] and (test.listenTo == args[1] or not test.listenTo) then
130+
spy()
130131
end
131-
spy()
132132
end)
133133
fireEvent[event.name](node, test.eventProps)
134134
expect(spy).toHaveBeenCalledTimes(1)

src/queries/display-value.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ type Object = LuauPolyfill.Object
77

88
local querySelectorAll = require(script.Parent.Parent.jsHelpers.querySelectors).querySelectorAll
99

10-
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
11-
1210
local exports = {}
1311

1412
local wrapAllByQueryWithSuggestion = require(script.Parent.Parent["query-helpers"]).wrapAllByQueryWithSuggestion

src/queries/placeholder-text.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ local Packages = script.Parent.Parent.Parent
44
local LuauPolyfill = require(Packages.LuauPolyfill)
55
type Array<T> = LuauPolyfill.Array<T>
66

7-
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
8-
97
local exports = {}
108

119
local wrapAllByQueryWithSuggestion = require(script.Parent.Parent["query-helpers"]).wrapAllByQueryWithSuggestion

src/queries/test-id.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ local Packages = script.Parent.Parent.Parent
44
local LuauPolyfill = require(Packages.LuauPolyfill)
55
type Array<T> = LuauPolyfill.Array<T>
66

7-
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
8-
97
local exports = {}
108

119
local checkContainerType = require(script.Parent.Parent.helpers).checkContainerType

src/queries/text.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ local querySelectorsModule = require(script.Parent.Parent.jsHelpers.querySelecto
1010
local matchesInstance = querySelectorsModule.matches
1111
local querySelectorAll = querySelectorsModule.querySelectorAll
1212

13-
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
14-
1513
local exports = {}
1614

1715
local wrapAllByQueryWithSuggestion = require(script.Parent.Parent["query-helpers"]).wrapAllByQueryWithSuggestion

src/types/config.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ type Error = LuauPolyfill.Error
66
type Object = LuauPolyfill.Object
77
type Promise<T> = LuauPolyfill.Promise<T>
88

9-
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
10-
119
-- ROBLOX deviation START: unknown types
1210
type Partial<T> = Object
1311
-- ROBLOX deviation END

src/wait-for.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local clearTimeout = LuauPolyfill.clearTimeout
99
local setInterval = LuauPolyfill.setInterval
1010
local setTimeout = LuauPolyfill.setTimeout
1111
type Error = LuauPolyfill.Error
12+
type Promise<T> = LuauPolyfill.Promise<T>
1213

1314
local Promise = require(Packages.Promise)
1415

@@ -200,16 +201,17 @@ local function waitFor(callback, ref)
200201
-- https://stackoverflow.com/a/59243586/971592
201202
-- eslint-disable-next-line no-await-in-loop
202203
-- ROBLOX deviation START: currently handling Promises but not thenables
203-
local wrapper = advanceTimersWrapper(function()
204+
local wrapper = advanceTimersWrapper(function(): Promise<any>
204205
return Promise.resolve():andThen(function()
205206
Promise.new(function(r)
206207
setTimeout(r, 0)
207208
jest.advanceTimersByTime(0)
208209
end):expect()
209210
end)
210211
end)
211-
if typeof(wrapper.expect) == "function" then
212-
wrapper:expect()
212+
-- ROBLOX FIXME Luau: wrapper type is unknown
213+
if typeof((wrapper :: any).expect) == "function" then
214+
(wrapper :: any):expect()
213215
else
214216
error("advanceTimersWrapper should return a Promise")
215217
end

0 commit comments

Comments
 (0)