Add Jest configuration and update TypeScript dependency
This commit is contained in:
43
jest.config.cjs
Normal file
43
jest.config.cjs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user