fix: E2E pipeline — vite preview instead of nginx, ts build fixes
Three problems caused E2E browser tests to fail in Forgejo CI:
1. TypeScript build errors in (frontend.e2e.Dockerfile):
- used parameter property which violates
. Replaced with explicit property declaration.
- included in type-checking, causing
mock Response type mismatches. Added .
- mock Order was missing field.
2. Nginx SSL crash:
- copied production
which references SSL certs that don't exist in the e2e image.
- Replaced nginx entirely with (simpler, no SSL needed).
- Added to so routes to backend.
3. Docker context hygiene:
- excludes so test files don't
bloat the build context or trigger type errors in the container.
All other files untouched.
This commit is contained in:
parent
5abb5bc2e9
commit
e8530b8d95
6 changed files with 16 additions and 11 deletions
|
|
@ -3,3 +3,4 @@
|
|||
.git
|
||||
frontend/node_modules
|
||||
backend/build
|
||||
frontend/src/__tests__
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
FROM node:24-alpine AS builder
|
||||
FROM node:24-alpine
|
||||
WORKDIR /app
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
CMD ["npx", "vite", "preview", "--host", "0.0.0.0", "--port", "80"]
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ describe('ComposePage', () => {
|
|||
plate: 'ABC123',
|
||||
status: 'pending_payment',
|
||||
trackingId: null,
|
||||
amountPaid: 49,
|
||||
createdAt: '2025-01-01T00:00:00Z',
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const API_BASE = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
export class ApiError extends Error {
|
||||
constructor(
|
||||
public status: number,
|
||||
message: string,
|
||||
) {
|
||||
status: number
|
||||
|
||||
constructor(status: number, message: string) {
|
||||
super(message)
|
||||
this.status = status
|
||||
this.name = 'ApiError'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@
|
|||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"exclude": ["src/__tests__"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ export default defineConfig({
|
|||
'/api': 'http://backend:8080',
|
||||
},
|
||||
},
|
||||
preview: {
|
||||
port: 80,
|
||||
proxy: {
|
||||
'/api': 'http://backend:8080',
|
||||
},
|
||||
},
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['src/__tests__/setup.ts'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue