Skip to content

Commit 4cfaab9

Browse files
feat: change all tests to Jest (#625)
* feat: change all tests to Jest * feat: fix tests in docker * feat: fix async tests * feat: add forceExit to jest * feat: remove leaked-handles * fix: remove mocha in vscode files --------- Co-authored-by: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com>
1 parent 79d61ce commit 4cfaab9

19 files changed

+13068
-23805
lines changed

.eslintrc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ extends:
1616
- plugin:import/warnings
1717
- plugin:import/typescript
1818
- plugin:prettier/recommended
19-
- plugin:chai-friendly/recommended
2019
- prettier
2120

2221
plugins:
@@ -33,7 +32,6 @@ settings:
3332

3433
env:
3534
es6: true
36-
mocha: true
3735
node: true
3836

3937
rules:

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"foxundermoon.shell-format",
1010
"pascalreitermann93.vscode-yaml-sort",
1111
"quicktype.quicktype",
12-
"hbenl.vscode-mocha-test-adapter",
1312
"redhat.vscode-yaml",
1413
"xyz.local-history"
1514
]

.vscode/launch.json

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,6 @@
1818
"cwd": "${workspaceRoot}",
1919
"envFile": ".env",
2020
"console": "integratedTerminal"
21-
},
22-
{
23-
"name": "Mocha all",
24-
"type": "node",
25-
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
26-
"request": "launch",
27-
"program": "${workspaceRoot}/node_modules/.bin/ts-mocha",
28-
"args": ["src/**/*.test.ts", "--timeout", "999999", "--exit"],
29-
"console": "integratedTerminal",
30-
"internalConsoleOptions": "neverOpen"
31-
},
32-
{
33-
"name": "Mocha Current File",
34-
"type": "node",
35-
"request": "launch",
36-
"program": "${workspaceRoot}/node_modules/.bin/ts-mocha",
37-
"args": ["${file}", "--timeout", "999999"],
38-
"console": "integratedTerminal",
39-
"internalConsoleOptions": "neverOpen"
40-
},
41-
{
42-
"name": "Mocha dist all",
43-
"type": "node",
44-
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
45-
"request": "launch",
46-
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
47-
"args": ["${workspaceFolder}/dist/**/*.test.js", "--timeout", "999999", "--exit"],
48-
"console": "integratedTerminal",
49-
"internalConsoleOptions": "neverOpen"
5021
}
5122
]
5223
}

.vscode/settings.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222
"editor.formatOnSave": true,
2323
"eslint.format.enable": true,
2424
"eslint.validate": ["javascript", "typescript"],
25-
"mochaExplorer.env": {
26-
"NODE_ENV": "test"
27-
},
28-
"mochaExplorer.configFile": ".mocharc.yml",
29-
"mochaExplorer.files": "src/**/*.test.ts",
30-
"mochaExplorer.require": "ts-node/register",
31-
"mochaExplorer.timeout": 5000,
3225
"prettier.enable": true,
3326
"cSpell.words": ["minio"],
3427
"[properties]": {

jest.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { Config } from '@jest/types'
2+
3+
const config: Config.InitialOptions = {
4+
preset: 'ts-jest',
5+
roots: ['<rootDir>/src'],
6+
moduleDirectories: ['node_modules', __dirname],
7+
testEnvironment: 'node',
8+
transform: {
9+
'^.+.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.jest.json' }],
10+
},
11+
silent: false,
12+
verbose: true,
13+
}
14+
export default config
15+
process.env = Object.assign(process.env, {
16+
NODE_ENV: 'test',
17+
})

0 commit comments

Comments
 (0)