Skip to content

Commit

Permalink
Merge pull request #51 from TAServers/LEST-NONE-add-dot-skip
Browse files Browse the repository at this point in the history
LEST-NONE - Add test.skip and describe.skip
  • Loading branch information
Derpius authored Jul 2, 2023
2 parents c5d6808 + 6e2a4e1 commit 024f1f4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/lua/src/runtime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,19 @@ local function findTests(testFiles)
})
end

local disabledDescribeOrTest = setmetatable({
each = function()
return function() end
end,
}, { __call = function() end })

--- Registers a new test group
---@class lest.DescribeFunction
---@field each fun(testCases: table): fun(name: string, func: fun(...: any))
---@overload fun(name: string, func: fun())
local describe = {}
describe.__index = describe
describe.skip = disabledDescribeOrTest

function describe:__call(name, func)
runInDescribeScope(name, func)
Expand Down Expand Up @@ -103,6 +110,7 @@ local function findTests(testFiles)
---@overload fun(name: string, func: fun())
local test = {}
test.__index = test
test.skip = disabledDescribeOrTest

function test:__call(name, func, timeout)
registerTest(name, func, timeout)
Expand Down Expand Up @@ -138,12 +146,6 @@ local function findTests(testFiles)
end
end

local disabledDescribeOrTest = setmetatable({
each = function()
return function() end
end,
}, { __call = function() end })

local cleanup = buildEnvironment({
describe = setmetatable({}, describe),
test = setmetatable({}, test),
Expand Down

0 comments on commit 024f1f4

Please sign in to comment.