Skip to content

Commit 1418a3f

Browse files
committed
Created test setup, added ally, test for Icon, bug fix in progress
1 parent 302e3fc commit 1418a3f

File tree

7 files changed

+8363
-2601
lines changed

7 files changed

+8363
-2601
lines changed

starter_app/jest.config.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import nextJest from 'next/jest.js';
2+
3+
const createJestConfig = nextJest({
4+
dir: './', // load next.config + env from project root
5+
});
6+
7+
const customJestConfig = {
8+
// Path to setup file
9+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
10+
11+
testEnvironment: 'jest-environment-jsdom',
12+
13+
// Map @/... to src/app/...
14+
moduleNameMapper: {
15+
'^@/(.*)$': '<rootDir>/src/app/$1',
16+
'^@/components/(.*)$': '<rootDir>/src/app/components/$1',
17+
'^@/utils/(.*)$': '<rootDir>/src/app/utils/$1',
18+
},
19+
20+
// Coverage – point to real paths
21+
collectCoverageFrom: [
22+
'src/app/components/**/*.{js,jsx,ts,tsx}',
23+
'src/app/utils/**/*.{js,jsx,ts,tsx}',
24+
'!**/*.d.ts',
25+
'!**/node_modules/**',
26+
'!**/.next/**',
27+
'!**/coverage/**',
28+
],
29+
30+
// Tests location
31+
testMatch: [
32+
'src/app/tests/**/*.[jt]s?(x)',
33+
'**/__tests__/**/*.[jt]s?(x)',
34+
'**/?(*.)+(spec|test).[jt]s?(x)',
35+
],
36+
37+
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
38+
39+
transformIgnorePatterns: [
40+
'/node_modules/',
41+
'^.+\\.module\\.(css|sass|scss)$',
42+
],
43+
44+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
45+
46+
coverageThreshold: {
47+
global: {
48+
branches: 70,
49+
functions: 70,
50+
lines: 70,
51+
statements: 70,
52+
},
53+
},
54+
};
55+
56+
export default createJestConfig(customJestConfig);

starter_app/jest.setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom'

0 commit comments

Comments
 (0)