Last active
March 31, 2023 14:28
-
-
Save KleaTech/91123138faeaf0fefbf24a0eaa21df8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run only tests that has .only or all of them if there's no .only | |
grep --exclude-dir=node_modules -rl . -e 'test.only\|it.only\|describe.only' --null | tr '\n' ' ' | xargs -0 npx jest | grep . || npx jest | |
clear && grep --exclude-dir=node_modules -rl . -e 'test.only\|it.only\|describe.only' --null | tr '\n' ' ' | xargs -0 npx jest --coverage=false |
That's weird. I'm using M1 Macbook Pro with default terminal, colors and ctrl-c works as expected. Maybe it's related to the ending | grep . || npx jest
. That's a workaround because xterm should run once even with empty input, but it does not run on my machine. Maybe you can try with just
grep --exclude-dir=node_modules -rl . -e 'test.only\|it.only\|describe.only' --null | tr '\n' ' ' | xargs -0 npx jest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, it even works with --watch. Unfortunately it removes the colours from the output in iterm2 on mac.
Edit: If I ctrl-c once instead of stopping it it re-runs it but with coloured output. Great.