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 63fc855 commit 2b894b4
Showing 1 changed file with 6 additions and 0 deletions.
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 config: Config = {
transform: {
"^.+\\.(t|j)s$": ["@swc/jest", { configFile: ".swcrc" }],
Expand All @@ -10,6 +14,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;

0 comments on commit 2b894b4

Please sign in to comment.