Add Jest configuration and update TypeScript dependency

This commit is contained in:
jango-blockchained
2024-12-17 16:21:19 +01:00
parent 26f6e155dd
commit a6fc9397db
2 changed files with 44 additions and 1 deletions

43
jest.config.cjs Normal file
View File

@@ -0,0 +1,43 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
'^@src/(.*)$': '<rootDir>/src/$1',
'^@tests/(.*)$': '<rootDir>/__tests__/$1',
'^(\\.{1,2}/.*)\\.js$': '$1'
},
roots: [
'<rootDir>/src',
'<rootDir>/__tests__'
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
tsconfig: './tsconfig.json'
}]
},
extensionsToTreatAsEsm: ['.ts', '.tsx'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
resolver: '<rootDir>/jest-resolver.cjs',
transformIgnorePatterns: [
'node_modules/(?!(@digital-alchemy|litemcp|semver|zod)/)'
],
modulePathIgnorePatterns: [
'<rootDir>/dist/'
],
testEnvironmentOptions: {
experimentalVmModules: true
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
globals: {
'ts-jest': {
useESM: true,
tsconfig: {
allowJs: true,
esModuleInterop: true
}
}
}
};

View File

@@ -30,7 +30,7 @@
"semver": "^6.3.1", "semver": "^6.3.1",
"ts-jest": "^28.0.8", "ts-jest": "^28.0.8",
"tsx": "^4.19.2", "tsx": "^4.19.2",
"typescript": "^4.9.5" "typescript": "^5.7.2"
}, },
"author": "Jango Blockchained", "author": "Jango Blockchained",
"license": "MIT" "license": "MIT"