Skip to content

fix(windows): make OpenCode reliable on Windows — retry spurious spawnSync ETIMEDOUT (#46) #125

fix(windows): make OpenCode reliable on Windows — retry spurious spawnSync ETIMEDOUT (#46)

fix(windows): make OpenCode reliable on Windows — retry spurious spawnSync ETIMEDOUT (#46) #125

Workflow file for this run

name: E2E Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
# Manual trigger for running the suite against a branch on demand.
workflow_dispatch:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.10.4
- name: Install jq
if: runner.os == 'Linux'
run: sudo apt-get install -y jq
- name: Install bun (for OpenCode tests)
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install plenary.nvim (test dependency)
run: |
mkdir -p deps
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim deps/plenary.nvim
- name: Verify dependencies
run: |
nvim --version | head -3
jq --version
bun --version
- name: Run E2E tests
run: |
chmod +x tests/run.sh tests/run_lua.sh tests/helpers.sh
chmod +x bin/*.sh
./tests/run.sh
# Windows runs a different, narrower strategy than the Unix matrix above:
# - No bash E2E suite (tests/run.sh is bash + jq; deliberately not ported — #46).
# - Lua specs run per-file: PlenaryBustedDirectory hangs headless on Windows,
# but PlenaryBustedFile works (issue #46 handoff).
# - A PowerShell shim syntax/load check runs under Windows PowerShell 5.1
# (`shell: powershell`), the floor the installed Claude Code hook actually uses.
windows-test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
# Pinned to the version the claudecode slice was manually validated on.
version: v0.11.2
- name: Install plenary.nvim (test dependency)
shell: powershell
run: git clone --depth 1 https://github.com/nvim-lua/plenary.nvim deps/plenary.nvim
- name: Verify Neovim
shell: powershell
run: nvim --version | Select-Object -First 3
- name: PowerShell shim syntax + load check (Windows PowerShell 5.1)
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
. .\bin\nvim-socket.ps1
. .\bin\nvim-call.ps1
if (-not (Get-Command Find-NvimSocket -ErrorAction SilentlyContinue)) {
throw 'Find-NvimSocket not defined after dot-sourcing nvim-socket.ps1'
}
if (-not (Get-Command Invoke-NvimCall -ErrorAction SilentlyContinue)) {
throw 'Invoke-NvimCall not defined after dot-sourcing nvim-call.ps1'
}
Write-Host 'PowerShell shims parse and define their expected functions.'
- name: Run Lua specs (per-file)
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
# Run each spec in its own headless nvim by calling plenary.busted.run
# directly (in-process). We can't use PlenaryBustedFile here: it's
# nargs=1 and spawns a CHILD nvim that wouldn't load tests/minimal_init.lua
# (so the plugin rtp would be missing); and PlenaryBustedDirectory hangs
# headless on Windows. Running busted.run in a process already started
# with -u tests/minimal_init.lua sidesteps both, and it sets the exit
# code (0 = pass, non-zero = fail/error) via :cq, so no output parsing.
#
# The shell detector is now Windows-aware (issue #46 follow-up):
# pre_tool_shell_detect_spec.lua (renamed from *_bash_detect_spec) runs
# its Windows-path + PowerShell rows here and marks the POSIX rows
# pending, so the whole tests/plugin directory runs on Windows.
$specs = Get-ChildItem tests/plugin -Filter *_spec.lua
$failed = @()
foreach ($spec in $specs) {
Write-Host "-- $($spec.Name) --"
# Forward-slash the path: it is spliced into a Lua [[...]] literal.
$abs = $spec.FullName -replace '\\', '/'
& nvim --headless --clean -u tests/minimal_init.lua `
-c "lua require('plenary.busted').run([[$abs]])"
if ($LASTEXITCODE -ne 0) { $failed += $spec.Name }
}
if ($failed.Count -gt 0) {
throw "Lua specs failed on Windows: $($failed -join ', ')"
}
Write-Host 'All Windows Lua specs passed.'