There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-8a2ca889-6864-4b1b-a476-74c812207089 XWIKI-19316 Open

Get rid of jasmine-maven-plugin

 
View issue   ·   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-734b2cf2-2747-4c26-994b-1bf1f09105fd Simon Urli on 13/Oct/26 16:39
 

Evaluation of the cost of moving all the Jasmine tests away from jasmine-maven-plugin (done while trying to add a JS unit test for XWIKI-25222).

What has to move

Only 2 modules still use jasmine-maven-plugin, both only in the integration-tests-chrome profile, which CI never activates (livedata doesn't use it anymore):

Module Specs Tests Lines Current state
xwiki-platform-web-war 5 29 ~1030 Broken: xwiki-tree cannot be loaded anymore (it now needs xwiki-page-ready and xwiki-icon), and xwiki.js fails with Object.extend is not a function
xwiki-platform-ckeditor-plugins 6 + testUtils 23 ~1030 Broken: RequireJS load timeout because xwiki-icon, xwiki-l10n, xwiki-selectize and node-module are not mocked

So since nothing runs them, both suites have rotted, and any solution starts by repairing them.

The CKEditor specs create real CKEditor 4 instances (iframe editing area, selection, snapshots): jsdom cannot handle that reliably, so this module needs a real browser whatever the solution. The web-war specs (Prototype/jQuery logic, events bridge, suggest) should run under jsdom, except maybe exporter.js (615 lines, drives jsTree), which is the main risk on that side.

What CI already does

Measured on the last master "Build for Main" (CI #9021, 2h21, build scan x5dlxpcy4eupm):

  • Vitest with jsdom, e.g. xwiki-platform-notifications-webjar: Node install 4.7s, pnpm install 1.7s, Vitest step 5.3s.
  • Playwright in a real browser already runs on CI: the test:unit script of xwiki-platform-bootstrap runs playwright install chromium && playwright test. The step takes 32s: ~25s to download Chromium and 6s of tests. Its Playwright spec simply opens the unchanged QUnit HTML suite and reads the results, which is exactly the pattern needed to run the Jasmine specs as they are.
  • xwiki-platform-web-war currently takes 71s, 62s of which is the Closure minification. No JS test runs.

Option 1: Vitest (what this issue asks for)

Vitest with jsdom for web-war, Vitest browser mode with Playwright (@vitest/browser, not in the pnpm catalog yet) for CKEditor.

Work Dev-days
Shared setup: Node/pnpm executions in the 2 poms (neither uses the webjar-node packaging), pnpm workspace entries, loader for the legacy scripts (Velocity wrapper, globals, existing mockRequireJS helper), validation on CI 2-3
Port and repair the web-war specs (exporter + jsTree is the bulk) 3-5
CKEditor: browser mode, unpack the CKEditor and WYSIWYG webjars from Maven (they are not npm packages), mock the missing modules, port the 23 tests 4-6
Remove the plugin and profiles, update the JS testing documentation on dev.xwiki.org, optionally clean the plugin configuration from the xwiki-commons parent POM 1
Total 10-15

The CKEditor unpacking step is the pom.xml / package.json duplication mentioned in a previous comment.

Option 2: keep the Jasmine specs and run them with Playwright

Same pattern as bootstrap/QUnit: a standalone Jasmine runner page, the webjars unpacked from the Maven dependencies, and a single Playwright spec loading the page and checking the results.

  • Cost: ~2-3 days of setup, 2-4 days of repairs, ~1 day of cleanup, so 5-8 dev-days.
  • Pro: dependencies stay in Maven, so no duplication.
  • Con: we keep the old Jasmine style, every test needs a browser, and it goes away from the Vitest direction of the platform.

Added CI time

Module Added time
web-war (Vitest, jsdom) Node 5s + pnpm install 2-20s (depending on the pnpm cache) + tests 5-10s ≈ +15-35s
ckeditor-plugins (browser) ~23 editor instances, 15-30s. Chromium is probably already downloaded by bootstrap earlier in the same build (not verified), otherwise +25s. +20-60s
Total +35-95s on a ~2h20 job (≈0.5-1%)

The TestRelease stage runs with skipTests so it shouldn't be impacted (IT stages not checked in detail).

Proposal

A mix of both: Vitest with jsdom for web-war, and for CKEditor pick between Vitest browser mode and the bootstrap-style wrapper after trying both. Start with a 1-2 day web-war prototype based on the locationPicker.js test written for XWIKI-25222, to validate these estimates.

Note: the dev-days are estimates; only the CI timings are measured.