Skip to content

Commit 2955887

Browse files
authored
remove/convert misc items related to jest (#1346)
* replace vscode debug launcher for tests * remove jest from tsconfigs
1 parent 2ed0e33 commit 2955887

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

.vscode/launch.json

+9-11
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626
{
2727
"type": "node",
2828
"request": "launch",
29-
"name": "Jest Server Unit Tests",
30-
"program": "${workspaceFolder}/node_modules/.bin/jest",
31-
"args": [
32-
"--runInBand",
33-
"--config",
34-
"./tests/unit/jest.config.js",
35-
],
36-
"cwd": "${workspaceFolder}/server",
37-
"console": "integratedTerminal",
38-
"internalConsoleOptions": "neverOpen",
29+
"name": "Debug Current Test File (ott-server)",
30+
"autoAttachChildProcesses": true,
31+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
32+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
33+
"args": ["run", "../${relativeFile}"],
34+
"cwd": "${workspaceRoot}/server",
35+
"smartStep": true,
36+
"console": "integratedTerminal"
3937
},
4038
{
4139
"name": "Attach",
@@ -47,4 +45,4 @@
4745
"type": "pwa-node"
4846
}
4947
]
50-
}
48+
}

client/tsconfig.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"compilerOptions": {
44
"target": "es2018",
55
"baseUrl": ".",
6-
"types": [
7-
"jest",
8-
],
96
"paths": {
107
"@/*": [
118
"src/*"
@@ -21,4 +18,4 @@
2118
"tests/**/*.tsx"
2219
],
2320
"exclude": ["node_modules", "dist", "ts-out"]
24-
}
21+
}

server/tests/unit/api/room.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ describe("Room API", () => {
142142
.expect("Content-Type", /json/)
143143
.expect(404);
144144
expect(resp.body.success).toEqual(false);
145-
// @ts-expect-error I can't get typescript to acknowledge the custom matchers.
146145
expect(resp.body.error).toBeRoomNotFound();
147146
});
148147
});

server/tests/unit/vitest.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Assertion, AsymmetricMatchersContaining } from "vitest";
2+
3+
interface OttMatchers<R = unknown> {
4+
toBeRoomNotFound: () => R;
5+
toBeUnknownError: () => R;
6+
}
7+
8+
declare module "vitest" {
9+
interface Assertion<T = any> extends OttMatchers<T> {}
10+
interface AsymmetricMatchersContaining extends OttMatchers {}
11+
}

tsconfig.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
"sourceMap": true,
1616
"baseUrl": ".",
1717
"noImplicitThis": true,
18-
"types": [
19-
"jest"
20-
],
2118
"outDir": "ts-out",
2219
"strictNullChecks": true,
2320
"strictPropertyInitialization": true,
@@ -36,4 +33,4 @@
3633
"ts-node": {
3734
"transpileOnly": true
3835
}
39-
}
36+
}

0 commit comments

Comments
 (0)