Skip to main content
Learn how to run TestDriver tests efficiently with Vitest’s powerful test runner.

Running Tests

TestDriver works with Vitest’s powerful test runner:
# Run all tests once
npx vitest run

# Run in watch mode
npx vitest

# Run with coverage
npx vitest run --coverage

Test Output

Understanding test output:
$ npx vitest run

 login.test.js (3) 23.4s
 user can login with valid credentials 12.3s
 shows error for invalid email 5.6s
 shows error for wrong password 5.5s

 checkout.test.js (2) 34.7s
 user can complete checkout 28.9s
 validates credit card format 5.8s

Test Files  2 passed (2)
     Tests  5 passed (5)
  Duration  58.12s

📹 Dashcam Replays:
  - https://console.testdriver.ai/dashcam/abc123
  - https://console.testdriver.ai/dashcam/def456
Click the Dashcam URLs to watch video replays of your tests!

Performance Profiling

Identify slow tests:
# Run with reporter showing timing
npx vitest run --reporter=verbose

# Output shows duration per test:
 slow-test.test.js > user can checkout (34.7s)
 find('product') (2.1s)
 click() (0.4s)
 find('add to cart') (1.8s)
 click() (0.3s)
 find('checkout') (28.9s) ← SLOW!
 click() (0.5s)
Optimize slow operations:
  1. Enable caching - First run is slow, subsequent runs are fast
  2. Use parallel execution - Run tests concurrently
  3. Check network delays - Look for slow API calls in Dashcam
  4. Optimize selectors - More specific = faster matching
Performance optimization guide

Vitest UI

Use Vitest UI for interactive debugging:
# Start Vitest UI
npx vitest --ui
Open http://localhost:51204 to see:
  • Test file tree
  • Test status and duration
  • Console output
  • Re-run individual tests
  • Filter and search tests

Next Steps