Running 1000 tests in 1s (2022)
14 points by pushcx
14 points by pushcx
This inspired me to turn Fable on my e2e tests for a NestJS app. Turns out I can cut run time by 60% by changing module loading!
Changing module loading from what, to what? Are you using the strategy from the article? What's that in absolute numbers?
Instead of loading my entire application tree, I only load the subset of DI modules that actually pertain to the module under test. For example, when testing a users API, we now only load the UsersModule and its dependencies.
Adopting the practice from the article will require us to switch from Jest to Vitest, which is a bigger change that we’ll make later this year if Vitest lands in NestJS 12.