This task encompasses the boilerplate to actually add Jest as a project development dependency.
Configuration
Via T249301#6056623 and T249301#6057642:
- Consider the vue-jest plugin. Transforms are fine but testing without Webpack would be ideal. Here's MachineVision's setup. Is there an opportunity to commonize the Jest config like mw-node-qunit does? It could be low effort to unify if there's interest in consuming a shared NPM package.
- MediaWiki dependencies are mocked out in jest.setup.js. Revisit the tradeoffs of mw-node-qunit's explicit dependencies vs convenience in the context of a shared library?
- Add snapshot testing (e.g., check out the Button component test in ContentTranslation and its snapshot).
- See prototype example.
Patches
Acceptance criteria
- Jest is added a development dependency.
- An NPM script is added that runs all Jest unit tests.
- A test for one component is written. For example, App.
- The configuration documentation on wiki is updated.
- Globals and MediaWiki environment specific variables are minimized.
- A failing test fails CI.
QA
No functional changes so no QA needed.