Skip to content

Commit b735430

Browse files
author
RoFlection Bot
committed
Enable ci (#63)
1 parent 35a5ddd commit b735430

File tree

9 files changed

+58
-105
lines changed

9 files changed

+58
-105
lines changed

foreman.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tools]
2+
rojo = { source = "rojo-rbx/rojo", version = "7.2.1" }
23
rotrieve = { source = "roblox/rotriever", version = "0.5.4" }
34
selene = { source = "Kampfkarren/selene", version = "0.20.0" }
4-
stylua = { source = "JohnnyMorganz/StyLua", version = "=0.13.1" }
5+
stylua = { source = "JohnnyMorganz/StyLua", version = "0.14.2" }

src/__tests__/wait-for.spec.lua

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ test("can timeout after the given timeout time", function()
7373
:andThen(function()
7474
local error_ = Error.new("throws every time")
7575
local result = waitFor(function()
76-
error(error_)
77-
end, { timeout = 8, interval = 5 })
76+
error(error_)
77+
end, { timeout = 8, interval = 5 })
7878
:catch(function(e)
7979
return e
8080
end)
@@ -87,15 +87,15 @@ test("if no error is thrown then throws a timeout error", function()
8787
return Promise.resolve()
8888
:andThen(function()
8989
local result = waitFor(function()
90-
-- eslint-disable-next-line no-throw-literal
91-
error(nil)
92-
end, {
93-
timeout = 8,
94-
interval = 5,
95-
onTimeout = function(e)
96-
return e
97-
end,
98-
})
90+
-- eslint-disable-next-line no-throw-literal
91+
error(nil)
92+
end, {
93+
timeout = 8,
94+
interval = 5,
95+
onTimeout = function(e)
96+
return e
97+
end,
98+
})
9999
:catch(function(e)
100100
return e
101101
end)
@@ -110,9 +110,9 @@ test("if showOriginalStackTrace on a timeout error then the stack trace does not
110110
return Promise.resolve()
111111
:andThen(function()
112112
local result = waitFor(function()
113-
-- eslint-disable-next-line no-throw-literal
114-
error(nil)
115-
end, { timeout = 8, interval = 5, showOriginalStackTrace = true })
113+
-- eslint-disable-next-line no-throw-literal
114+
error(nil)
115+
end, { timeout = 8, interval = 5, showOriginalStackTrace = true })
116116
:catch(function(e)
117117
return e
118118
end)
@@ -128,8 +128,8 @@ test("uses full stack error trace when showOriginalStackTrace present", function
128128
error_.name = "TestingLibraryElementError"
129129
local originalStackTrace = error_.stack
130130
local result = waitFor(function()
131-
error(error_)
132-
end, { timeout = 8, interval = 5, showOriginalStackTrace = true })
131+
error(error_)
132+
end, { timeout = 8, interval = 5, showOriginalStackTrace = true })
133133
:catch(function(e)
134134
return e
135135
end)
@@ -144,8 +144,8 @@ test("does not change the stack trace if the thrown error is not a TestingLibrar
144144
local error_ = Error.new("Throws the full stack trace")
145145
local originalStackTrace = error_.stack
146146
local result = waitFor(function()
147-
error(error_)
148-
end, { timeout = 8, interval = 5 })
147+
error(error_)
148+
end, { timeout = 8, interval = 5 })
149149
:catch(function(e)
150150
return e
151151
end)
@@ -161,8 +161,8 @@ test("provides an improved stack trace if the thrown error is a TestingLibraryEl
161161
error_.name = "TestingLibraryElementError"
162162
local originalStackTrace = error_.stack
163163
local result = waitFor(function()
164-
error(error_)
165-
end, { timeout = 8, interval = 5 })
164+
error(error_)
165+
end, { timeout = 8, interval = 5 })
166166
:catch(function(e)
167167
return e
168168
end)
@@ -195,8 +195,8 @@ test("timeout logs a pretty DOM", function()
195195
renderIntoDocument({ div })
196196
-- ROBLOX deviation END
197197
local error_ = waitFor(function()
198-
error(Error.new("always throws"))
199-
end, { timeout = 1 })
198+
error(Error.new("always throws"))
199+
end, { timeout = 1 })
200200
:catch(function(e)
201201
return e
202202
end)
@@ -310,8 +310,8 @@ test("should delegate to config.getElementError", function()
310310
div.Name = "pretty"
311311
renderIntoDocument({ div })
312312
local error_ = waitFor(function()
313-
error(Error.new("always throws"))
314-
end, { timeout = 1 })
313+
error(Error.new("always throws"))
314+
end, { timeout = 1 })
315315
:catch(function(e)
316316
return e
317317
end)

src/jsHelpers/__tests__/babel-code-frame.spec.lua

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,8 @@ describe("@babel/code-frame", function()
187187
)
188188
end)
189189
test("opts.linesAbove no lines above", function()
190-
local rawLines = Array.join(
191-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
192-
"\n"
193-
)
190+
local rawLines =
191+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
194192
expect(codeFrameColumns(rawLines, { start = { line = 2 } }, { linesAbove = 0 })).toEqual(Array.join({
195193
"> 2 | constructor() {",
196194
" 3 | console.log(arguments);",
@@ -199,19 +197,15 @@ describe("@babel/code-frame", function()
199197
}, "\n"))
200198
end)
201199
test("opts.linesBelow no lines below", function()
202-
local rawLines = Array.join(
203-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
204-
"\n"
205-
)
200+
local rawLines =
201+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
206202
expect(codeFrameColumns(rawLines, { start = { line = 2 } }, { linesBelow = 0 })).toEqual(
207203
Array.join({ " 1 | class Foo {", "> 2 | constructor() {" }, "\n")
208204
)
209205
end)
210206
test("opts.linesBelow single line", function()
211-
local rawLines = Array.join(
212-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
213-
"\n"
214-
)
207+
local rawLines =
208+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
215209
expect(codeFrameColumns(rawLines, { start = { line = 2 } }, { linesAbove = 0, linesBelow = 0 })).toEqual(
216210
Array.join({ "> 2 | constructor() {" }, "\n")
217211
)
@@ -278,10 +272,8 @@ describe("@babel/code-frame", function()
278272
)
279273
end)
280274
test("mark multiple columns across multiple lines", function()
281-
local rawLines = Array.join(
282-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
283-
"\n"
284-
)
275+
local rawLines =
276+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
285277
expect(codeFrameColumns(rawLines, { start = { line = 2, column = 17 }, ["end"] = { line = 4, column = 3 } })).toEqual(
286278
Array.join({
287279
" 1 | class Foo {",
@@ -296,10 +288,8 @@ describe("@babel/code-frame", function()
296288
)
297289
end)
298290
test("mark across multiple lines without columns", function()
299-
local rawLines = Array.join(
300-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
301-
"\n"
302-
)
291+
local rawLines =
292+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
303293
expect(codeFrameColumns(rawLines, { start = { line = 2 }, ["end"] = { line = 4 } })).toEqual(Array.join({
304294
" 1 | class Foo {",
305295
"> 2 | constructor() {",
@@ -326,10 +316,8 @@ describe("@babel/code-frame", function()
326316
)
327317
end)
328318
test("opts.message with multiple lines", function()
329-
local rawLines = Array.join(
330-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
331-
"\n"
332-
)
319+
local rawLines =
320+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
333321
expect(
334322
codeFrameColumns(
335323
rawLines,
@@ -348,10 +336,8 @@ describe("@babel/code-frame", function()
348336
}, "\n"))
349337
end)
350338
test("opts.message with multiple lines without columns", function()
351-
local rawLines = Array.join(
352-
{ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" },
353-
"\n"
354-
)
339+
local rawLines =
340+
Array.join({ "class Foo {", " constructor() {", " console.log(arguments);", " }", "};" }, "\n")
355341
expect(
356342
codeFrameColumns(
357343
rawLines,

src/jsHelpers/babel-code-frame.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ local function codeFrameColumns(rawLines: string, loc: NodeLocation, opts_: Opti
188188
if Array.isArray(hasMarker) then
189189
-- ROBLOX FIXME Luau: Already checked hasMarker is an Array
190190
local markerSpacing =
191-
string.sub(line, 1, math.max((hasMarker :: Array<number>)[1] - 1, 0)):gsub(
192-
"[^\t]",
193-
" "
194-
)
191+
string.sub(line, 1, math.max((hasMarker :: Array<number>)[1] - 1, 0)):gsub("[^\t]", " ")
195192
local numberOfMarkers = if (hasMarker :: Array<number>)[2] > 1
196193
then (hasMarker :: Array<number>)[2]
197194
else 1

src/queries/display-value.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,11 @@ function getMissingError(c, value)
6767
return ("Unable to find an element with the display value: %s."):format(tostring(value))
6868
end
6969

70-
local queryAllByDisplayValueWithSuggestions = wrapAllByQueryWithSuggestion(
71-
queryAllByDisplayValue,
72-
debug.info(queryAllByDisplayValue, "n"),
73-
"queryAll"
74-
)
70+
local queryAllByDisplayValueWithSuggestions =
71+
wrapAllByQueryWithSuggestion(queryAllByDisplayValue, debug.info(queryAllByDisplayValue, "n"), "queryAll")
7572
-- ROBLOX deviation START: buildQueries returns a list
7673
local queryByDisplayValue, getAllByDisplayValue, getByDisplayValue, findAllByDisplayValue, findByDisplayValue =
77-
buildQueries(
78-
queryAllByDisplayValue,
79-
getMultipleError,
80-
getMissingError
81-
)
74+
buildQueries(queryAllByDisplayValue, getMultipleError, getMissingError)
8275
--ROBLOX deviation END
8376
exports.queryByDisplayValue = queryByDisplayValue
8477
exports.queryAllByDisplayValue = queryAllByDisplayValueWithSuggestions

src/queries/placeholder-text.lua

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,12 @@ function getMissingError(c, text)
3333
return ("Unable to find an element with the placeholder text of: %s"):format(tostring(text))
3434
end
3535

36-
local queryAllByPlaceholderTextWithSuggestions = wrapAllByQueryWithSuggestion(
37-
queryAllByPlaceholderText,
38-
debug.info(queryAllByPlaceholderText, "n"),
39-
"queryAll"
40-
)
36+
local queryAllByPlaceholderTextWithSuggestions =
37+
wrapAllByQueryWithSuggestion(queryAllByPlaceholderText, debug.info(queryAllByPlaceholderText, "n"), "queryAll")
4138

4239
-- ROBLOX deviation START: buildQueries returns a list
4340
local queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText =
44-
buildQueries(
45-
queryAllByPlaceholderText,
46-
getMultipleError,
47-
getMissingError
48-
)
41+
buildQueries(queryAllByPlaceholderText, getMultipleError, getMissingError)
4942
--ROBLOX deviation END
5043

5144
exports.queryByPlaceholderText = queryByPlaceholderText

src/queries/test-id.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,12 @@ function getMissingError(c, id)
3838
return ('Unable to find an element by: [%s="%s"]'):format(getTestIdAttribute(), tostring(id))
3939
end
4040

41-
local queryAllByTestIdWithSuggestions = wrapAllByQueryWithSuggestion(
42-
queryAllByTestId,
43-
debug.info(queryAllByTestId, "n"),
44-
"queryAll"
45-
)
41+
local queryAllByTestIdWithSuggestions =
42+
wrapAllByQueryWithSuggestion(queryAllByTestId, debug.info(queryAllByTestId, "n"), "queryAll")
4643

4744
-- ROBLOX deviation START: buildQueries returns a list
48-
local queryByTestId, getAllByTestId, getByTestId, findAllByTestId, findByTestId = buildQueries(
49-
queryAllByTestId,
50-
getMultipleError,
51-
getMissingError
52-
)
45+
local queryByTestId, getAllByTestId, getByTestId, findAllByTestId, findByTestId =
46+
buildQueries(queryAllByTestId, getMultipleError, getMissingError)
5347
-- ROBLOX deviation END
5448

5549
exports.queryByTestId = queryByTestId

src/queries/text.lua

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,12 @@ function getMissingError(c, text: Matcher, options_: SelectorMatcherOptions?)
9393
)
9494
)
9595
end
96-
local queryAllByTextWithSuggestions = wrapAllByQueryWithSuggestion(
97-
queryAllByText,
98-
debug.info(queryAllByText, "n"),
99-
"queryAll"
100-
)
96+
local queryAllByTextWithSuggestions =
97+
wrapAllByQueryWithSuggestion(queryAllByText, debug.info(queryAllByText, "n"), "queryAll")
10198

10299
-- ROBLOX deviation START: buildQueries returns a list
103-
local queryByText, getAllByText, getByText, findAllByText, findByText = buildQueries(
104-
queryAllByText,
105-
getMultipleError,
106-
getMissingError
107-
)
100+
local queryByText, getAllByText, getByText, findAllByText, findByText =
101+
buildQueries(queryAllByText, getMultipleError, getMissingError)
108102
-- ROBLOX deviation END
109103

110104
exports.queryByText = queryByText

src/query-helpers.lua

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ end
169169

170170
-- this accepts a getter query function and returns a function which calls
171171
-- waitFor and passing a function which invokes the getter.
172-
local function makeFindQuery<QueryFor>(
173-
getter: (container: Instance, text: Matcher, options: MatcherOptions) -> QueryFor
174-
)
172+
local function makeFindQuery<QueryFor>(getter: (container: Instance, text: Matcher, options: MatcherOptions) -> QueryFor)
175173
return function(container: Instance, text: Matcher, options: MatcherOptions, waitForOptions: WaitForOptions)
176174
return waitFor(function()
177175
return getter(container, text, options)
@@ -261,11 +259,8 @@ local function buildQueries(
261259

262260
local getBy = makeSingleQuery(getAllBy, getMultipleError)
263261
local getByWithSuggestions = wrapSingleQueryWithSuggestion(getBy, debug.info(queryAllBy, "n"), "get")
264-
local getAllWithSuggestions = wrapAllByQueryWithSuggestion(
265-
getAllBy,
266-
debug.info(queryAllBy, "n"):gsub("query", "get"),
267-
"getAll"
268-
)
262+
local getAllWithSuggestions =
263+
wrapAllByQueryWithSuggestion(getAllBy, debug.info(queryAllBy, "n"):gsub("query", "get"), "getAll")
269264

270265
local findAllBy = makeFindQuery(wrapAllByQueryWithSuggestion(getAllBy, debug.info(queryAllBy, "n"), "findAll"))
271266
local findBy = makeFindQuery(wrapSingleQueryWithSuggestion(getBy, debug.info(queryAllBy, "n"), "find"))

0 commit comments

Comments
 (0)