Skip to main content
This checklist helps track the migration from the old testing patterns to the new improved infrastructure.

Completed ✅

  • Created unified TestProviders wrapper (tests/utils/providers.tsx)
  • Created module-specific cleanup utilities (tests/utils/cleanup/)
  • Updated UNIT_TEST_TEMPLATE.ts to use new TestProviders wrapper
  • Fixed Playwright baseURL mismatch (8080 → 4173)
  • Created test organization standards documentation
  • Updated test generator agent with new patterns

Manual Configuration Updates Required ⚠️

These files are protected by security hooks and require manual updates:

1. package.json - Add E2E Test Scripts

Location: After "test:rls" line Add:

2. vitest.config.ts - Enable Parallel Execution

Change:
To:

3. vitest.config.ts - Increase Coverage Thresholds

Change:
To:

Test Migration Tasks

Phase 1: Update Hook Tests (155+ tests)

  • Identify all hook tests using manual QueryClient setup
  • Update to use wrapper from @/tests/utils/providers
  • Verify tests still pass
  • Update test files in batches:
    • tests/unit/ directory
    • tests/integration/ directory
    • Co-located tests in src/__tests__/
Pattern to Find:
Replace With:

Phase 2: Update Component Tests

  • Identify component tests using manual provider setup
  • Update to use TestProviders from @/tests/utils/providers
  • Verify tests still pass
Pattern to Find:
Replace With:

Phase 3: Refactor tests/setup.ts

  • Import cleanup utilities: import { cleanupAllTestData } from '@/tests/utils/cleanup';
  • Replace monolithic cleanup function with module-specific cleanup
  • Verify cleanup still works correctly
  • Reduce file size from 894 lines to <200 lines
Current:
Target:

Phase 4: Standardize Test Organization

  • Review RLS test organization (some in subdirectories, some flat)
  • Move all RLS tests to flat tests/rls/ structure
  • Ensure all RLS tests follow {core}-{table}.rls.test.ts naming
  • Verify module organization in tests/unit/, tests/integration/, tests/e2e/

Phase 5: Fix Failing Tests

  • Run full test suite: npm test
  • Identify and fix 479 currently failing tests
  • Address QueryClient provider failures (should be fixed by Phase 1)
  • Reduce skipped tests from 2,310 (43%) to <5%

Verification Steps

After each phase:
  1. Run Tests:
  2. Check Coverage:
  3. Verify No Regressions:
    • Compare pass rates before/after
    • Ensure no new failures introduced
    • Verify cleanup still works

Success Criteria

  • All hook tests use wrapper from @/tests/utils/providers
  • All component tests use TestProviders wrapper
  • tests/setup.ts is <200 lines
  • Test skip rate <5% (currently 43%)
  • Test pass rate >95% (currently 84.5%)
  • Coverage thresholds at 40% (currently 15-20%)
  • All tests follow naming conventions
  • Test organization is consistent across all types

Resources

Notes

  • Some files (package.json, vitest.config.ts) are protected by security hooks
  • Manual updates required for these files
  • Test migration can be done incrementally
  • Focus on high-impact changes first (QueryClient wrapper fixes)