Skip to content

Commit

Permalink
feat: migrate from Vitest to Jest for testing framework
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaz committed Nov 14, 2024
1 parent c395d05 commit 124a4ec
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
"node_modules/*",
"expressots.config.ts",
"commitlint.config.ts",
"vitest.config.ts",
"jest.config.ts",
".eslintrc.cjs",
"coverage/*",
],
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ expressots.config.ts

*.container.ts

coverage/
coverage/
.early.coverage
24 changes: 24 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { JestConfigWithTsJest } from "ts-jest";

const config: JestConfigWithTsJest = {
testEnvironment: "node",
roots: ["<rootDir>/src"],
testRegex: ".*\\.spec\\.ts$",
testPathIgnorePatterns: ["/node_modules/", "/bin/"],
collectCoverageFrom: ["src/**/*.ts", "!**/*.spec.ts", "src/**/index.ts"],
moduleNameMapper: {
"^@src/(.*)$": "<rootDir>/src/$1",
},
setupFiles: ["reflect-metadata"],
transform: {
"^.+\\.ts$": [
"ts-jest",
{
tsconfig: "tsconfig.json",
// Add any ts-jest specific options here
},
],
},
};

export default config;
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"lint": "eslint \"./src/**/*.ts\"",
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
"release": "release-it",
"test": "vitest run --reporter default",
"test:watch": "vitest",
"coverage": "vitest run --coverage"
"test": "jest",
"coverage": "jest --coverage",
"test:watch": "jest --watch"
},
"dependencies": {
"@expressots/boost-ts": "1.3.0",
Expand All @@ -66,32 +66,31 @@
"@codecov/vite-plugin": "^0.0.1-beta.9",
"@commitlint/cli": "19.2.1",
"@commitlint/config-conventional": "19.1.0",
"@expressots/shared": "file:../shared/expressots-shared-0.0.1-beta.1.tgz",
"@expressots/shared": "0.1.0",
"@release-it/conventional-changelog": "7.0.2",
"@types/chalk-animation": "1.6.1",
"@types/cli-progress": "3.11.0",
"@types/degit": "2.8.3",
"@types/inquirer": "9.0.3",
"@types/jest": "^29.5.14",
"@types/mustache": "4.2.2",
"@types/node": "20.12.7",
"@types/yargs": "17.0.22",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
"@vitest/coverage-v8": "1.4.0",
"chalk": "4.1.2",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"husky": "9.0.11",
"jest": "^29.7.0",
"prettier": "3.2.5",
"reflect-metadata": "0.2.2",
"release-it": "16.3.0",
"rimraf": "5.0.5",
"shx": "0.3.4",
"ts-jest": "^29.2.5",
"ts-node-dev": "2.0.0",
"typescript": "5.2.2",
"vite": "5.2.8",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.4.0"
"typescript": "5.2.2"
},
"release-it": {
"git": {
Expand Down
7 changes: 0 additions & 7 deletions src/commands/__tests__/project.commands.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": ["node", "reflect-metadata", "vitest/globals"]
"types": ["node", "reflect-metadata", "jest"]
},
"include": ["./src/**/*.ts"],
"exclude": ["node_modules", "test/**/*.spec.ts", "./bin/**/*"]
Expand Down
41 changes: 0 additions & 41 deletions vitest.config.ts

This file was deleted.

0 comments on commit 124a4ec

Please sign in to comment.