Skip to content

Commit

Permalink
fix(jest): add ts-jest to make it work with ts-paths in lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Hernandez Pellicer committed Jan 25, 2024
1 parent 73234aa commit 3f66273
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { Config } from "jest";

import { pathsToModuleNameMapper } from "ts-jest";

import { compilerOptions } from "./tsconfig.json";

const MIN_COVERAGE = 80;

const config: Config = {
Expand All @@ -20,6 +24,8 @@ const config: Config = {
collectCoverageFrom: ["src/**/*.ts"],
setupFiles: ["<rootDir>.jest/set-env-vars.ts"],
clearMocks: true,
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
};

export default config;
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"@src/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist"],
"exclude": ["node_modules", "dist"]
}

0 comments on commit 3f66273

Please sign in to comment.