Skip to content

Commit b12db06

Browse files
authored
chore(tests): switch to vitest (#363)
1 parent ab6aae6 commit b12db06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6906
-9354
lines changed

.github/workflows/code_health.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
5555
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
5656
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
57-
run: npm test -- --testPathIgnorePatterns "tests/unit" --testPathIgnorePatterns "tests/integration/tools/mongodb" --testPathIgnorePatterns "tests/integration/[^/]+\.ts"
57+
run: npm test -- --exclude "tests/unit/**" --exclude "tests/integration/tools/mongodb/**" --exclude "tests/integration/*.ts"
5858
- name: Upload test results
5959
uses: actions/upload-artifact@v4
6060
if: always()

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
44

55
// List of extensions which should be recommended for users of this workspace.
6-
"recommendations": ["firsttris.vscode-jest-runner", "orta.vscode-jest"],
6+
"recommendations": ["vitest.explorer"],
77
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
88
"unwantedRecommendations": []
99
}

.vscode/settings.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
{
2-
"jestrunner.jestCommand": "npm test --",
3-
"jestrunner.debugOptions": {
4-
"runtimeExecutable": "node",
5-
"runtimeArgs": [
6-
"--experimental-vm-modules",
7-
"node_modules/jest/bin/jest.js",
8-
"--coverage"
9-
]
10-
}
11-
}
1+
{}

eslint.config.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import js from "@eslint/js";
33
import globals from "globals";
44
import tseslint from "typescript-eslint";
55
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
6-
import jestPlugin from "eslint-plugin-jest";
6+
import vitestPlugin from "eslint-plugin-vitest";
77

88
const testFiles = ["tests/**/*.test.ts", "tests/**/*.ts"];
99

@@ -15,14 +15,23 @@ export default defineConfig([
1515
{
1616
files: testFiles,
1717
plugins: {
18-
jest: jestPlugin,
18+
vitest: vitestPlugin,
1919
},
2020
languageOptions: {
2121
globals: {
2222
...globals.node,
23-
...jestPlugin.environments.globals.globals,
2423
},
2524
},
25+
rules: {
26+
...vitestPlugin.configs.recommended.rules,
27+
"vitest/valid-title": "off",
28+
"vitest/expect-expect": [
29+
"error",
30+
{
31+
assertFunctionNames: ["expect", "expectDefined", "verifyMockCalls"],
32+
},
33+
],
34+
},
2635
},
2736
tseslint.configs.recommendedTypeChecked,
2837
{
@@ -48,7 +57,7 @@ export default defineConfig([
4857
"coverage",
4958
"global.d.ts",
5059
"eslint.config.js",
51-
"jest.config.cjs",
60+
"vitest.config.ts",
5261
"src/types/*.d.ts",
5362
]),
5463
eslintPluginPrettierRecommended,

global.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.config.cjs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)