bug: tests fail on MacOS #102

Open
opened 2026-08-04 13:15:47 -05:00 by noe.trevino · 1 comment
Owner

Did you check docs and existing issues?

  • I have read all the haunt.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of haunt.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

nightly

Operating system/version

MacOS

Describe the bug

@TheNoeTrevino i finally found why the tests fail locally for me. I am guessing you are not on macOS. macOS has var symlinked to /private/var.

function M.create_test_buffer(lines, filename)
local bufnr = vim.api.nvim_create_buf(false, false)
local test_file = filename or (vim.fn.tempname() .. ".lua")
vim.api.nvim_buf_set_name(bufnr, test_file)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines or { "Line 1", "Line 2", "Line 3" })
vim.api.nvim_set_current_buf(bufnr)
return bufnr, test_file
end

So the vim.fntempname()returns/var/folders/...but Neovim resolves the buffer name to/private/var/folders/...`. The test keep the original path tho.

Either running this passes all tests for me:

TMPDIR=/private/tmp ./scripts/test

Or resolving the path before assigning the buffer name also fixed it:

local test_file = filename or (vim.fn.tempname() .. ".lua")
test_file = vim.fn.resolve(test_file)
vim.api.nvim_buf_set_name(bufnr, test_file)

Can you confirm this still works for you ? 🤔

Steps To Reproduce

run tests on mac

Expected Behavior

should pass

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "TheNoeTrevino/haunt.nvim", opts = {} },
    -- add any other plugins here
  },
})
### Did you check docs and existing issues? - [x] I have read all the haunt.nvim docs - [x] I have updated the plugin to the latest version before submitting this issue - [x] I have searched the existing issues of haunt.nvim - [x] I have searched the existing issues of plugins related to this issue ### Neovim version (nvim -v) nightly ### Operating system/version MacOS ### Describe the bug @TheNoeTrevino i finally found why the tests fail locally for me. I am guessing you are not on macOS. macOS has var symlinked to /private/var. function M.create_test_buffer(lines, filename) local bufnr = vim.api.nvim_create_buf(false, false) local test_file = filename or (vim.fn.tempname() .. ".lua") vim.api.nvim_buf_set_name(bufnr, test_file) vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines or { "Line 1", "Line 2", "Line 3" }) vim.api.nvim_set_current_buf(bufnr) return bufnr, test_file end So the vim.fntempname()returns/var/folders/...but Neovim resolves the buffer name to/private/var/folders/...`. The test keep the original path tho. Either running this passes all tests for me: TMPDIR=/private/tmp ./scripts/test Or resolving the path before assigning the buffer name also fixed it: local test_file = filename or (vim.fn.tempname() .. ".lua") test_file = vim.fn.resolve(test_file) vim.api.nvim_buf_set_name(bufnr, test_file) Can you confirm this still works for you ? 🤔 ### Steps To Reproduce run tests on mac ### Expected Behavior should pass ### Repro ```lua vim.env.LAZY_STDPATH = ".repro" load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))() require("lazy.minit").repro({ spec = { { "TheNoeTrevino/haunt.nvim", opts = {} }, -- add any other plugins here }, }) ```
Author
Owner

If you see this an you own a mac, this is a great first issue. I dont have one, so I am not able to test this.

Description shows another contributor having trouble running tests due to mac having var symlinked to something else. Something like that.

If you see this an you own a mac, this is a great first issue. I dont have one, so I am not able to test this. Description shows another contributor having trouble running tests due to mac having var symlinked to something else. Something like that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
noe.trevino/haunt.nvim#102
No description provided.