Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
87 changes: 42 additions & 45 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,52 @@ const nextJest = require('next/jest');

// Tell Next.js where the app lives
const createJestConfig = nextJest({
dir: './',
dir: './',
});

/** @type {import('jest').Config} */
const customJestConfig = {
// Required for testing React components
testEnvironment: 'jest-environment-jsdom',

// Testing Library setup (matchers like toBeInTheDocument)
setupFilesAfterEnv: ['<rootDir>/tests/setup-jest.ts'],

// Support @/ path aliases (same as tsconfig.json)
moduleNameMapper: {
'^@/components/(.*)$': '<rootDir>/components/$1',
'^@/lib/(.*)$': '<rootDir>/lib/$1',
'^@/types/(.*)$': '<rootDir>/types/$1',
'^@/hooks/(.*)$': '<rootDir>/hooks/$1',
'^@/utils/(.*)$': '<rootDir>/utils/$1',
'^@/app/(.*)$': '<rootDir>/app/$1',
'^@/config/(.*)$': '<rootDir>/config/$1',
'^@/(.*)$': '<rootDir>/src/$1',
},

// Where Jest should look for tests
testMatch: [
'<rootDir>/tests/**/*.test.{ts,tsx}',
'<rootDir>/components/**/**tests**/**/*.test.{ts,tsx}',
],

// Ignore build + dependencies
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>/node_modules/',
],

// Ignore unrelated nested projects
modulePathIgnorePatterns: [
'<rootDir>/GroqTales/',
'<rootDir>/src/blockchain/alchemy/node_modules/',
],

// Coverage (optional but useful for PR reviewers)
collectCoverageFrom: [
'app/**/*.{ts,tsx}',
'components/**/*.{ts,tsx}',
'lib/**/*.{ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
// Required for testing React components
testEnvironment: 'jest-environment-jsdom',

// Testing Library setup (matchers like toBeInTheDocument)
setupFilesAfterEnv: ['<rootDir>/tests/setup-jest.ts'],

// Support @/ path aliases (same as tsconfig.json)
moduleNameMapper: {
'^@/components/(.*)$': '<rootDir>/components/$1',
'^@/lib/(.*)$': '<rootDir>/lib/$1',
'^@/types/(.*)$': '<rootDir>/types/$1',
'^@/hooks/(.*)$': '<rootDir>/hooks/$1',
'^@/utils/(.*)$': '<rootDir>/utils/$1',
'^@/app/(.*)$': '<rootDir>/app/$1',
'^@/config/(.*)$': '<rootDir>/config/$1',
'^@/(.*)$': '<rootDir>/src/$1',
},

// Where Jest should look for tests
testMatch: [
'<rootDir>/tests/**/*.test.{ts,tsx}',
'<rootDir>/components/**/**tests**/**/*.test.{ts,tsx}',
],

// Ignore build + dependencies
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],

// Ignore unrelated nested projects
modulePathIgnorePatterns: [
'<rootDir>/GroqTales/',
'<rootDir>/src/blockchain/alchemy/node_modules/',
],

// Coverage (optional but useful for PR reviewers)
collectCoverageFrom: [
'app/**/*.{ts,tsx}',
'components/**/*.{ts,tsx}',
'lib/**/*.{ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
};

// Export Next-aware Jest config
Expand Down
9 changes: 4 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ const nextConfig = {
},
];
},
async rewrites() {
async rewrites() {
const envUrl = process.env.NEXT_PUBLIC_API_URL;
const apiUrl = (envUrl && envUrl.startsWith('http'))
? envUrl
: 'http://localhost:3001';
const apiUrl =
envUrl && envUrl.startsWith('http') ? envUrl : 'http://localhost:3001';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

return [
{
Expand Down Expand Up @@ -159,7 +158,7 @@ const nextConfig = {

// TypeScript configuration
typescript: {
ignoreBuildErrors:true,
ignoreBuildErrors: true,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
},

// ESLint configuration
Expand Down
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"@simplewebauthn/types": "^12.0.0",
"@tanstack/react-query": "^5.74.3",
"@uploadthing/react": "^7.1.0",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.36.2",
"@web3modal/wagmi": "^4.0.0-alpha.0",
"alchemy-sdk": "^3.5.7",
Expand Down
Loading
Loading