Skip to content

Add a vitest harness for the front-end - #1560

Merged
CarlSchwan merged 1 commit into
nextcloud:masterfrom
solracsf:test/add-front-end-test-harness
Sep 8, 2026
Merged

CarlSchwan merged 1 commit into
nextcloud:masterfrom
solracsf:test/add-front-end-test-harness

Conversation

@solracsf

@solracsf solracsf commented Sep 7, 2026

Copy link
Copy Markdown
Member

The app has no JavaScript tests at all, so nothing under src/ has ever been covered. This adds vitest plus a node-test workflow that follows the same changes / summary shape as the other npm workflows here, so it can be a required check without getting stuck pending on a pull request that touches nothing relevant.

The two specs it comes with hold on current master. One checks that every viewer parameter PDFView.vue reads is actually provided by templates/viewer.php; the other that the template still has the same element ids as the pdf.js viewer.html it is a copy of. The check-viewer job can only tell you that viewer.html changed, not that the two have drifted apart.

I have a handful of small fixes ready that each bring their own regression spec, so this one wants to go in first.

Ran npm run test, npm run lint and npm run stylelint.

The app had no JavaScript tests at all. Vitest runs the specs in "tests/js",
"make test" and the "node-test" workflow run it, and the README no longer
claims that "make test" runs everything, since the PHP tests need a Nextcloud
instance around them.

The workflow follows the same shape as the other npm ones in this repository:
a "changes" job filtering on paths, the real job gated on it, and a "summary"
job that always reports so the check can be a required one without getting
stuck pending on a pull request that touches nothing relevant.

The specs added here hold on the current code: they check that every viewer
parameter the component reads is provided by the template, and that the
template still has the same elements as the pdf.js viewer it is a copy of.
The regression tests for the individual fixes come with those fixes.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@CarlSchwan
CarlSchwan merged commit 3b9ecb7 into nextcloud:master Sep 8, 2026
41 checks passed
@CarlSchwan

Copy link
Copy Markdown
Member

/backport to stable35

@CarlSchwan

Copy link
Copy Markdown
Member

/backport to stable34

@CarlSchwan

Copy link
Copy Markdown
Member

/backport to stable33

@CarlSchwan

Copy link
Copy Markdown
Member

This already managed to find one regression in pdf.js update PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants