Repository navigation
Description
Current Behavior
Many libs are out of date and need to be updated. A good test coverage will bring a bit confidence in supporting mirgration.
There is no test runner configured, no specs, and no CI job that would catch a regression in the code the whole UI depends on.
Practically, this means:
- Behavior can only be verified by hand against a running instance and an API server.
- Pure logic in
src/shared/andsrc/mixins/is unverified. This includes code where a silent regression has real consequences —isUrlSaveForRedirect()insrc/shared/utils.jsis an open-redirect guard, andhasPermission()insrc/shared/permissions.jsgates what the UI exposes to a user. src/shared/common.jscontains a number of formatters that build HTML strings and rely onxss-filtersfor escaping. There is nothing asserting that the escaping stays in place.- The
lint.yamlworkflow runs Prettier, ESLint and the i18n check, andci-build.yamlruns a build, but nothing runs tests. A pull request cannot be gated on behavior. - There is no coverage signal, so it is not visible which parts of the codebase are unverified or whether a change makes that worse.
Proposed Behavior
Add a unit test suite to the frontend, wired into CI as a blocking check.
Specifically:
-
A test runner suited to the stack. Jest with jsdom plus
@vue/test-utils, since the project is Vue 2 with Vue CLI. Exposed asnpm test,npm run test-watchandnpm run test-coverage. -
Specs for the code most worth protecting first, rather than chasing a coverage number:
src/shared/— the formatters, comparators, permission helpers and URL guards.src/mixins/— starting withpermissionsMixinandfilterPillsMixin.- The filter pill components under
src/views/components/, which carry non-trivial state and emit logic.
-
Coverage reporting with an enforced floor. Report to
coverage/includinglcov.infoso the numbers can be consumed by external tooling later, and set thresholds at the measured baseline so coverage cannot silently regress. Files that have no specs yet should stay inside the measured scope so that the remaining gap is visible rather than hidden. -
A CI job that runs the suite on the same triggers as the existing lint workflow, publishing the coverage report as an artifact.
-
Documented conventions, so that later contributions are consistent: where specs live, how they map to
src/, how to mount components, and how to deal with the parts of the app that assume a webpack build.
Why: the contributing guidelines state that "new functionality should have corresponding tests added to the existing test suite if possible", which is not currently actionable because no such suite exists. Establishing one makes that expectation enforceable, gives reviewers a way to confirm a change is safe without running the app by hand, and protects the security-relevant helpers above from silent regressions.
Two constraints worth stating up front, since they shape the implementation:
- Some modules cannot be loaded under Jest as-is.
src/i18n/index.jsuses webpack'srequire.contextand performs an HTTP request at import time, andsrc/shared/utils.jsimportsflexver/dist/module, which is ESM. Both need handling in the Jest configuration rather than changes tosrc/. - The initial suite should not modify production code. Where existing behavior is surprising, the tests should document it and any correction should be proposed separately.
Checklist
- I have read and understand the contributing guidelines
- I have checked the existing issues for whether this enhancement was already requested
Activity
duderoot commentedon Aug 5, 2026
Maybe worth thinking more about extendig this to e2e test with playwright for example. This can be then a base for testing migration to Vue 3 #446
duderoot commentedon Nov 14, 2026
Closing this as most of it has been addressed since I opened it, though differently from what I proposed:
npm test, colocated*.test.js) in 841b0ec. The Jest + jsdom +@vue/test-utilssetup proposed above was tied to Vue 2 / Vue CLI and is obsolete now that the frontend runs on Vue 3 + Vite.e2e/(eb9d162), which also covers my earlier comment about having a base for the Vue 3 migration (Upgrade to Vue 3 #446).ci-unit-tests.yamlandci-e2e.yamlrun on pull requests tomain.DEVELOPING.md. Unit tests are for pure logic with many input combinations; end-to-end tests are for everything a user can see.What's still missing is unit tests for the security-relevant helpers (redirect guard, permission checks, HTML escaping) and a coverage report. I've opened #ISSUE_NUMBER for that narrower scope, without the enforced coverage threshold from this proposal.