test.ps1 854 B

1234567891011121314151617181920212223242526272829
  1. $ErrorActionPreference = "Stop"
  2. $ProjectRoot = Split-Path -Parent $PSScriptRoot
  3. Push-Location (Join-Path $ProjectRoot "backend")
  4. try {
  5. uv sync --locked
  6. if ($LASTEXITCODE -ne 0) { throw "依赖同步失败。" }
  7. uv run pytest
  8. if ($LASTEXITCODE -ne 0) { throw "测试失败。" }
  9. uv run ruff check .
  10. if ($LASTEXITCODE -ne 0) { throw "Ruff 检查失败。" }
  11. uv run mypy app
  12. if ($LASTEXITCODE -ne 0) { throw "mypy 检查失败。" }
  13. }
  14. finally {
  15. Pop-Location
  16. }
  17. Push-Location (Join-Path $ProjectRoot "frontend")
  18. try {
  19. pnpm install --frozen-lockfile
  20. if ($LASTEXITCODE -ne 0) { throw "前端依赖同步失败。" }
  21. pnpm typecheck
  22. if ($LASTEXITCODE -ne 0) { throw "前端类型检查失败。" }
  23. pnpm build
  24. if ($LASTEXITCODE -ne 0) { throw "前端构建失败。" }
  25. }
  26. finally {
  27. Pop-Location
  28. }