Skip to content

Commit 9cba4f2

Browse files
Add unit testing library to @sourcebot/backend (#65)
1 parent 8d1cc7e commit 9cba4f2

File tree

11 files changed

+1045
-339
lines changed

11 files changed

+1045
-339
lines changed

.github/workflows/test-backend.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test Backend
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: "true"
18+
- name: Use Node.Js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20.x'
22+
23+
- name: Install
24+
run: yarn install --frozen-lockfile
25+
26+
- name: Test
27+
run: yarn workspace @sourcebot/backend test
28+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"scripts": {
77
"build": "yarn workspaces run build",
8+
"test": "yarn workspace @sourcebot/backend test",
89
"dev": "npm-run-all --print-label --parallel dev:zoekt dev:backend dev:web",
910
"dev:zoekt": "export PATH=\"$PWD/bin:$PATH\" && zoekt-webserver -index .sourcebot/index -rpc",
1011
"dev:backend": "yarn workspace @sourcebot/backend dev:watch",

packages/backend/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"dev:watch": "yarn generate:types && tsc-watch --preserveWatchOutput --onSuccess \"yarn dev --configPath ../../config.json --cacheDir ../../.sourcebot\"",
99
"dev": "export PATH=\"$PWD/../../bin:$PATH\" && export CTAGS_COMMAND=ctags && node ./dist/index.js",
1010
"build": "yarn generate:types && tsc",
11-
"generate:types": "tsx tools/generateTypes.ts"
11+
"generate:types": "tsx tools/generateTypes.ts",
12+
"test": "vitest --config ./vitest.config.ts"
1213
},
1314
"devDependencies": {
1415
"@types/argparse": "^2.0.16",
@@ -17,7 +18,8 @@
1718
"json-schema-to-typescript": "^15.0.2",
1819
"tsc-watch": "^6.2.0",
1920
"tsx": "^4.19.1",
20-
"typescript": "^5.6.2"
21+
"typescript": "^5.6.2",
22+
"vitest": "^2.1.4"
2123
},
2224
"dependencies": {
2325
"@gitbeaker/rest": "^40.5.1",

0 commit comments

Comments
 (0)