gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
2.08k stars 123 forks source link

Fix need to save twice to trigger watch on OSX using Neovim #300

Closed andersjanmyr closed 1 year ago

andersjanmyr commented 1 year ago

On OSX (12.6.2) using Neovim (NVIM v0.8.2) the triggering event varies between fsnotify.Rename and Create. This fix adds fsnotify.Rename to the events triggering a new test run.

Before

handling event "cors_middleware.go": RENAME
handling event "cors_middleware.go": CREATE

Running tests in ./.
exec: [go test -json ./.]
go test pid: 96495
✓  . (cached)

DONE 71 tests in 0.237s

After

handling event "cors_middleware.go": RENAME

Running tests in ./.
exec: [go test -json ./.]
go test pid: 95707
✓  . (cached)

DONE 71 tests in 0.245s
dnephin commented 1 year ago

Thank you for the bug fix! This is definitely something that needs to be fixed.

I think this change should be safe because of the throttling of events, but I'd like to do a bit of testing with vim, vs code, and GoLand to make sure it continues to work correctly with those editors.

The changes in this PR look great, so as long as this continues to work with those editors I think we should be able to merge this PR.