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(busted): Compact test output format #488

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

SidOfc
Copy link

@SidOfc SidOfc commented May 7, 2023

Hello maintainers :)

Thank you for making plenary.nvim! When writing my own plugins I use the test suite of plenary so that I can run tests locally and on CI. This PR is another attempt at reducing the output of the busted implementation in plenary.nvim.

Related:

Unfortunately #86 was abandoned and even though some interest is shown in #237 this hasn't materialized.

The idea is that only pending and failing test messages are shown. I also reduced and formatted the output of fatal errors. Additionally, I noticed that when multiple instances of plenary.nvim are installed, the busted.lua file gets sourced from the first plenary.nvim found in runtimepath. To fix this I tweaked the command which launches Neovim instances so that the plenary.nvim which is used to start the tests always uses the busted.lua file from the same repository. This is done by prepending the plenary.nvim repo path to runtimepath at launch of each individual job.

image

Finally there are some other modifications which basically make PlenaryBustedFile and PlenaryBustedDirectory equivalent in that both commands now allow specifying a path as well as an optional options table. Both commands now follow the same code path so testing a single file basically works the same as testing a directory.

Please let me know what you think, I'm not sure if the code I wrote is necessarily up to par with what is expected.

@SidOfc SidOfc changed the title Compact test output format feat(busted): Compact test output format May 7, 2023
@SidOfc
Copy link
Author

SidOfc commented May 8, 2023

Now also added print capturing within tests. Calls to print within it callbacks will be printed below the test failure:

image

Not sure if printing messages from passing / pending tests is desirable. I feel like some cleaning up (by me of course) wouldn't be a bad idea as some of the logic is duplicated. Probably fixable by writing a function or two with a few params :)

@seflue
Copy link

seflue commented Jun 13, 2024

This PR is over a year old. I would be also interested in a more compact output - or at least print some hint about the cause of a failed test run at the end of the output. I am contributing to some neovim plugins with a lot of tests and if one test fails, I find myself always searching for the cause, which is a bit cumbersome.
What would be the requirement, to get a PR which delivers such a feature actually merged into Plenary.nvim?

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.

2 participants