Giter VIP home page Giter VIP logo

Comments (6)

rouge8 avatar rouge8 commented on July 19, 2024

Interestingly if I comment out local success, data = pcall(lib.files.read, spec.context.junit_path) on line 139, that also "works"...

from neotest.

rouge8 avatar rouge8 commented on July 19, 2024

If I replace local success, data = pcall(lib.files.read, spec.context.junit_path) with

    with(open(spec.context.junit_path, "r"), function(reader)
        data = reader:read("*a")
    end)

then it works fine 😵

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

I don't seem to be able to reproduce with the following (also altered your code to use the async read/write as above)

nvim --clean -u minimal.lua

-- ignore default config and plugins
vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))
vim.opt.termguicolors = true

-- append test directory
local test_dir = "/tmp/nvim-config"
vim.opt.runtimepath:append(vim.fn.expand(test_dir))
vim.opt.packpath:append(vim.fn.expand(test_dir))

-- install packer
local install_path = test_dir .. "/pack/packer/start/packer.nvim"
local install_plugins = false

if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
  vim.cmd("packadd packer.nvim")
  install_plugins = true
end

local packer = require("packer")

packer.init({
  package_root = test_dir .. "/pack",
  compile_path = test_dir .. "/plugin/packer_compiled.lua",
})

packer.startup(function(use)
  -- Packer can manage itself
  use("wbthomason/packer.nvim")

  use("vim-test/vim-test")
  use({
    "nvim-neotest/neotest",
    requires = {
      "nvim-lua/plenary.nvim",
      "nvim-treesitter/nvim-treesitter",
      "antoinemadec/FixCursorHold.nvim",
      "rouge8/neotest-rust",
    },
    config = function()
      require("neotest").setup({
        adapters = {
          require("neotest-rust"),
        },
      })
    end,
  })

  if install_plugins then
    packer.sync()
  end
end)

vim.cmd([[
command! NeotestSummary lua require("neotest").summary.toggle()
command! NeotestFile lua require("neotest").run.run(vim.fn.expand("%"))
command! Neotest lua require("neotest").run.run(vim.fn.getcwd())
command! NeotestNearest lua require("neotest").run.run()
command! NeotestDebug lua require("neotest").run.run({ strategy = "dap" })
command! NeotestAttach lua require("neotest").run.attach()
]])

from neotest.

rouge8 avatar rouge8 commented on July 19, 2024

You need to specify an earlier commit in the repo, { "rouge8/neotest-rust", commit = "833255157eb5c48a8b824d084b5088f617ca687d" },. I was able to work around it by switching to with(open(...)) in later commits, but never figured out the local success, data = pcall(lib.files.read, spec.context.junit_path) issue. Then :TSInstall rust and :NeotestNearest on a test. The first time it succeeds, the second time it crashes with the error above.

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

Ah it was the second run that I was missing! OK so the issue was that neotest-rust was throwing an error, which neotest catches and sends in a vim.notify call. I'm using nvim-notify which automatically schedules itself on main thread but the default one does not and so errors out if it's called in async function 🤦 Should be fixed in master now 😁

from neotest.

rouge8 avatar rouge8 commented on July 19, 2024

That seems to fix it, thanks!

from neotest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.