Skip to content

fix(test): repair frontend test suite under webpack 5#33

Merged
jaschadub merged 2 commits into
masterfrom
fix/frontend-tests-webpack5
May 30, 2026
Merged

fix(test): repair frontend test suite under webpack 5#33
jaschadub merged 2 commits into
masterfrom
fix/frontend-tests-webpack5

Conversation

@jaschadub

Copy link
Copy Markdown
Member

Summary

The frontend puppeteer suite (npm test) has been red on master since the webpack 5 upgrade (#30), which explicitly deferred running it. webpack 5 dropped automatic Node-core polyfills, so the browser test bundle no longer compiled/ran. This was also the blocker that forced #31 and #32 to be pushed with --no-verify.

Changes

Polyfill assert + process (test bundle only)
Every test file import assert from 'assert'. Added assert via resolve.fallback and process via ProvidePlugin (the assert polyfill references process at runtime). Both are lazy/test-only — verified absent from the production app bundle (app.js size unchanged, no process/browser in prod output).

Freeze the http_ece reference as a golden vector
streaming-tests.js used http_ece (a Node-only lib) as a live reference oracle for ECE encryption. Running it in-browser dragged in node:cryptocrypto-browserifyasn1.jsvm, and then failed at runtime because the buffer polyfill can't decode base64url (which http_ece uses for its key/salt). Replaced the live call with the http_ece reference ciphertext frozen as a golden vector (ECE/aes128gcm per RFC 8188 is a stable format). This drops the crypto-browserify / stream-browserify / vm-browserify polyfills entirelyhttp_ece was their only consumer.

Remove dead reportLink in fileReceiver.js
It imported a symbol api.js never exported (git history shows reportLink was never in api.js). webpack 4 silently made it undefined; webpack 5 errors. Nothing calls the method and there's no server report route — leftover from upstream Firefox Send. Removed the import and the unused method.

Test plan

  • npm testgreen: 48 backend + 23 frontend passing, 0 failing (this PR was pushed with the pre-push hook, no --no-verify)
  • npm run build — both targets green
  • npm run lint:js / lint:css — 0 errors
  • prod app.js unchanged in size; process/assert polyfills confirmed test-bundle-only
  • full upload + password-protected download E2E passes (covers the fileReceiver.js change)

Recommend merging this first; it un-reds npm test so #31 (audit) and #32 (mobile modal) get clean CI.

jaschadub added 2 commits May 28, 2026 16:37
The frontend puppeteer suite (npm test) has been red since the webpack 5
upgrade (#30), which deferred running it. webpack 5 dropped automatic
node-core polyfills, so the browser test bundle failed to compile/run.

- Polyfill `assert` (imported by every test file) via resolve.fallback,
  and provide `process` (the assert polyfill references it at runtime)
  through ProvidePlugin. Both are lazy/test-only and stay out of the
  production app bundle (verified: app.js unchanged, no process/browser
  in the prod output).

- streaming-tests.js used http_ece (a Node-only lib) as a live reference
  oracle. Running it in-browser dragged in node:crypto → crypto-browserify
  → asn1.js → vm, and ultimately failed because the buffer polyfill can't
  decode base64url. Replace the live call with the http_ece reference
  ciphertext frozen as a golden vector (ECE/aes128gcm per RFC 8188 is
  stable). This drops the crypto/stream/vm polyfills entirely.

- Remove the dead `reportLink` import + method in fileReceiver.js. It
  imported a symbol api.js never exported (webpack 4 silently made it
  undefined; webpack 5 errors). Nothing calls it and there's no server
  report route — leftover from upstream Firefox Send.

Verified: npm test green (48 backend + 23 frontend), prod build green,
lint clean, full upload + password-protected download E2E passes.
@jaschadub
jaschadub merged commit 42659cd into master May 30, 2026
1 of 3 checks passed
@jaschadub
jaschadub deleted the fix/frontend-tests-webpack5 branch May 30, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant