Auto-run tests and clear screen before each run?

The fswatch recipe from mix help test works well:

    fswatch lib test | mix test --listen-on-stdin

But I’d like it to clear the screen before each test run: it makes it easier for me to focus on the current results.

It seems like it’s not possible with the above setup because mix test is re-running itself. And so it’d need an option like --clear-before-run, which it doesn’t have.

Has anyone figured out how to do this or found another file watcher strategy that can clear the screen?

I found this solution. I haven’t looked into why it the shell foo is necessary:

    fswatch lib test | xargs -I {} sh -c 'clear && mix test'