After investigation and conversation, we're going to move to jest for new js component/module work - @jsn.sherman
Switching PageTriage's Javascript unit tests from QUnit to Jest was suggested by @jsn.sherman. I'd like to explore the idea more in this ticket.
Investigate
- One of our goals should be to migrate PageTriage to some of the most common MediaWiki technologies in use. This lets more MediaWiki developers work on this repo, with less brainpower expended. I think QUnit is used much more than Jest in the MediaWiki world at the moment. So that's a good argument for using QUnit.
- But I hear that Jest is particularly good for testing Vue?
Findings:
qunit is definitely widespread, but there is precedence for using jest in mediawiki. Jest is more straightfoward to actually run (locally or in ci) since all it require is npm install && npm run jest vs the more significant qunit setup.
Investigate:
- There's only one JavaScript test file in the PageTriage repo at the moment, and it's written in QUnit, and is around 250 lines of code. If we change to Jest, should we bother rewriting this file, or should we just use both unit test frameworks side-by-side?
- Jason's note on the suggestion to use both test frameworks, from Discord: "at the macro level those kinds of decisions are exactly how we ended up where we are today: multiple technologies used to do the same kind of job in different parts of the codebase. My baseline for stuff we are moving away from is to ditch it any time it's a light lift."
Findings:
Given the amount of untested code, everyone's feedback, and the fact that everybody wants to see the code covered by the existing tests replaced, I agree to just leaving the qunit tests in place - getting new coverage and working towards replacing the existing code is a reasonable plan. - @jsn.sherman
Investigate
How would jest be impacted by a future move to vitest T305515: Consider migrating from Jest to Vitest
Findings:
vitest offers a (mostly) jest compatible api and it has been designed to be easy to migrate from jest. It should be a straightforward migration, should it need to happen in the future.
https://vitest.dev/guide/migration.html
cc @kostajh