Skip to content

Commit

Permalink
build: Add jest-canvas-mock and update config
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinerer committed Dec 11, 2024
1 parent c560863 commit 6a82301
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
testEnvironment: 'jsdom', // 'node'
roots: ['<rootDir>'],
setupFilesAfterEnv: ['@testing-library/jest-dom'],
setupFiles: ['jest-canvas-mock'],
testMatch: ['**/__tests__/**/*.[jt]s', '**/?(*.)+(spec|test).[jt]s'],
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true }],
Expand All @@ -14,7 +15,7 @@ export default {
'^@lib/(.*)$': '<rootDir>/libs/$1',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
// collectCoverage: true,
// collectCoverage: true, // 是否显示覆盖率报告
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"execa": "^9.5.1",
"fast-glob": "^3.3.2",
"jest": "^29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.10",
"minimist": "^1.2.8",
Expand Down
43 changes: 25 additions & 18 deletions pnpm-lock.yaml

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

0 comments on commit 6a82301

Please sign in to comment.