Carson Reinke's Headshot

Carson Reinke's (🚗☀☔🔑) Blog

Replace Karma With Jest by carsonreinke · Pull Request #1627 · bigcommerce/cornerstone · GitHub

Replace Karma With Jest by carsonreinke · Pull Request #1627 · bigcommerce/cornerstone · GitHub

What?
Simply replace Karma with Jest.
Jest is far superior, a lot easier, and more popular. This all started from me trying to write a test with Karma for assets/js/theme/common/state-country.js, but basically could not even get it to work. Using Jest was simple and easy and definitely appears to be a better direction.
Tickets / Documentation
Some oddities:

jest-eventemitter2-transformer.js: required to get Babel and eventemitter2 to work together, it is absurd, but is needed unless stencil-utils is updated
jest-setup.js: Foundation expects certain things and jsdom (used by Jest) has no layout dimensions

Screenshots (if appropriate)
N/A
Thanks @jbruni and @martinchuka for helping me solve some very complicated problems.

link