Skip to content

Commit

Permalink
chore: remove ts-jest to use fully swc also for ts paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Hernandez Pellicer committed Jan 20, 2024
1 parent 98c7e05 commit b8e8b50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"paths": {
"@src/*": ["src/*"],
"@core/*": ["src/core/*"],
"@contexts/*": ["src/contexts/*"],
"@contexts/*": ["src/contexts/*"]
}
},
"module": {
"type": "commonjs"
}
},
"minify": false
}
12 changes: 5 additions & 7 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import type { JestConfigWithTsJest } from "ts-jest";
import { pathsToModuleNameMapper } from "ts-jest";
import fs from "fs-extra";
import type { Config } from "jest";

import { compilerOptions } from "./tsconfig.json";
const swcConfig = JSON.parse(fs.readFileSync(`${__dirname}/.swcrc`, "utf-8"));

const config: JestConfigWithTsJest = {
const config: Config = {
transform: {
"^.+\\.(t|j)s$": "@swc/jest",
"^.+\\.(t|j)s$": ["@swc/jest", swcConfig],
},
testEnvironment: "node",
cacheDirectory: ".tmp/jestCache",
collectCoverage: true,
collectCoverageFrom: ["src/**/*.ts"],
setupFiles: ["<rootDir>.jest/set-env-vars.ts"],
clearMocks: true,
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
};

export default config;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"supertest": "^6.3.4",
"ts-jest": "^29.1.1",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
Expand Down

0 comments on commit b8e8b50

Please sign in to comment.