Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix windows support #91

Merged
merged 4 commits into from
Feb 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lua/neotest-jest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,14 @@ local function parsed_json_to_results(data, output_file, consoleOut)

for _, testResult in pairs(data.testResults) do
local testFn = testResult.name

if vim.loop.os_uname().sysname:find('Windows') == 1 then
-- Transforms C:\\path\file into c:\\path\file to match original testId
if string.match(testFn, "^%a:\\") then
local drive = testFn:sub(1,1)
local restOfPath = testFn:sub(2)
testFn = drive:lower() .. restOfPath
end
end
for _, assertionResult in pairs(testResult.assertionResults) do
local status, name = assertionResult.status, assertionResult.title

Expand Down Expand Up @@ -409,7 +416,7 @@ function adapter.build_spec(args)
"--json",
"--outputFile=" .. results_path,
"--testNamePattern=" .. testNamePattern,
pos.path,
vim.fs.normalize(pos.path),
})

local cwd = getCwd(pos.path)
Expand Down
Loading