-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
pending shouldn't fail tests #49
Comments
plenary doesn't bundle busted anymore, we had problems with it. TJ basically wrote a simple busted with
About your "Start with clear buffer", would this work: local bufnr = vim.api.nvim_create_buf(false, true) -- creates unlisted scratch buffer
vim.api.nvim_buf_call(bufnr, function()
-- put everything you wanna do here
end)
vim.api.nvim_buf_delete(bufnr, { force = true }) You can obviously write a wrapper for that :) Hope that answers your questions |
Ahhh I see, it's not a statement you run in the body, you wrap the whole function with it. Thanks! For the clear buffer thing, can I have plenary run that for every test then, or do I have to have that boilerplate everywhere? |
I guess I can write a replacement wrapper for |
You should just be able to do: pending('expands mid-word', function()
-- Waiting for 'norcalli/snippets.nvim#17'
insert('(\\a<Tab>')
assert.is.equal('(α', vim.fn.nvim_get_current_line())
feed('ggdG') -- FIXME: Start with clear buffers...
end) Also i don't get why your buffers are not empty. How do you run your tests? Inside vim? test:
nvim --headless --noplugin -u scripts/minimal.vim -c "PlenaryBustedDirectory tests/plenary/ {minimal_init = 'tests/minimal_init.vim'}" With minimal.vim: set rtp+=.
set rtp+=../plenary.nvim/
runtime! plugin/plenary.vim |
I have the same (I copied it from here), but state leaks from tests. E.g.:
(Where locally I don't use the exact line you showed because I still don't know how y'all are doing that locally :), it's a bit annoying to set up, so locally I'm just running against my own vimrc, and in CI I run with the minimal .vimrc) |
Oh yeah we don't clear the buffer after each it. I could ask @tjdevries if we should do that, if he doesn't take a look at this thread. Edit: But that might cause problems with other tests. I am not sure |
I think even beyond just clearing the buffer that it'd be nice if the default (or certainly a very easy tweak) got you stateless tests -- e.g. I wouldn't have expected setting buffer variables to persist across tests either. But yeah if it's not the default if it's easy to make that happen without sprinkling boilerplate in every test maybe that'd be nice too. EDIT: I don't know what the cultural norms of -spec-like test frameworks are though I guess -- maybe |
I talked it over with tj and he suggested we should do something like this: describe('thingy', function()
before_each(clear)
-- And people can define there own before_each like this:
before_each(function()
-- also clear highlights, whatever
end)
-- and an inner describe can define additional before_each functions that will only run for that describe in addition to the already defined before_each
it('should work', function() ... end)
end) I will do this in #50 but its already late for me and i am kinda tired so i will finish that tomorrow. :) We can also talk about adding like an |
Cool! Sounds reasonable enough -- one "related" thing from experience (not with spec-like runners but with writing xUnit ones) if it helps, is that if you end up also adding But for setup yeah that'd definitely help me here, thanks! |
I don't really know anything about busted, so obviously let me know if I'm just misunderstanding the right way to use this but if I have a test with
pending
:because I know it fails, and then I run it, I see
where the test I marked pending has failed the build. I see busted has a
--suppress-pending
, so if that's what's needed to get this not to fail maybe there just needs to be a way to enable that in plenary too, but why it's not the default seems weird to me. Maybe you'll enlighten me there :)(Also it took a few minutes of looking for either "expected failure" or "todo" which are xUnit terms to finally find
pending
, but I see busted's docs don't use those terms anywhere)The text was updated successfully, but these errors were encountered: