Skip to content

Commit

Permalink
chore(config): improve Jest and TypeScript config for module resolution
Browse files Browse the repository at this point in the history
- Jest config:
  - Add testPathIgnorePatterns to exclude mock codebase
  - Replace moduleDirectories with modulePaths for better module finding

- TypeScript config:
  - Add baseUrl and paths
  - Include src/**/* files explicitly
  - Exclude test files and node_modules from compilation
  • Loading branch information
ozhanefemeral committed Jul 20, 2024
1 parent 4b5b4eb commit 23491cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const config: Config.InitialOptions = {
testEnvironment: "node",
roots: ["<rootDir>/src"],
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
testPathIgnorePatterns: [
"/node_modules/",
"/__tests__/scanner-mock-codebase/",
],
transform: {
"^.+\\.ts$": [
"ts-jest",
Expand All @@ -14,7 +18,7 @@ const config: Config.InitialOptions = {
],
},
moduleFileExtensions: ["ts", "js", "json", "node"],
moduleDirectories: ["node_modules", "src"],
modulePaths: ["<rootDir>", "<rootDir>/src"],
};

export default config;
10 changes: 8 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true,
"lib": ["es2022"]
}
"lib": ["es2022"],
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"]
}

0 comments on commit 23491cb

Please sign in to comment.