olimorris / neotest-rspec

🧪 Neotest adapter for RSpec. Works in Docker containers too
MIT License
88 stars 25 forks source link

Pending specs seem to break this #21

Closed will closed 2 years ago

will commented 2 years ago

Hey I've been starting to try out neotest a little bit, thanks for making an rspec adapter.

I noticed just now that if you have a blockless it for a pending test, it seems to break everything. Nothing shows up on the side line anymore, and if you have the summary window open they all stay as quesiton marks.

I tried to get the output, but I had never used output before and I'm just getting

E5108: Error executing lua: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: ..
.ck/packer/start/neotest/lua/neotest/consumers/output.lua:152: attempt to index upvalue 'client' (a nil value)

but I think that's probably unrleated to the pending/blockless its and something else wrong with my setup.

olimorris commented 2 years ago

Hey Will. Oooooh good spot. I will test this out at some point in the next few days. That should definitely not happen!

Have you had the adaptor working for your other tests?

will commented 2 years ago

Yeah it’s mostly been great. The only couple of things, and idk if it’s the adapter or neotest itself, is it seems like you can get two or more test running at the same time. The second one fails since it’s trying to use the same db. I do have my project set up to take an env var to tack on an integer to the end of the test db name, that could be neat. The other thing is it’d be nice to see some output before the check marks show up, maybe with vim.notify. It’s probably the same total time to start up as running test manually l, but it feels longer waiting on nothing. Anyway it’s been a cool way to run tests for sure

On Jul 29, 2022, at 23:35, Oli M @.***> wrote:

 Hey Will. Oooooh good spot. I will test this out at some point in the next few days. That should definitely not happen!

Have you had the adaptor working for your other tests?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

olimorris commented 2 years ago

Awesome ideas. That would all be neotest related as the adapters conform to an interface and only implement 1) what a test looks like 2) the command to run the tests and 3) how the results are extracted from the runner.

The db is a really good point too. Are the names fixed before the tests are triggered or could you use some kind of timestamping in a before :all?

alxekb commented 2 years ago

Hey I've been starting to try out neotest a little bit, thanks for making an rspec adapter.

I noticed just now that if you have a blockless it for a pending test, it seems to break everything. Nothing shows up on the side line anymore, and if you have the summary window open they all stay as quesiton marks.

I tried to get the output, but I had never used output before and I'm just getting

E5108: Error executing lua: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: ..
.ck/packer/start/neotest/lua/neotest/consumers/output.lua:152: attempt to index upvalue 'client' (a nil value)

but I think that's probably unrleated to the pending/blockless its and something else wrong with my setup.

Hey @will please clarify what do you mean by a blockless it it's not quite clear. Oliver isn't a ruby dev, and it will be helpful if you provide some examples.

Thank you for filing the issue and for using neotest-rspec 🙂

olimorris commented 2 years ago

If you guys can send over any code examples then happy to take a look.

will commented 2 years ago
RSpec.describe "a thing" do
  it "this works and gets tested by neotest" do
    expect(3).to eq 3
  end

  it { expect("single line tests".size).to eq(17) }

  it "what about focus", focus: true do
    expect(:hi).to be
  end

  context "contexts work" do
    it { expect("single line tests".size).to eq(17) }
  end

  # if this line is present it will make it so no other tests in this group show up, everything else in this group seems ok
  it "this is a pending test"
end

# this is valid, but also seems to not show up
RSpec.describe do
  it { expect("single line tests".size).to eq(17) }
end
olimorris commented 2 years ago

I have solved the pending tests issues btw. I just needed to check for the pending status from RSpec. The last test:

RSpec.describe do
  it { expect("single line tests".size).to eq(17) }
end

I will look at later. Basically the lack of having any context after Rspec.describe is busting the treesitter queries.

will commented 2 years ago

Thanks! Pending is working great now

will commented 2 years ago

The other one is probably doing something to https://github.com/olimorris/neotest-rspec/blob/main/lua/neotest-rspec/init.lua#L32 to make the argument list optional, but I'm not really that sure, never did much with tree sitter queries yet.

Or maybe having @namespace.name get some default if the argument is missing

olimorris commented 2 years ago

Okay I think this is fixed now as per f9d2d652e22deeb8c4f6aae3ffc1ccb290f7c1ba. Added some more context to the treesitter queries and all tests are working so please let me know.

olimorris commented 2 years ago

@will let me know if you're happy to close this.

will commented 2 years ago

Thanks!