Skip to content

Commit 6229225

Browse files
authored
fix(test_harness): timeout error on Windows using powershell when testing dirs (#525)
* fix: timeout error on Windows using powershell when testing dirs * fix formatting with using stylua
1 parent 82a797c commit 6229225

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/plenary/test_harness.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,10 @@ function harness._find_files_to_run(directory)
187187
local finder
188188
if vim.fn.has "win32" == 1 or vim.fn.has "win64" == 1 then
189189
-- On windows use powershell Get-ChildItem instead
190+
local cmd = vim.fn.executable "pwsh.exe" == 1 and "pwsh" or "powershell"
190191
finder = Job:new {
191-
command = "powershell",
192-
args = { "-Command", [[Get-ChildItem -Recurse -n -Filter "*_spec.lua"]] },
192+
command = cmd,
193+
args = { "-NoProfile", "-Command", [[Get-ChildItem -Recurse -n -Filter "*_spec.lua"]] },
193194
cwd = directory,
194195
}
195196
else
@@ -200,7 +201,7 @@ function harness._find_files_to_run(directory)
200201
}
201202
end
202203

203-
return vim.tbl_map(Path.new, finder:sync())
204+
return vim.tbl_map(Path.new, finder:sync(vim.env.PLENARY_TEST_TIMEOUT))
204205
end
205206

206207
function harness._run_path(test_type, directory)

0 commit comments

Comments
 (0)