diff --git a/.dockerignore b/.dockerignore index 237714d..ac0ad6d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ .git frontend/node_modules backend/build +frontend/src/__tests__ diff --git a/docker/frontend.e2e.Dockerfile b/docker/frontend.e2e.Dockerfile index 0230ab6..a9c74d9 100644 --- a/docker/frontend.e2e.Dockerfile +++ b/docker/frontend.e2e.Dockerfile @@ -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"] diff --git a/frontend/src/__tests__/ComposePage.spec.ts b/frontend/src/__tests__/ComposePage.spec.ts index 92d09fe..4ee67e6 100644 --- a/frontend/src/__tests__/ComposePage.spec.ts +++ b/frontend/src/__tests__/ComposePage.spec.ts @@ -114,6 +114,7 @@ describe('ComposePage', () => { plate: 'ABC123', status: 'pending_payment', trackingId: null, + amountPaid: 49, createdAt: '2025-01-01T00:00:00Z', }) diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index b9c6f56..bf9197a 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -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' } } diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json index 8721873..b5cd4b3 100644 --- a/frontend/tsconfig.app.json +++ b/frontend/tsconfig.app.json @@ -13,5 +13,6 @@ "@/*": ["./src/*"] } }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], + "exclude": ["src/__tests__"] } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 9dca790..24f178a 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -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'],