21
Sumafu
5y

In the last one and a half days I optimized our Angular UnitTests. There‘re written with Karma and Jasmine. Before the optimization they needed ten minutes for around 400 tests. Now the same tests are executed in 12 seconds.

Comments
  • 2
    Our 500 jest unit tests for an angular app take about 12 minutes. What did you do?
  • 8
    @sebson I did two different things. At first we had a very big SharedModule that was imported in nearly every component test file. I removed all of these imports and defined CUSTOM_ELEMENTS_SCHEMA and then imported only the components and modules that are really needed. This bootest the tests up to 90%.

    Then secondly I found this instruction, which reduced the execution time for another 90%: https://blog.angularindepth.com/ang... (I recommend to not open the site with safari, because I had there some issues with the code samples)
  • 1
    And here's me thinking you just renamed a it block to fit
  • 1
    Congratulations!
    That's amazing 😊
Add Comment