From ec1d37d0a9fceabd100466163045ead2b7196517 Mon Sep 17 00:00:00 2001 From: nagamine Date: Wed, 29 Nov 2023 18:51:57 -0500 Subject: [PATCH 1/3] fix windows support --- lua/neotest-jest/init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/neotest-jest/init.lua b/lua/neotest-jest/init.lua index d9d427e..5aaa631 100644 --- a/lua/neotest-jest/init.lua +++ b/lua/neotest-jest/init.lua @@ -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 @@ -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) From 7e05584f53e9350b3dc527cb12f3147d052c8f3f Mon Sep 17 00:00:00 2001 From: nagamine Date: Mon, 18 Dec 2023 22:04:10 -0500 Subject: [PATCH 2/3] stylua fixes --- lua/neotest-jest/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/neotest-jest/init.lua b/lua/neotest-jest/init.lua index 1b664f7..d8862f5 100644 --- a/lua/neotest-jest/init.lua +++ b/lua/neotest-jest/init.lua @@ -313,10 +313,10 @@ 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 + 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 drive = testFn:sub(1, 1) local restOfPath = testFn:sub(2) testFn = drive:lower() .. restOfPath end From 24569db3f56c6f39868963a0662b82ac498023a1 Mon Sep 17 00:00:00 2001 From: nagamine Date: Fri, 26 Jan 2024 13:34:11 -0500 Subject: [PATCH 3/3] remove special case for handling tests in windows --- lua/neotest-jest/init.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lua/neotest-jest/init.lua b/lua/neotest-jest/init.lua index d8862f5..8d9a656 100644 --- a/lua/neotest-jest/init.lua +++ b/lua/neotest-jest/init.lua @@ -313,14 +313,6 @@ 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