Skip to content

Commit 42a6b82

Browse files
committed
docs: update testing documentation to reflect changes in test runner and integration test setup
1 parent 7f8c5ae commit 42a6b82

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

website/docs/development/testing.mdx

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,67 @@ title: Testing
44

55
## Testing
66

7-
As of v1.19.2, GitProxy uses [Mocha](https://mochajs.org/) (`ts-mocha`) as the test runner, and [Chai](https://www.chaijs.com/) for unit test assertions. User interface tests are written in [Cypress](https://docs.cypress.io), and some fuzz testing is done with [`fast-check`](https://fast-check.dev/).
7+
GitProxy uses [Vitest](https://vitest.dev/) as the test runner. User interface tests are written in [Cypress](https://docs.cypress.io).
8+
9+
### Running Tests
10+
11+
```bash
12+
# Run unit tests
13+
npm test
14+
15+
# Run tests with coverage
16+
npm run test-coverage
17+
18+
# Run MongoDB integration tests (requires MongoDB)
19+
RUN_MONGO_TESTS=true npm run test:integration
20+
```
21+
22+
### Running Integration Tests with MongoDB
23+
24+
The CI pipeline runs integration tests against a real MongoDB instance. To replicate this locally:
25+
26+
#### 1. Start MongoDB with Docker
27+
28+
Run MongoDB:
29+
30+
```bash
31+
docker run -d --name mongodb-test -p 27017:27017 mongo:7
32+
```
33+
34+
#### 2. Run the Integration Tests
35+
36+
```bash
37+
RUN_MONGO_TESTS=true npm run test:integration
38+
```
39+
40+
The `RUN_MONGO_TESTS=true` environment variable is required to enable the MongoDB-specific tests locally. In CI, this is handled automatically via the `CI=true` environment variable.
41+
42+
#### 3. Cleanup
43+
44+
```bash
45+
docker stop mongodb-test && docker rm mongodb-test
46+
```
47+
48+
### Full CI-like Test Run
49+
50+
To replicate the full CI test sequence locally:
51+
52+
```bash
53+
# Start MongoDB
54+
docker run -d --name mongodb-test -p 27017:27017 mongo:7
55+
56+
# Build TypeScript (required for plugin tests)
57+
npm run build-ts
58+
59+
# Run coverage tests
60+
npm run test-coverage
61+
62+
# Run MongoDB integration tests
63+
RUN_MONGO_TESTS=true npm run test:integration
64+
65+
# Cleanup
66+
docker stop mongodb-test && docker rm mongodb-test
67+
```
868

969
### Unit testing with Mocha and Chai
1070

0 commit comments

Comments
 (0)