1.3 KiB
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-componentsinsrc/routes/index.tsxandsrc/theme/ThemeProvider.tsx) — cosmetic Fast Refresh warnings, not correctness issues.
4. Fix Failing Tests
If tests fail:
- Review the Vitest console output for the failing test file/assertion
- Reproduce locally with
pnpm run test:watchfor fast iteration - Fix the component/utility code or update the test if the expected behavior changed intentionally
- Rerun
pnpm run testuntil 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.