Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const nextJest = require('next/jest')

// next/jest loads next.config.js (which validates required env vars) before any
// setup file runs, so provide a default here for the test environment.
process.env.NEXT_PUBLIC_API_URL =
process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
Expand All @@ -17,6 +22,9 @@ const customJestConfig = {
'!src/**/*.d.ts',
'!src/**/*.stories.{js,jsx,ts,tsx}',
'!src/**/__tests__/**',
// Framework entry/infra covered by the build + Playwright e2e, not unit tests:
'!src/app/**', // RootLayout / page entry (async server components)
'!src/proxy.ts', // edge middleware (runs in the edge runtime)
],
coverageThreshold: {
global: {
Expand All @@ -30,7 +38,8 @@ const customJestConfig = {
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[jt]s?(x)',
],
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
// e2e/*.spec.ts are Playwright tests, run via `npm run test:e2e` (not Jest).
testPathIgnorePatterns: ['/node_modules/', '/.next/', '<rootDir>/e2e/'],
transformIgnorePatterns: [
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
Expand Down
3 changes: 2 additions & 1 deletion frontend/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
36 changes: 3 additions & 33 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const envResult = envSchema.safeParse({
});

if (!envResult.success) {
const issues = envResult.error.errors
const issues = envResult.error.issues
.map((e) => ` - ${e.path.join('.')}: ${e.message}`)
.join('\n');
throw new Error(`\nMissing or invalid environment variables:\n${issues}\n`);
Expand All @@ -27,38 +27,8 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({

/** @type {import('next').NextConfig} */
const nextConfig = {
// Enable code splitting and optimization
swcMinify: true,

// Optimize bundle size
webpack: (config, { isServer }) => {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
cacheGroups: {
default: false,
vendors: false,
// Vendor chunk
vendor: {
filename: 'chunks/vendor.js',
test: /node_modules/,
priority: 10,
reuseExistingChunk: true,
enforce: true,
},
// Common chunk
common: {
minChunks: 2,
priority: 5,
reuseExistingChunk: true,
filename: 'chunks/common.js',
},
},
},
};
return config;
},
// Next.js 16 uses Turbopack by default, which handles chunk splitting
// and minification automatically (no swcMinify / custom webpack needed).

// Enable experimental features for better performance
experimental: {
Expand Down
Loading
Loading