Files

1.3 KiB

Unit Test Execution

Run Unit Tests

1. Execute All Unit Tests

pnpm run test

Runs Vitest (vitest run) with jsdom + @testing-library/react for component-level tests.

2. Review Test Results

  • Expected: 9 tests pass across 3 test files, 0 failures
  • Test Coverage: No formal coverage threshold configured; tests cover key rendering/interaction behavior of Hero, Nav, and the anchor-scroll utility
  • Test Report Location: Console output from vitest run (no HTML report is generated by default)

3. Static Analysis (complementary check)

pnpm run lint
  • Expected: 0 errors. 2 non-blocking warnings are known and accepted (react-refresh/only-export-components in src/routes/index.tsx and src/theme/ThemeProvider.tsx) — cosmetic Fast Refresh warnings, not correctness issues.

4. Fix Failing Tests

If tests fail:

  1. Review the Vitest console output for the failing test file/assertion
  2. Reproduce locally with pnpm run test:watch for fast iteration
  3. Fix the component/utility code or update the test if the expected behavior changed intentionally
  4. Rerun pnpm run test until all pass

Verified Result (this session)

  • pnpm run test: 3 test files, 9 tests, all passed.
  • pnpm run lint: 0 errors, 2 known non-blocking warnings.