Date: 2026-02-24
- Package:
packages/buckaroo-js-core - Unit test runner/configuration: Jest (
package.json,jest.config.ts) - Browser/integration test inventory: Playwright specs under
pw-tests/ - Coverage source:
pnpm test -- --coverage
- Jest is configured with
testMatchas:!**/*.spec.ts**/*.test.ts
- Existing test files in
src/:OperationsList.test.tsxOperations.test.tsxDFViewerParts/gridUtils.test.tsDFViewerParts/SmartRowCache.test.ts
- Result: only 2 of 4 unit test files currently match Jest config (the
.test.tsfiles), while the two.test.tsxfiles are silently excluded. - Playwright has 23
*.spec.tsfiles underpw-tests/, giving broad E2E/integration surface coverage.
Overall (Jest unit tests):
- Statements: 54.85%
- Branches: 29.83%
- Functions: 37.01%
- Lines: 53.89%
Notable by-module highlights:
- Strong:
SmartRowCache.ts: ~91.5% statements / ~81.25% branchesDFWhole.tsandbaked_data/colorMap.ts: 100%
- Weak / high-risk:
DFViewerInfinite.tsx: ~12.66% statementsChartCell.tsx: ~21.81% statementsHistogramCell.tsx: ~17.94% statementsStyler.tsx: ~11.26% statementsDisplayer.ts: ~37.31% statementsuseColorScheme.ts: ~33.33% statements
-
Jest glob likely excludes intended React tests (
.test.tsx).- This is the highest-value immediate fix because coverage and confidence are currently understated for component behavior already having test files.
-
Coverage is concentrated in utility/cache logic, not rendering-heavy components.
SmartRowCacheandgridUtilsare tested reasonably well; UI-heavy modules that drive user behavior are mostly untested at unit level.
-
Branch coverage is the main gap (29.83%).
- Suggests limited exercise of error paths, conditional rendering, and edge-case prop/state combinations.
-
E2E inventory is large, but unit coverage is narrow.
- Many Playwright specs exist; however, they do not replace fast deterministic unit-level tests for view/model boundary logic.
- Update Jest
testMatchto include.test.tsx(and optionally.test.jsx/.test.jsif desired). - Add/enable coverage thresholds in Jest (start pragmatic, raise gradually), e.g.:
- global lines/stmts ≥ 60
- branch ≥ 40
- Add
test:coveragescript for CI consistency.
- Add focused RTL tests for:
DFViewerInfinite.tsx(loading transitions, pagination/infinite callbacks, empty/error states)HistogramCell.tsxandChartCell.tsx(data-shape handling, fallback rendering)Styler.tsx(style mapping edge cases)
- Add branch-focused tests to
Displayer.tsfor display-mode switching and malformed payload handling.
- Split Jest projects/config by test type (pure unit vs component DOM tests) to keep feedback fast.
- Reduce console noise in tests (
console.login core classes) with explicit debug flags/mocks to improve signal. - Map Playwright specs to explicit risk areas (smoke/regression/visual/theme) and run tiers in CI (smoke on PR, full nightly).
- Fix Jest
testMatchglob(s) and verify.test.tsxsuites execute. - Add
test:coveragescript + initial thresholds. - Add at least one new test file targeting one low-coverage module (
DFViewerInfinite.tsxpreferred). - Re-run coverage and compare deltas.
- Document CI strategy for Jest vs Playwright lanes.