I discovered that Jest is ridiculously slow to load and run tests by comparison with Mocha. This isn't significant for t-a-i where Jest takes ~4.8 seconds to run all the tests and Mocha takes more like ~1.6 end-to-end (that's including the startup time for npm in both cases), but for some other projects of mine (including at work) this could be significant, saving multiple minutes of execution, a dozen times per day. So, this is in part an exercise to explore the difficulties of a Jest-to-Mocha migration.
Stop using Jest's expect assertion functionality in favour of Node.js's built-in assert module.
This is where a lot of questions come in. This could potentially be difficult to do in the general case. Luckily, t-a-i doesn't use much of expect's more advanced functionality.
Install Mocha and (for coverage) c8.
Use c8 ignores for code coverage.
Move all test files over to a dedicated test directory, where Mocha expects them to be by default.
I guess we no longer need to manually exclude those test files from our "files" anymore, that's nice.
Scrap the Jest config file.
Rewrite our npm scripts to use Mocha, not Jest.
Eliminate Jest as a development dependency.
(Unrelated) Get rid of Stryker and give up on the mutation testing thing. It was fun to visit but it doesn't seem practical to reach 100% coverage which makes it not so useful for me.
I discovered that Jest is ridiculously slow to load and run tests by comparison with Mocha. This isn't significant for
t-a-i
where Jest takes ~4.8 seconds to run all the tests and Mocha takes more like ~1.6 end-to-end (that's including the startup time fornpm
in both cases), but for some other projects of mine (including at work) this could be significant, saving multiple minutes of execution, a dozen times per day. So, this is in part an exercise to explore the difficulties of a Jest-to-Mocha migration.expect
assertion functionality in favour of Node.js's built-inassert
module.t-a-i
doesn't use much ofexpect
's more advanced functionality.c8
ignores for code coverage.test
directory, where Mocha expects them to be by default."files"
anymore, that's nice.