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

feat: windows support #149

Merged
merged 19 commits into from
Jul 23, 2024
Merged

feat: windows support #149

merged 19 commits into from
Jul 23, 2024

Conversation

fredrikaverpil
Copy link
Owner

@fredrikaverpil fredrikaverpil commented Jul 21, 2024

This PR introduces a distinction between forward slashes (unix) and backslashes (windows) in filepaths.

However, there's a huge problem with ANSI codes and other stuff is garbling up the JSON output from go test -json. Very strange. Only happens on Windows (Powershell). A workaround is to use gotestsum as runner, which will then write to JSON file without a console roundtrip:

# make gotestsum available on $PATH by installing it
go install gotest.tools/gotestsum@latest

Then set the (for now undocumented/experimental) runner option, and instruct it to use gotestsum instead of go test:

  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-neotest/nvim-nio",
      "nvim-lua/plenary.nvim",
      "antoinemadec/FixCursorHold.nvim",
      "nvim-treesitter/nvim-treesitter",
      {
        "fredrikaverpil/neotest-golang",
        branch = "windows", -- set PR branch
      },
    },
    config = function()
      require("neotest").setup({
        adapters = {
          require("neotest-golang")({ runner = "gotestsum" }), -- Registration with config
        },
      })
    end,
  },

Fixes: #147

@fredrikaverpil fredrikaverpil self-assigned this Jul 21, 2024
@fredrikaverpil fredrikaverpil mentioned this pull request Jul 21, 2024
2 tasks
@fredrikaverpil fredrikaverpil marked this pull request as draft July 21, 2024 19:37
look for backslashes on windows, forward slashes on unix
@fredrikaverpil fredrikaverpil marked this pull request as ready for review July 23, 2024 07:48
@fredrikaverpil fredrikaverpil merged commit 956ba1b into main Jul 23, 2024
8 checks passed
@fredrikaverpil fredrikaverpil deleted the windows branch July 23, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: windows not supported
1 participant