Skip to content

Commit

Permalink
fix: Add cwd to support js-debug-adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Barry authored and adrigzr committed Jul 30, 2024
1 parent 780afb9 commit 8239023
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lua/neotest-mocha/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,16 @@ function Adapter.build_spec(args)
vim.list_extend(command, command_args)
end

local cwd = get_cwd(pos.path)

return {
command = command,
cwd = get_cwd(pos.path),
cwd = cwd,
context = {
results_path = results_path,
file = pos.path,
},
strategy = util.get_strategy_config(args.strategy, command),
strategy = util.get_strategy_config(args.strategy, command, cwd),
env = get_env(args[2] and args[2].env or {}),
}
end
Expand Down
4 changes: 3 additions & 1 deletion lua/neotest-mocha/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ end

---@param strategy string
---@param command string[]
---@param cwd string|nil
---@return table|nil
function M.get_strategy_config(strategy, command)
function M.get_strategy_config(strategy, command, cwd)
local config = {
dap = function()
return {
Expand All @@ -243,6 +244,7 @@ function M.get_strategy_config(strategy, command)
runtimeExecutable = command[1],
console = "integratedTerminal",
internalConsoleOptions = "neverOpen",
cwd = cwd or "${workspaceFolder}",
}
end,
}
Expand Down

0 comments on commit 8239023

Please sign in to comment.