Closed bolivier closed 2 years ago
Yes!! I found a script modified from here: https://emacs.stackexchange.com/questions/58960/re-fill-compilation-mode-buffer-from-shell-script and modified it!
Before each new thing the compilation buffer logs it will clear the buffer if it has this string "Ran all test" which I think is at the end of every test
(setq test-separator "Ran all test")
(defun my/hook-only-allow-1-jest-test (inserted-string)
(when (and (s-contains? "*jest*" (buffer-name))
(s-contains? test-separator (buffer-string)))
(comint-clear-buffer))
inserted-string )
(add-hook 'comint-preoutput-filter-functions #'my/hook-only-allow-1-jest-test)
Could I get a little more context for this? I'm not able to reproduce. I've tried using this repo as an example and ran jest
on 02 Plain Vanilla
and the buffer appears to clear every time I call jest
@Emiller88 In a regular terminal jest will clear it's output when you edit a file and the tests run again
The problem here is the jest output buffer in emacs doesn't clear when you update a file and the jest reruns in the same instance.
Ah, I see the issue now, I was just using jest, without --watch
. I was able to reproduce it now!
Is there a way to make the jest output buffer clear its contents before running the tests again?