Skip to content

fix(webapps): restore frontend test harnesses - #3900

Open
hauptmedia wants to merge 2 commits into
mainfrom
codex/frontend-test-harness
Open

hauptmedia wants to merge 2 commits into
mainfrom
codex/frontend-test-harness

Conversation

@hauptmedia

@hauptmedia hauptmedia commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The legacy frontend's advertised npm test command fails because karma.config.js is missing. The SDK Node tests also cannot start because their REST mock fixture and test dependencies are missing.

Add the missing Webpack-compatible Karma UI configuration and restore the SDK mock fixture, pin the required development dependencies, and expose separate test:sdk and test:ui commands. npm test runs both in sequence. Update three Superagent header assertions and two Sinon reset calls for the current libraries, preserving their expected behavior.

This PR covers the test-harness problem extracted from #3820. The SDK calendar validation and Neo XML resolver are separate PRs. It is not a prerequisite for #3818.

Root cause and history

These gaps were inherited from upstream Camunda and have separate origins:

  • Missing root Karma configuration — 3 May 2023: Camunda PR #3371, commit 443141eb00, introduced "test": "karma start karma.config.js", but did not add webapps/frontend/karma.config.js. The migration deleted the old Grunt task wiring. The existing ui/common/unit-tests/karma.conf.js was retained unchanged and still used Browserify, while its test adapters, reporters and dependencies were removed. Thus the root config was never committed, rather than deleted later; pointing the script at the old config alone would not restore the tests.
  • Missing SDK mock fixture — 21 May 2021: Camunda PR #1461, commit 0aa166c85e, deleted webapps/camunda-bpm-sdk-js/test/superagent-mock-config.js as an unused file. It was the commit's only changed file, with no replacement, although coreSpec.js still required it. The fixture in this PR is byte-for-byte identical to the file before that deletion (Git blob f54c76892eda5547493d14cbceff3538e84347e1).
  • Missing SDK test tooling: f1d454db33, committed 3 August 2020, removed the SDK's own package manifest and its test dependency declarations. The 2023 Webpack migration then removed the SDK Grunt tasks and remaining shared Mocha/Chai/Sinon/Karma test dependencies. The SDK README continued advertising the removed Grunt commands.

Why the current checks can remain green: the Webpack migration's Maven integration ran dependency installation, license checks and the production build, without npm test. The current legacy Maven configuration still does so. The PR workflow's separate frontend test job runs in webapps-neo/frontend, not the legacy frontend. Green Maven/Neo checks therefore do not validate the legacy Karma or SDK commands; the browser-validation limitation below still applies.

The history was checked directly against the commits' Git trees, the introducing/deleting diffs, surviving test imports, and the restored fixture's blob hash.

Attribution

superagent-mock-config.js is restored verbatim from commit ee7bbef8d02f85d0d6a7d4052b275d6b5b4cd18d, where it lived at webapps/camunda-bpm-sdk-js/test/superagent-mock-config.js. Its original Camunda Apache-2.0 copyright and license header are retained.

Validation

  • JavaScript syntax checks and git diff --check pass.
  • The unrelated compatibility helper and both Webpack configurations are byte-for-byte identical to the PR base. The SDK README retains its original formatting outside the Development/Testing section.
  • The Karma configuration, restored fixture, functional SDK test fixes, package scripts and dependency lockfile are unchanged by the scope reduction.
  • Runtime suites were not rerun for this formatting-only revision. The earlier combined validation is documented in fix(webapps): restore test harnesses and validate SDK calendar dates #3820; it is not an independent test result for this branch. Legacy browser execution remains unverified.
  • The repository cleanup script ran non-recursively on the root POM and reported OpenRewrite recipe-validation errors; no frontend formatting changes were introduced.

@github-actions github-actions Bot added documentation Improvements or additions to documentation lang:javascript Pull requests that update Javascript code scope:webapp Changes affecting the legacy webapps. labels Oct 22, 2026
@javahippie

Copy link
Copy Markdown
Contributor

Can you track where this config got lost and how the error was introduced?

@hauptmedia

Copy link
Copy Markdown
Collaborator Author

@javahippie I traced this through the Git history and added the findings, including the introducing commits and upstream PR links, to the Root cause and history section of the PR description.

The missing root Karma config originates from the 2023 Webpack migration: it introduced the reference without adding the file. The SDK mock fixture was deleted separately in 2021 despite still being imported by tests. The description also explains why the current Maven/Neo checks do not catch these legacy test-harness failures.

@javahippie

Copy link
Copy Markdown
Contributor

Thanks! Is it possible to remove the pure formatting changes from the PR and only keep the lines that fix the issue?

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation lang:javascript Pull requests that update Javascript code scope:webapp Changes affecting the legacy webapps.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants