Skip to content

Commit

Permalink
refactor: write jest config in ts (#485)
Browse files Browse the repository at this point in the history
* refactor: write jest config in ts

Signed-off-by: Rui Chen <rui@chenrui.dev>

* chore: exclude jest.config.ts in tsconfig

Signed-off-by: Rui Chen <rui@chenrui.dev>

* chore: run build

Signed-off-by: Rui Chen <rui@chenrui.dev>

---------

Signed-off-by: Rui Chen <rui@chenrui.dev>
  • Loading branch information
chenrui333 authored Jul 18, 2024
1 parent f808f15 commit 20adb42
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions jest.config.js

This file was deleted.

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

const config: JestConfigWithTsJest = {
preset: 'ts-jest/presets/default-esm',
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest',
},
verbose: true,
};

export default config;
160 changes: 155 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"jest": "^29.3.1",
"jest-circus": "^29.3.1",
"prettier": "3.3.3",
"ts-jest": "^29.2.2",
"ts-jest": "^29.2.3",
"ts-node": "^10.9.2",
"typescript": "^5.5.3",
"typescript-formatter": "^7.2.2"
}
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}
"exclude": ["node_modules", "**/*.test.ts", "jest.config.ts"]
}

0 comments on commit 20adb42

Please sign in to comment.