TodayILearned

TIL… How to run a single suite of Tests in Jest

So I was writing unit tests for my reducers, but got frustrated with the slow process of running the full test suite when I was tweaking a single test. I though, there’s got to be a better way!

To the Internet! And TaDa, there was! Once you install Jest globablly, you can run a simple command to select the suite or suites you want to run:

jest –runInBand “{matchString}”

This command will run any file whose name matches the given string. So if you wanted to run all the tests associated with the SuchAndSuchModule. You could use:

jest –runInBand “SuchAndSuch*”

My thanks to be brilliant folks who answer stack-overflow questions! You can find the answer I did here

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s