Repository navigation
Serve the E2E mock server with node:http instead of express - #104
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
An unhandled asynchronous read-stream error if the archive disappears after statSync can terminate the test runner instead of failing only the download request.
1 open issue
What changed in this PR
Replaces the E2E mock CodePush server’s Express implementation with Node’s built-in HTTP module, reducing test dependencies without changing the public library API.
Changes:
- Adds explicit routing, JSON request parsing, and response helpers for the five mock endpoints.
- Preserves raw-string update responses and explicit download
Content-Lengthheaders. - Removes Express, body-parser, and their unused transitive dependencies.
| File | Description |
|---|---|
package.json |
Removes Express and body-parser development dependencies. |
package-lock.json |
Removes the corresponding unused dependency entries. |
code-push-plugin-testing-framework/script/serverUtil.js |
Implements the mock server using Node HTTP and filesystem APIs. |
Review effort: Balanced
| "Content-Length": stats.size, | ||
| "Content-Disposition": "attachment; filename=\"" + path.basename(filePath) + "\"" | ||
| }); | ||
| fs.createReadStream(filePath).pipe(res); |
Collaborator
Author
There was a problem hiding this comment.
The server has five fixed routes, and the test app sends only JSON bodies, so express and body-parser do not earn their roughly 30 transitive packages. The download route sends Content-Length because the native downloaders compare it with the received byte count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ofalvai
force-pushed
the
push-pvuxxrzqqyxt
branch
from
November 3, 2026 11:09
4fe31d3 to
be17ec0
Compare
gsanta
approved these changes
Nov 3, 2026
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.

The E2E tests need a CodePush server to talk to, so they start a small fake one on localhost. The real app, running in a simulator or emulator, asks it for updates, downloads the bundle from it, and reports status back. That fake server was built on
expressandbody-parser. This PR rewrites it on Node's built-inhttpmodule and drops both packages.Why
The server has five fixed routes and the app only ever sends JSON. Express's routing, middleware and body parsing go unused, yet the two packages bring about 30 transitive dependencies. Removing them shrinks the lockfile by about 390 lines.
What the server does, and what stays the same
Every route behaves as before:
GET update_checkGET report_status/downloadPOST report_status/downloadandreport_status/deployPOST /reportTestMessageA few details needed care, because the native code on the other end is picky:
Content-Lengthheader. Express added it for us. The native downloaders check the received byte count against it, so a response without it would fail the download.🤖 Generated with Claude Code