- Add test-results/.last-run.json to .gitignore - Remove from git tracking - Update Makefile dev target port (8080, not 8081) - Add debug logging to dev-server.mjs API proxy
This commit is contained in:
@@ -51,6 +51,9 @@ test-results-angular/
|
||||
playwright-report-angular/
|
||||
playwright-report/
|
||||
|
||||
# Test run metadata
|
||||
test-results/.last-run.json
|
||||
|
||||
# Visual parity screenshot diffs (generated)
|
||||
screenshot-diffs/
|
||||
comparison-report/
|
||||
|
||||
@@ -4,7 +4,7 @@ help:
|
||||
@echo "Aeroflot.Flights.Web — Available commands:"
|
||||
@echo ""
|
||||
@echo " Development:"
|
||||
@echo " make dev - Start Modern.js dev server (:8081)"
|
||||
@echo " make dev - Start Modern.js dev server (:8080)"
|
||||
@echo " make dev-full - Start dev server with API proxy (:8080)"
|
||||
@echo " make stop - Stop running dev server"
|
||||
@echo " make status - Check if dev server is running"
|
||||
@@ -48,8 +48,7 @@ dev-full:
|
||||
@echo "Starting dev server with API proxy in background..."
|
||||
@nohup $(PNPM) dev:full > $(LOG_FILE) 2>&1 & echo $$! > $(PID_FILE)
|
||||
@echo "Dev server started (PID: $$(cat $(PID_FILE)))"
|
||||
@echo " App: http://localhost:8080"
|
||||
@echo " API: http://localhost:8080/api/*"
|
||||
@echo " App & API: http://localhost:8080"
|
||||
@echo "View logs: make logs"
|
||||
|
||||
stop:
|
||||
|
||||
+13
-2
@@ -121,12 +121,14 @@ app.use("/map", (req, res) => {
|
||||
// Two transports: (1) direct with `--noproxy '*'` — fast path when the
|
||||
// upstream is publicly reachable; (2) through the system HTTPS_PROXY
|
||||
// (e.g. a local gost VPN tunnel) — required when the direct IP hits a
|
||||
// WAF throttle (403 deny page). Try direct first; on 403/4xx/5xx or
|
||||
// WAF throttle (403 deny page). Try direct first; on 4xx/5xx or
|
||||
// network error, retry through the proxy. Each transport keeps its own
|
||||
// cookie jar because the WAF cookie is bound to the edge node that
|
||||
// minted it.
|
||||
app.use(["/api", "/flights"], (req, res) => {
|
||||
console.log(`API proxy called for: ${req.originalUrl}`);
|
||||
const targetUrl = `${API_TARGET}${req.originalUrl}`;
|
||||
console.log(`targetUrl: ${targetUrl}`);
|
||||
|
||||
const buildArgs = (noproxy) => [
|
||||
"-s",
|
||||
@@ -154,7 +156,9 @@ app.use(["/api", "/flights"], (req, res) => {
|
||||
});
|
||||
|
||||
function execCurlWithFallback(buildArgs, extraArgs, res) {
|
||||
console.log(`execCurlWithFallback called`);
|
||||
runCurl([...extraArgs, ...buildArgs(true)], (direct) => {
|
||||
console.log(`execCurlWithFallback: direct result, isSuccessful=${isSuccessfulUpstream(direct)}`);
|
||||
if (isSuccessfulUpstream(direct)) {
|
||||
respondWithCurlResult(direct, res);
|
||||
return;
|
||||
@@ -168,7 +172,10 @@ function execCurlWithFallback(buildArgs, extraArgs, res) {
|
||||
}
|
||||
|
||||
function runCurl(args, cb) {
|
||||
execFile("/usr/bin/curl", args, { maxBuffer: 10 * 1024 * 1024, timeout: 30000 }, (err, stdout) => {
|
||||
console.log(`runCurl: args=${JSON.stringify(args).substring(0, 200)}...`);
|
||||
execFile("/usr/bin/curl", args, { maxBuffer: 10 * 1024 * 1024, timeout: 30000 }, (err, stdout, stderr) => {
|
||||
console.log(`runCurl callback: err=${!!err}, stdout length=${stdout ? stdout.length : 0}, stderr length=${stderr ? stderr.length : 0}`);
|
||||
console.log(`runCurl stdout preview: ${stdout ? stdout.substring(0, 200) : 'null'}`);
|
||||
cb({ err, stdout: stdout ?? "" });
|
||||
});
|
||||
}
|
||||
@@ -182,6 +189,7 @@ function isSuccessfulUpstream({ err, stdout }) {
|
||||
}
|
||||
|
||||
function respondWithCurlResult({ err, stdout }, res) {
|
||||
console.log(`respondWithCurlResult: err=${!!err}, stdout length=${stdout ? stdout.length : 0}`);
|
||||
if (err) {
|
||||
res.status(502).json({ error: err.message });
|
||||
return;
|
||||
@@ -199,6 +207,9 @@ function respondWithCurlResult({ err, stdout }, res) {
|
||||
|
||||
const isJson = body.trimStart().startsWith("{") || body.trimStart().startsWith("[");
|
||||
|
||||
console.log(`isJson=${isJson}, status=${status}, body length=${body.length}`);
|
||||
console.log(`body preview: ${body.substring(0, 200)}`);
|
||||
|
||||
res.status(status);
|
||||
res.set("Content-Type", isJson ? "application/json" : "text/html");
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"failedTests": []
|
||||
}
|
||||
Reference in New Issue
Block a user