Skip to content

Commit f2de73d

Browse files
committed
fix(test): make Windows e2e behavior portable
1 parent eb85a3e commit f2de73d

6 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎.github/workflows/neovim_testing.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ jobs:
235235
harness_root="$PWD/../e2e"
236236
export ASTRONVIM_SOURCE_ROOT="$source_root"
237237
export ASTRONVIM_E2E_ROOT="$harness_root"
238+
export ASTRONVIM_TEST_NVIM="$nvim_binary"
238239
mkdir -p "$ASTRONVIM_TEST_SUMMARY_DIR"
239240
case "$ASTRONVIM_TEST_SUITE" in
240241
semantic|semantic-nightly)

‎tests/e2e/astrocore_spec.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local T = MiniTest.new_set {
1414
}
1515

1616
local function terminal_sleep_command()
17-
if vim.fn.has "win32" == 1 then return "ping -n 11 127.0.0.1 > NUL" end
17+
if vim.fn.has "win32" == 1 then return "ping -n 3 127.0.0.1 > NUL" end
1818
return "sleep 10"
1919
end
2020

‎tests/e2e/dap_spec.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ T["DAP-E2E-03 runs and terminates a hermetic adapter through AstroNvim mappings"
8484
local dap = require "dap"
8585
vim.env.ASTRONVIM_E2E_DAP_LOG = %s
8686
vim.env.ASTRONVIM_E2E_DAP_SOURCE = %s
87+
local nvim = vim.env.ASTRONVIM_TEST_NVIM or vim.v.progpath
8788
dap.adapters.astronvim_fixture = {
8889
type = "executable",
89-
command = vim.v.progpath,
90+
command = nvim,
9091
args = { "-l", %s },
9192
}
9293
local source = %s

‎tests/e2e/lsp_spec.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ T["LSP-E2E-01 attaches a real local server, registers a capability, and formats"
2626
vim.cmd [[doautocmd User AstroFile]]
2727
local log_path = vim.fs.joinpath(project, "lsp-events.jsonl")
2828
vim.env.ASTRONVIM_E2E_LSP_LOG = log_path
29+
local nvim = vim.env.ASTRONVIM_TEST_NVIM or vim.v.progpath
2930
vim.lsp.config("astronvim-e2e-lsp", {
30-
cmd = { vim.v.progpath, "-l", server },
31+
cmd = { nvim, "-l", server },
3132
root_dir = project,
3233
filetypes = { "text" },
3334
})

‎tests/e2e/neo_tree_spec.lua‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,16 @@ T["NEO-09 reflects external file changes with watcher or explicit refresh"] = fu
261261
local renamed_path = vim.fs.joinpath(project, renamed)
262262

263263
vim.fn.writefile({ "created" }, created_path)
264-
if not watcher_enabled then child.lua [[vim.cmd "Neotree refresh"]] end
264+
if not watcher_enabled then child.type_keys "R" end
265265
helpers.wait_until(child, neo_tree_contains_expression(created), "Neo-tree create update")
266266

267267
assert.equals(0, vim.fn.rename(created_path, renamed_path))
268-
if not watcher_enabled then child.lua [[vim.cmd "Neotree refresh"]] end
268+
if not watcher_enabled then child.type_keys "R" end
269269
helpers.wait_until(child, neo_tree_contains_expression(renamed), "Neo-tree rename update")
270270
helpers.wait_until(child, "not " .. neo_tree_contains_expression(created), "Neo-tree old name removal")
271271

272272
assert.equals(0, vim.fn.delete(renamed_path))
273-
if not watcher_enabled then child.lua [[vim.cmd "Neotree refresh"]] end
273+
if not watcher_enabled then child.type_keys "R" end
274274
helpers.wait_until(child, "not " .. neo_tree_contains_expression(renamed), "Neo-tree delete update")
275275
end
276276

‎tests/unit/source/contracts_spec.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function read_file(path)
1414
local file = assert(io.open(path, "rb"))
1515
local contents = assert(file:read "*a")
1616
file:close()
17-
return contents
17+
return (contents:gsub("\r\n", "\n"))
1818
end
1919

2020
local function workflow_job(workflow, name)

0 commit comments

Comments
 (0)