Skip to content

Commit 060839d

Browse files
committed
Update Jest configuration and dependencies for TypeScript support
- Enhanced `jest.config.js` to include TypeScript support by updating the `transform` regex and adding relevant coverage settings. - Added `@babel/preset-typescript` and `@types/jest` to `package.json` and `package-lock.json` to improve TypeScript compatibility and type definitions for Jest. - Updated several Babel-related packages to their latest versions for better performance and features.
1 parent 9d75e2e commit 060839d

File tree

7 files changed

+348
-148
lines changed

7 files changed

+348
-148
lines changed

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', { targets: { node: 'current' } }],
4+
'@babel/preset-typescript',
5+
],
6+
};

jest.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
/** @type {import('jest').Config} */
12
module.exports = {
3+
roots: ['<rootDir>/src', '<rootDir>/tests'],
4+
testEnvironment: 'node',
25
transform: {
3-
'^.+\\.[t|j]sx?$': 'babel-jest',
6+
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
47
},
8+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
9+
coverageDirectory: './coverage',
10+
collectCoverageFrom: ['src/**/*.js', 'src/**/*.ts'],
11+
coveragePathIgnorePatterns: ['/node_modules/', '/tests/'],
12+
testPathIgnorePatterns: ['/node_modules/'],
513
moduleNameMapper: {
614
'^kaibanjs$': '<rootDir>/dist/bundle.cjs',
715
},
816
testTimeout: 300000, // Sets global timeout to 10 seconds for all tests
9-
testEnvironment: 'node', // Use Node.js environment for executing tests,
1017
verbose: true, // Make Jest more verbose
1118
silent: false, // Ensure Jest is not silent (though this is not directly related to console.log output)
1219
// testMatch: ['**/tests/e2e/**/eventPlanningTeam.test.js'], // Run tests only in the specific directory

package-lock.json

Lines changed: 81 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"@babel/core": "^7.24.9",
114114
"@babel/plugin-syntax-import-meta": "^7.10.4",
115115
"@babel/preset-env": "^7.24.8",
116+
"@babel/preset-typescript": "^7.27.0",
116117
"@eslint/js": "^9.11.0",
117118
"@rollup/plugin-babel": "6.0.4",
118119
"@rollup/plugin-commonjs": "26.0.1",
@@ -122,6 +123,7 @@
122123
"@rollup/plugin-terser": "^0.4.4",
123124
"@rollup/plugin-typescript": "^12.1.2",
124125
"@types/init-package-json": "^1.10.3",
126+
"@types/jest": "^29.5.14",
125127
"@typescript-eslint/eslint-plugin": "^8.6.0",
126128
"@typescript-eslint/parser": "^8.6.0",
127129
"babel-jest": "^29.7.0",

0 commit comments

Comments
 (0)