feat(frontend): set up Vitest frontend testing infrastructure with CI workflow (#2147)

* feat: set up Vitest frontend testing infrastructure with CI workflow

Migrate existing 4 frontend test files from Node.js native test runner
(node:test + node:assert/strict) to Vitest, reorganize test directory
structure under tests/unit/ mirroring src/ layout, and add a dedicated
CI workflow for frontend unit tests.

- Add vitest as devDependency, remove tsx
- Create vitest.config.ts with @/ path alias
- Migrate tests to Vitest API (test/expect/vi)
- Rename .mjs test files to .ts
- Move tests from src/ to tests/unit/ (mirrors src/ layout)
- Add frontend/Makefile `test` target
- Add .github/workflows/frontend-unit-tests.yml (parallel to backend)
- Update CONTRIBUTING.md, README.md, AGENTS.md, CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix the lint error

* style: fix the lint error

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
yangzheli
2026-04-12 18:00:43 +08:00
committed by GitHub
parent 4d4ddb3d3f
commit 4efc8d404f
16 changed files with 594 additions and 298 deletions
+3 -1
View File
@@ -36,6 +36,8 @@ DeerFlow is built on a sophisticated agent-based architecture using the [LangGra
## Project Structure
```
tests/
└── unit/ # Unit tests (mirrors src/ layout, powered by Vitest)
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API routes
@@ -96,7 +98,7 @@ When adding new agent features:
1. Follow the established project structure
2. Add comprehensive TypeScript types
3. Implement proper error handling
4. Write tests for new functionality
4. Write unit tests under `tests/unit/` (run with `pnpm test`)
5. Update this documentation
6. Follow the code style guide (ESLint + Prettier)