The One About Slow Jest Tests


In this episode, we cover "Why is My Jest Test Suite So Slow" by Steven Lemon and completely nerd out on it. This one is chock-full of practical tips for improving your Jest suite time as well as your general understanding of how Jest works "under the hood". 

Evan does a "Cookie Corner" and hyper-speaks through a bunch of reasons why you shouldn't use client side cookies. Joe talks about memory leaks while sounding mildly depressed, and we actually have good news this week! 

Extra resources for Jest testing:

1. Use the time shell built-in for enhanced timing. time npm run <your test command> --takeyourtime

2. See this issue  on why Jest workers are slow sometimes

3. See this issue on why userEvent.type is slow all the time

4. Check out this package for reporting slow individual tests

5. For finding Jest memory leaks, try node --inspect-brk --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage