From 1478a2dbf58a036a70a3d3788dd0d958316cf57d Mon Sep 17 00:00:00 2001 From: moyin <244344649@qq.com> Date: Sat, 13 Dec 2025 16:19:57 +0800 Subject: [PATCH] =?UTF-8?q?test=EF=BC=9A=E6=B7=BB=E5=8A=A0=20Jest=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=A1=86=E6=9E=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 配置 TypeScript 支持和模块解析 - 设置测试文件匹配规则和覆盖率收集 - 支持日志系统的单元测试运行 --- jest.config.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..3362150 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,16 @@ +module.exports = { + moduleFileExtensions: ['js', 'json', 'ts'], + rootDir: 'src', + testRegex: '.*\\.spec\\.ts$', + transform: { + '^.+\\.(t|j)s$': 'ts-jest', + }, + collectCoverageFrom: [ + '**/*.(t|j)s', + ], + coverageDirectory: '../coverage', + testEnvironment: 'node', + moduleNameMapper: { + '^src/(.*)$': '/$1', + }, +}; \ No newline at end of file