Fix allstrides frontend dev proxy port and broken smoke test - #63
Open
rootkiller6788 wants to merge 1 commit into
Open
Fix allstrides frontend dev proxy port and broken smoke test#63rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
The CRA dev proxy (src/setupProxy.js) still targets port 8000, which was left over from the pre-migration Python backend. The TypeScript Express server listens on 8080 (see index.ts, README, Dockerfile and docker-compose.yml), so all /api calls and WebSocket upgrades fail in frontend dev mode. Point the proxy at 127.0.0.1:8080. Also fix the frontend test suite, which could not run at all: - App.test.tsx still asserted the default CRA "learn react" text that no longer exists; assert the actual landing page heading instead. - react-router-dom is pinned to v6 and axios is mapped to its CommonJS build in the jest config because react-scripts 5 uses jest 27, which cannot resolve the exports-only/ESM packaging of react-router-dom v7 and axios 1.13. The app only uses v6-compatible APIs (BrowserRouter, Routes, Route, Link, useNavigate, useParams). Verified: CI=true npx react-scripts test --watchAll=false passes and npm run build succeeds.
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.
What
Two fixes for the allstrides example frontend developer tooling, both found by inspecting the code (no issue was filed).
1. Dev proxy targets a dead port
examples/allstrides/frontend/src/setupProxy.jsproxies/api(withws: true) tohttp://127.0.0.1:8000. That port is a leftover from the original Python FastAPI backend this app was migrated off of. The TypeScript/Express server listens on 8080 by default (server/src/index.ts), and every other artifact in the example agrees (README.md,Dockerfile,docker-compose.yml,start_allstrides.sh). A port search confirms8000appears nowhere else in the example. When running the CRA dev server (npm startinfrontend/), all API calls and WebSocket upgrades fail with connection refused.2. The frontend test suite cannot run at all
npm testwas completely broken under the pinnedreact-scripts@5(jest 27):App.test.tsxwas still the default CRA smoke test asserting"learn react", which the rewritten app never renders.react-router-dom@7ships anexports-only package (its declaredmain: ./dist/main.jsis absent from the published tarball), which jest 27's resolver cannot load.axios@1.13ships an ESM-onlymain, which jest 27 cannotrequireeither.The fix pins
react-router-domto the v6 line (the app uses only v6-compatible APIs), mapsaxiosto its CommonJS build via thejestconfig inpackage.json, and updates the smoke test to assert the real landing page heading (Welcome to AllStrides).Verification
CI=true npx react-scripts test --watchAll=false→ PASS (1 suite, 1 test)npm run build→ succeeds (production build unchanged)8000appears only insetupProxy.js;8080is the default inserver/src/index.ts:40and every config file.Scope
examples/allstrides/frontend/only:src/setupProxy.js,src/App.test.tsx,package.json,package-lock.json.