Skip to content

Commit 297b913

Browse files
authored
Add comprehensive unit tests and test infrastructure (#110)
* Add vitest + tests infrastructure * Add test for almost all the components + fix linter issues * Fix typo: onCopyToClipbard => onCopyToClipboard * Improve SearchProcessor abort logic
1 parent dbaf208 commit 297b913

36 files changed

+4778
-781
lines changed

.github/workflows/build-deploy.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ jobs:
3838
- name: Code linter
3939
run: pnpm run lint
4040

41+
- name: Run tests and generate coverage report
42+
run: pnpm test:coverage
43+
44+
- name: Upload coverage report
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: coverage_report
48+
path: ${{ github.workspace }}/coverage
49+
4150
- name: Build Staging Website
4251
run: pnpm run build
4352
env:

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.2.1",
44
"private": true,
55
"dependencies": {
6+
"@dr.pogodin/react-helmet": "^3.0.4",
67
"@testing-library/jest-dom": "^6.9.1",
78
"asciinema-player": "^3.0.1",
89
"bootstrap": "^5.3.8",
@@ -11,7 +12,6 @@
1112
"react": "^19.2.0",
1213
"react-bootstrap": "^2.10.10",
1314
"react-dom": "^19.2.0",
14-
"@dr.pogodin/react-helmet": "^3.0.4",
1515
"react-icons": "^5.5.0",
1616
"react-image": "^4.0.3",
1717
"react-router-dom": "^7.9.6",
@@ -25,7 +25,12 @@
2525
"preview": "vite preview",
2626
"lint": "biome check .",
2727
"lint:fix": "biome check --write .",
28-
"format": "biome format --write ."
28+
"format": "biome format --write .",
29+
"test": "vitest",
30+
"test:ui": "vitest --ui",
31+
"test:run": "vitest run",
32+
"test:coverage": "vitest run --coverage",
33+
"test:watch": "vitest watch"
2934
},
3035
"browserslist": {
3136
"production": [
@@ -41,16 +46,21 @@
4146
},
4247
"devDependencies": {
4348
"@biomejs/biome": "^2.3.7",
49+
"@testing-library/dom": "^10.4.1",
4450
"@testing-library/react": "^16.3.0",
4551
"@testing-library/user-event": "^14.6.1",
46-
"@types/jest": "^30.0.0",
4752
"@types/node": "^24.0.0",
4853
"@types/react": "^19.2.7",
4954
"@types/react-dom": "^19.2.3",
5055
"@types/react-syntax-highlighter": "^15.5.13",
5156
"@vitejs/plugin-react": "^5.1.1",
57+
"@vitest/coverage-v8": "^4.0.14",
58+
"@vitest/ui": "^4.0.14",
59+
"jsdom": "^27.2.0",
60+
"msw": "^2.12.3",
5261
"rollup-plugin-visualizer": "^6.0.5",
5362
"typescript": "^5.9.3",
54-
"vite": "^7.2.4"
63+
"vite": "^7.2.4",
64+
"vitest": "^4.0.14"
5565
}
5666
}

0 commit comments

Comments
 (0)