aboutsummaryrefslogtreecommitdiff
path: root/test/functional/preload.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-06-17 01:23:48 +0200
committerGitHub <noreply@github.com>2022-06-17 01:23:48 +0200
commitc57f6b28d71df1eb6e967381a44a1c038a75698d (patch)
tree02a46f56a250d5f59b767ab3af09cf2b72c60d34 /test/functional/preload.lua
parent279bc71f3c24928de7d46034168fa105592eb1fa (diff)
parent1f2c2a35ad14cfac002d87073471bd84a52860bf (diff)
downloadrneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.tar.gz
rneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.tar.bz2
rneovim-c57f6b28d71df1eb6e967381a44a1c038a75698d.zip
Merge #8519 feat: name, test ids, sockets in stdpath(state)
Diffstat (limited to 'test/functional/preload.lua')
-rw-r--r--test/functional/preload.lua28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/functional/preload.lua b/test/functional/preload.lua
index 24a3977e6b..74f03eaecf 100644
--- a/test/functional/preload.lua
+++ b/test/functional/preload.lua
@@ -1,8 +1,9 @@
--- Modules loaded here will not be cleared and reloaded by Busted.
+-- Modules loaded here will NOT be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation. See issue #62
-- for more information about this.
local helpers = require('test.functional.helpers')(nil)
local iswin = helpers.iswin
+local busted = require("busted")
if iswin() then
local ffi = require('ffi')
@@ -12,3 +13,28 @@ if iswin() then
]]
ffi.C._set_fmode(0x8000)
end
+
+local testid = (function()
+ local id = 0
+ return (function()
+ id = id + 1
+ return id
+ end)
+end)()
+
+-- Global before_each. https://github.com/Olivine-Labs/busted/issues/613
+local function before_each(_element, _parent)
+ local id = ('T%d'):format(testid())
+ _G._nvim_test_id = id
+ return nil, true
+end
+busted.subscribe({ 'test', 'start' },
+ before_each,
+ {
+ -- Ensure our --helper is handled before --output (see busted/runner.lua).
+ priority = 1,
+ -- Don't generate a test-id for skipped tests. /shrug
+ predicate = function (element, _, status)
+ return not ((element.descriptor == 'pending' or status == 'pending'))
+ end
+ })