AgentSkillsCN

Run Tests

运行测试

SKILL.md

Skill: Run Tests

Commands

CommandDescription
bun run testRun all unit tests (Jest)
bun run test:e2eRun end-to-end tests
bun run test:watchRun tests in watch mode
bun run test:covRun tests with coverage report

Test File Conventions

  • Unit tests: src/**/*.spec.ts (co-located with source)
  • E2E tests: test/**/*.e2e-spec.ts
  • Test config: package.json jest section + test/jest-e2e.json

Test Framework

  • Jest 30 with ts-jest transform
  • @nestjs/testing for service tests (Test.createTestingModule)
  • Test environment: node

Debugging Tips

  • If tests fail with import errors, check tsconfig.json module settings
  • For service tests, mock Bun.spawnSync since it's Bun-specific
  • Use --verbose flag for detailed test output: bun run test -- --verbose