fix(test): repair frontend test suite under webpack 5#33
Merged
Conversation
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.
…webpack5 # Conflicts: # package-lock.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The frontend puppeteer suite (
npm test) has been red onmastersince 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'. Addedassertviaresolve.fallbackandprocessviaProvidePlugin(theassertpolyfill referencesprocessat runtime). Both are lazy/test-only — verified absent from the production app bundle (app.jssize unchanged, noprocess/browserin prod output).Freeze the http_ece reference as a golden vector
streaming-tests.jsusedhttp_ece(a Node-only lib) as a live reference oracle for ECE encryption. Running it in-browser dragged innode:crypto→crypto-browserify→asn1.js→vm, and then failed at runtime because thebufferpolyfill can't decodebase64url(which http_ece uses for its key/salt). Replaced the live call with the http_ece reference ciphertext frozen as a golden vector (ECE/aes128gcmper RFC 8188 is a stable format). This drops thecrypto-browserify/stream-browserify/vm-browserifypolyfills entirely —http_ecewas their only consumer.Remove dead
reportLinkinfileReceiver.jsIt imported a symbol
api.jsnever exported (git history showsreportLinkwas never inapi.js). webpack 4 silently made itundefined; 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 test— green: 48 backend + 23 frontend passing, 0 failing (this PR was pushed with the pre-push hook, no--no-verify)npm run build— both targets greennpm run lint:js/lint:css— 0 errorsapp.jsunchanged in size;process/assertpolyfills confirmed test-bundle-onlyfileReceiver.jschange)