add base jest setup

This commit is contained in:
mightypanders 2023-06-24 19:11:12 +02:00
parent e52e845851
commit f41194ba71
3 changed files with 43 additions and 9 deletions

18
jest.config.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
'roots': [
'<rootDir>/tests',
'<rootDir>/server'
],
'transform': {
'^.+\\.tsx?$': 'ts-jest'
},
'testRegex': '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
'moduleFileExtensions': [
'ts',
'tsx',
'js',
'jsx',
'json',
'node'
],
};

27
package-lock.json generated
View File

@ -30,12 +30,13 @@
"winston": "^3.8.2"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.38.0",
"jest": "^29.5.0",
"jest-cli": "^29.5.0",
"mockdate": "^3.0.5",
"nodemon": "^2.0.22",
"rimraf": "^5.0.0",
"ts-jest": "^29.1.0"
@ -1568,9 +1569,9 @@
}
},
"node_modules/@types/jest": {
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz",
"integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==",
"version": "29.5.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.2.tgz",
"integrity": "sha512-mSoZVJF5YzGVCk+FsDxzDuH7s+SCkzrgKZzf0Z0T2WudhBUPoF6ktoTPC4R0ZoCPCV5xUvuU6ias5NvxcBcMMg==",
"dev": true,
"dependencies": {
"expect": "^29.0.0",
@ -4989,6 +4990,12 @@
"node": ">=10"
}
},
"node_modules/mockdate": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/mockdate/-/mockdate-3.0.5.tgz",
"integrity": "sha512-iniQP4rj1FhBdBYS/+eQv7j1tadJ9lJtdzgOpvsOHng/GbcDh2Fhdeq+ZRldrPYdXvCyfFUmFeEwEGXZB5I/AQ==",
"dev": true
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -8139,9 +8146,9 @@
}
},
"@types/jest": {
"version": "29.5.0",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz",
"integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==",
"version": "29.5.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.2.tgz",
"integrity": "sha512-mSoZVJF5YzGVCk+FsDxzDuH7s+SCkzrgKZzf0Z0T2WudhBUPoF6ktoTPC4R0ZoCPCV5xUvuU6ias5NvxcBcMMg==",
"dev": true,
"requires": {
"expect": "^29.0.0",
@ -10720,6 +10727,12 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"mockdate": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/mockdate/-/mockdate-3.0.5.tgz",
"integrity": "sha512-iniQP4rj1FhBdBYS/+eQv7j1tadJ9lJtdzgOpvsOHng/GbcDh2Fhdeq+ZRldrPYdXvCyfFUmFeEwEGXZB5I/AQ==",
"dev": true
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",

View File

@ -33,15 +33,18 @@
"debuggable": "node build/index.js --inspect-brk",
"monitor": "nodemon build/index.js",
"lint": "eslint . --ext .ts",
"lint-fix": "eslint . --ext .ts --fix"
"lint-fix": "eslint . --ext .ts --fix",
"test": "jest",
"test-watch": "jest --watch"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.38.0",
"jest": "^29.5.0",
"jest-cli": "^29.5.0",
"mockdate": "^3.0.5",
"nodemon": "^2.0.22",
"rimraf": "^5.0.0",
"ts-jest": "^29.1.0"