Skip to content

test(ALL): fix tests that fail when using git worktree#2310

Merged
echasnovski merged 1 commit intonvim-mini:mainfrom
abeldekat:test_all_when_on_worktree
Mar 12, 2026
Merged

test(ALL): fix tests that fail when using git worktree#2310
echasnovski merged 1 commit intonvim-mini:mainfrom
abeldekat:test_all_when_on_worktree

Conversation

@abeldekat
Copy link
Member

@abeldekat abeldekat commented Mar 11, 2026

Details(editted):

  • When using git worktree, the mini.nvim repository is also checked-out under a different name. That causes some tests to fail.

  • test_tabline: The tabline in test 'deduplicates named labels' changes when the cwd is not 'mini.nvim'. Solution: increase child.o.columns

  • test_snippets: The screenshot in 'Session persists after :edit' assumes that the name of the repro is mini.nvim. Solution: use a dummy statusline.

@echasnovski
Copy link
Member

Could you please elaborate on what is the problem here? How can I reproduce the test fails?

All tests (implicitly) assume that they are run from inside the project's root directory. Usually it is called 'mini.nvim', but with Git worktrees it can have another name and that is the problem, right? If yes, then no repro steps needed. Just please make sure that after this PR all tests pass in this scenario (preferably on all supported Neovim versions, but that should be okay if works on latest release).


Please:

  • Use capital letter at the start of the comment.
  • Prefer using child.fn.chdir('xxx') instead of child.cmd('cd xxx').
  • Avoid using placeholder words like "foo", "bar", etc.

Also, I am not convinced that changing a directory to something that doesn't exist is a good idea. Could you please find another (concise) way to make 'mini.tabline' test pass in this case?

@abeldekat
Copy link
Member Author

All tests (implicitly) assume that they are run from inside the project's root directory. Usually it is called 'mini.nvim', but with Git worktrees it can have another name and that is the problem, right?

Yes, that's the problem. I have 'mini.nvim' in the 'projects/plugin' folder, alongside 'mini_fix_x' and 'mini_test_fix_x'

@abeldekat abeldekat force-pushed the test_all_when_on_worktree branch from cce0925 to 2b164a4 Compare March 11, 2026 14:03
@abeldekat
Copy link
Member Author

I pushed a new version

Also, I am not convinced that changing a directory to something that doesn't exist is a good idea. Could you please find another (concise) way to make 'mini.tabline' test pass in this case?

I don't understand unfortunately. The directory in tests/dir_tabline/ does exist, in order to have a fixed cwd, containing as many characters as the string 'mini.nvim'.
I renamed to dir_other, only containing a dummy file.

@echasnovski
Copy link
Member

I don't understand unfortunately. The directory in tests/dir_tabline/ does exist, in order to have a fixed cwd, containing as many characters as the string 'mini.nvim'.

Sorry, I missed that this PR adds the new directory. I was confused that there is a child.fn.chdir() into a non-existent directory.

I think this is better be solved by increasing child.o.columns to a very big number (with a comment about why this is done). No need for a new directory with the same number of letters.

@abeldekat abeldekat force-pushed the test_all_when_on_worktree branch from 2b164a4 to 2eb1b00 Compare March 11, 2026 19:24
@abeldekat
Copy link
Member Author

I think this is better be solved by increasing child.o.columns

Much better indeed. Done!

Details:
- When using git worktree, the mini.nvim repository is also checked-out
under a different name. That causes some tests to fail.

- test_tabline: The tabline in test 'deduplicates named labels' changes
when the cwd is not 'mini.nvim'. Solution: increase child.o.columns.

- test_snippets: The screenshot in 'Session persists after :edit'
assumes that the name of the repro is mini.nvim. Solution: use a dummy
statusline.
@abeldekat abeldekat force-pushed the test_all_when_on_worktree branch from 2eb1b00 to 045f228 Compare March 11, 2026 20:04
Copy link
Member

@echasnovski echasnovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is now, looks good to me.

@abeldekat, did you make sure that this is all the tests that need adjustment to work with this "Git worktree" workflow?

@abeldekat
Copy link
Member Author

@abeldekat, did you make sure that this is...

Yes. I also grepped the screenshots searching for mini.nvim in the statusline...)

@echasnovski echasnovski merged commit 9990c41 into nvim-mini:main Mar 12, 2026
12 checks passed
@abeldekat abeldekat deleted the test_all_when_on_worktree branch March 12, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants