add configurable glob test pattern for TSamAll

This commit is contained in:
2026-01-06 16:20:15 +01:00
parent f3350cad98
commit 2d5889dce3
3 changed files with 42 additions and 3 deletions

View File

@@ -3,6 +3,21 @@ local runner = {
framework = "javascript",
}
local default_config = {
all_test_glob = "test/**/*.test.js",
}
local config = vim.deepcopy(default_config)
function runner.setup(opts)
if not opts then
config = vim.deepcopy(default_config)
return config
end
config = vim.tbl_deep_extend("force", vim.deepcopy(default_config), opts)
return config
end
local function runner_root()
local source = debug.getinfo(1, "S").source
if source:sub(1, 1) == "@" then
@@ -573,6 +588,7 @@ function runner.build_all_command(bufnr)
if not cwd then
return { cmd = { "echo", "no package.json found" } }
end
local glob = config and config.all_test_glob or default_config.all_test_glob
return {
cmd = {
"npx",
@@ -583,7 +599,7 @@ function runner.build_all_command(bufnr)
RUNNER_PATHS.ui,
"--reporter",
RUNNER_PATHS.reporter,
"test/**/*.{test,spec}.{t,j}s",
glob,
},
cwd = cwd,
}