Run One Jest Test
When iterating on a test, I want to run just that test. This is a bit tricky with Jest, but it can be done.
First, tell the test framework to run a file, or a describe block:
# Test file
$ yarn test path/to/test.test.js
# Describe block
$ yarn test -t 'myAssertiveDescribeBlock'
Then, add .only to your it or test block to run just that example:
it.only('is true', () => {
// your test here
});
It's just that easy.
Tweet