feat(ci): vitest tests, GitHub Actions workflow, typecheck gate prep#20
Open
lucavandee wants to merge 3 commits into
Open
feat(ci): vitest tests, GitHub Actions workflow, typecheck gate prep#20lucavandee wants to merge 3 commits into
lucavandee wants to merge 3 commits into
Conversation
bolt-install.mjs stripped @types/* and vitest in every environment, which made tsc --noEmit and the test script unusable locally and in CI. - Only strip in Bolt (BOLT=1, STACKBLITZ=1, or bolt user-agent); keep devDeps intact for local and CI runs - Allowlist @types/react, @types/react-dom, @types/node (tsconfig types field depends on them) - Add vitest, @types/react, @types/react-dom, @types/node to devDeps - Split the test script: npm test runs once (CI-friendly), npm run test:watch runs the interactive watcher Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers the three engine modules most likely to regress under refactors: - productFilter: isAdultClothingProduct rejects kids/underwear/socks and low-price items; classifyCategory handles tops/bottoms/footwear - calculateMatchScore: verifies preference-driven scoring is not hardcoded and calculateMatchPercentage clamps to 0-100 - outfitComposer: enforces top+bottom+footwear per outfit (never two tops), respects budget ceilings, applies gender filtering, and produces different outfits when preferences change 27 tests total, all passing. vitest.config.ts wires the @/* alias so tests can import engine code the same way the app does. The strict tests/ ignore rule in .gitignore would swallow these files, so src/__tests__/ is explicitly un-ignored. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- .github/workflows/ci.yml: npm ci, typecheck, vitest run, vite build on push to main and on PRs. Typecheck is informational for now because the codebase has ~660 pre-existing type errors; tests and build are hard gates. Once typecheck errors are resolved, drop continue-on-error to make it blocking. - .husky/pre-commit: run vitest (dot reporter) before lint-staged so broken tests block commits locally. Guards with a node_modules check so Bolt environments without vitest installed keep working. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
✅ Deploy Preview for fitfiai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(
scripts/bolt-install.mjswas stripping@types/react,@types/react-dom, andvitestin every environment) and addthose packages back to
devDependencies.across
productFilter,calculateMatchScore, andoutfitComposer.All tests pass.
npm ci,npm run typecheck,npm test, andnpm run buildon push-to-main and PRs.vitest runstep into the existing huskypre-commithook sobroken tests block commits locally.
What the tests cover
The task brief referenced
src/engine/v2/modules (profileBuilder,scorer,composer), which don't exist in this branch — the enginelives directly in
src/engine/. The tests target the actual modules:isAdultClothingProductrejects kids' items,underwear/socks, and priced-below-threshold rows;
classifyCategorymaps names to top/bottom/footwear/other and falls back to the DB
category.
is not hardcoded (flipping preferences changes the score);
calculateMatchPercentageclamps to 0-100 and guards division by zero.footwear (never two tops); empty catalogs and missing categories
return
[]; budget preferences cap per-item price; gender filterrespects male/unisex; different preferences produce different
outfits; match scores land in the documented 55-98 range.
Typecheck is informational (for now)
The codebase carries ~660 pre-existing TypeScript errors across ~160
files — unrelated to this PR's changes. They are legitimate bugs
(
supabase is possibly null, property mismatches, missing modules)but fall outside the scope of setting up CI. The workflow runs
npm run typecheckwithcontinue-on-error: trueso PRs aren'tblocked until that backlog is worked down. Once clean, drop
continue-on-errorto make typecheck a hard gate.Workflow file location
.github/workflows/ci.ymlcould not be pushed: the OAuth token usedto create this PR does not have the
workflowscope. The workflow ischecked in at
.github/workflows-proposed/ci.ymlwith a READMEexplaining how to activate it — a one-line
git mvvia the GitHubweb UI (or a token with the
workflowscope) is enough.Pre-commit hook
Husky was already configured. The existing
pre-commitis extendedto run
vitest run --reporter=dotbeforelint-staged. Fulltsc --noEmitwas intentionally not added to pre-commit — with660+ pre-existing errors it would block every commit until they are
fixed. Vitest is the pragmatic gate until then.
Test plan
npm installsucceeds outside Bolt with@types/react,@types/react-dom, andvitestpresent innode_modules/npm test→ 27/27 passingnpm run build→ succeedsnpm run typecheck→ runs (still reports pre-existing errors).github/workflows-proposed/ci.yml→.github/workflows/ci.ymland verify the first CI run🤖 Generated with Claude Code