Sorry, I had to make the pun…. When the SharePoint Framework originally shipped, the tooling included KarmaJSto write unit tests.
While some peoplehave been arguing for a choice in unit testing framework with SPFx like we (almost) have choice in web frameworks, we saw little movement on that front over the last years.
A couple of weeks ago, Microsoft release version 1.8.0 of SPFx, it’s a great release especially if we look at it from a tooling modernization perspective (flexibility on the typescript version, depreciation of old fabric stuff…).
However, they also have removed karmaJS from the standard tooling, and they haven’t documented that change, I have reach out to them internally hoping this will get resolved soon.
While you can perfectly bring karma back by installing a few packages and tweaking your project configuration, I’d recommend you move to Jest it’s not a big effort and you will get a much faster test cycle. If you want to see the work this represents on a sample webpart,you can look at this pull request, keep in mind it also includes the upgrade to SPFx 1.8.0.
The PnP generatorhas included Jest configuration for a while now thanks to the work of Elio Struyf and Andrew Connell and I started the work to update the tooling and documentation around the Azure DevOps integration.