Repository navigation
chore: test coverage sonarqube - #3319
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (7)
📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (7)
WalkthroughAdds Vitest v8 coverage configuration and test:coverage scripts across API, CLI, Core, Components, and SDK packages; updates devDependencies. Separately, aligns Toast timeoutRef typing and adds a comprehensive Toast test suite with accessibility checks. ChangesVitest Coverage Infrastructure Setup
Toast Component TypeScript Safety and Test Coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/components/src/molecules/Toast/Toast.tsx`:
- Line 8: The timeoutRef in Toast is currently created as
useRef<ReturnType<typeof setTimeout>>() without an explicit initial value;
update it to explicitly initialize with undefined and include undefined in the
type so it matches the codebase pattern (e.g., useRef<ReturnType<typeof
setTimeout> | undefined>(undefined)) — change the timeoutRef declaration inside
the Toast component accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5a3e837f-0dd4-4fae-b9ce-b9a6950c275e
⛔ Files ignored due to path filters (7)
.github/workflows/ci.ymlis excluded by none and included by none.vtex/deployment.yamlis excluded by none and included by nonepackage.jsonis excluded by none and included by nonepnpm-lock.yamlis excluded by!**/pnpm-lock.yamland included by nonepnpm-workspace.yamlis excluded by none and included by nonesonar-project.propertiesis excluded by none and included by noneturbo.jsonis excluded by none and included by none
📒 Files selected for processing (13)
packages/api/package.jsonpackages/api/vitest.config.tspackages/cli/package.jsonpackages/cli/vitest.config.tspackages/components/package.jsonpackages/components/src/molecules/Toast/Toast.tsxpackages/components/test/molecules/Toast/Toast.test.tsxpackages/components/vitest.config.mtspackages/core/package.jsonpackages/core/tsconfig.tsbuildinfopackages/core/vitest.config.tspackages/sdk/package.jsonpackages/sdk/vitest.config.mts
| const { toasts, popToast } = useUI() | ||
| const toast = toasts[toasts.length - 1] | ||
| const timeoutRef = useRef<number>() | ||
| const timeoutRef = useRef<ReturnType<typeof setTimeout>>() |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether this repo is on React/@types/react 19 and locate zero-arg useRef calls.
set -euo pipefail
echo "== React version hints in manifests =="
rg -n --iglob 'package.json' '"react"|"@types/react"'
echo
echo "== Zero-arg useRef calls in TS/TSX files =="
rg -nP --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type ts --type tsx '\buseRef\s*(<[^>]+>)?\s*\(\s*\)' -g '!**/node_modules/**'Repository: vtex/faststore
Length of output: 1124
🏁 Script executed:
#!/bin/bash
# Check if the file exists and read its content around line 8
if [ -f "packages/components/src/molecules/Toast/Toast.tsx" ]; then
echo "=== Toast.tsx file exists ==="
sed -n '1,20p' packages/components/src/molecules/Toast/Toast.tsx | cat -n
else
echo "Toast.tsx NOT FOUND at specified path"
# Search for Toast component
fd -t f "Toast\.tsx" packages/components/src/molecules/
fi
echo
echo "=== Checking root manifest for React version ==="
head -100 package.json | grep -A 50 '"versions":\|"catalog":\|"react"'Repository: vtex/faststore
Length of output: 767
🏁 Script executed:
#!/bin/bash
# Find version catalog - might be in different location
echo "=== Searching for version catalog ==="
find . -name "*.json" -type f -not -path "*/node_modules/*" | xargs grep -l '"react":' | head -5
echo
echo "=== Check pnpm-workspace or root package.json structure ==="
jq '.pnpm.overrides // .versions // .devDependencies.react // .dependencies.react // empty' package.json 2>/dev/null || echo "Catalog/versions not in root"
echo
echo "=== Check pnpm-lock for resolved React version ==="
if [ -f "pnpm-lock.yaml" ]; then
rg 'react@' pnpm-lock.yaml | head -5
else
echo "No pnpm-lock.yaml found"
fi
echo
echo "=== Check tsconfig for strict mode ==="
jq '.compilerOptions.strict' tsconfig.json 2>/dev/null || cat tsconfig.json | head -30Repository: vtex/faststore
Length of output: 658
🏁 Script executed:
#!/bin/bash
# Check if the project builds successfully
echo "=== Check if project has build/compile script ==="
jq '.scripts | keys[] | select(contains("build") or contains("compile") or contains("check") or contains("type"))' package.json 2>/dev/null | head -10
echo
echo "=== Check TypeScript config strictness ==="
cat tsconfig.json | jq '.compilerOptions | {strict, noUncheckedIndexedAccess, strictNullChecks, strictFunctionTypes}'
echo
echo "=== Check React 18 useRef types in `@types/react` 18.3.28 docs ==="
# Look at how other components in the codebase use useRef to understand current patterns
rg -A2 'useRef<.*>\(\)' packages/components/src/ --type tsx | head -40Repository: vtex/faststore
Length of output: 408
🏁 Script executed:
#!/bin/bash
# Search for useRef usage patterns in tsx files correctly
echo "=== Actual useRef patterns in components ==="
rg 'useRef' packages/components/src/molecules/ --type-add 'tsx:*.tsx' -A1 | head -50
echo
echo "=== Check if build works and look for compilation errors ==="
# Check if there are any TypeScript compilation checks in CI or scripts
if [ -f "pnpm-workspace.yaml" ]; then
echo "pnpm workspace detected"
head -20 pnpm-workspace.yaml
fi
# Look at the Toast component more carefully
echo
echo "=== Full context of Toast.tsx useRef line ==="
sed -n '1,30p' packages/components/src/molecules/Toast/Toast.tsx | cat -nRepository: vtex/faststore
Length of output: 4920
Initialize useRef explicitly for consistency with codebase patterns.
Toast is the only component initializing useRef without an explicit value. All other molecules in this folder explicitly provide an initial value (e.g., useRef<HTMLButtonElement>(null)). Explicitly initializing with undefined aligns with the rest of the codebase and clarifies intent.
Suggested patch
- const timeoutRef = useRef<ReturnType<typeof setTimeout>>()
+ const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const timeoutRef = useRef<ReturnType<typeof setTimeout>>() | |
| const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/components/src/molecules/Toast/Toast.tsx` at line 8, The timeoutRef
in Toast is currently created as useRef<ReturnType<typeof setTimeout>>() without
an explicit initial value; update it to explicitly initialize with undefined and
include undefined in the type so it matches the codebase pattern (e.g.,
useRef<ReturnType<typeof setTimeout> | undefined>(undefined)) — change the
timeoutRef declaration inside the Toast component accordingly.
There was a problem hiding this comment.
do we need to commit it?
There was a problem hiding this comment.
noooo, it was an accident
| @@ -0,0 +1,19 @@ | |||
| sonar.projectKey=vtex_faststore_f0a862d5-9557-49f9-8d09-de40caa76622 | |||
There was a problem hiding this comment.
not sure if this should be here or in some env var
There was a problem hiding this comment.
this is not sensitive information
d4cc5af to
4f0df57
Compare
|
## Summary Graduation PR from `dev` to `main`. Promotes the `4.1.0-dev.10` prerelease cycle to the next stable, expected `4.1.1` (only `fix:` and `chore:` commits since `4.1.0`). ### Notable changes since 4.1.0 - fix: region slider section render (#3318) - fix: allow_all_components for CMS (#3312) - chore: test coverage sonarqube (#3319) - chore: bump next.js to 16.2.6 (#3327) - chore: phase 4 — split AGENTS.md, add MCP config and spec-kit check (#3320) - chore: Update repo read me files (#3314) - Dark Kitchen Catalog Setup (#3317) ### Back-merge `main` was back-merged into `dev` (`3d4d24081`) before this PR to bring in the `4.1.0` release commit and avoid silent overwrites. Conflicts were resolved in favor of `dev` for code/CMS/version files, with `CHANGELOG` entries merged from both sides. ## Test plan - [x] dev CD published `4.1.0-dev.10` on the `dev` dist-tag for all 8 packages - [ ] After merge, main CD graduates to `4.1.1` on the `latest` dist-tag - [ ] All 8 packages publish (api, cli, components, core, diagnostics, lighthouse, sdk, ui) Made with [Cursor](https://cursor.com) --------- Co-authored-by: Larícia Mota <[email protected]> Co-authored-by: Matheus P. Silva <[email protected]> Co-authored-by: Leandro Rodrigues <[email protected]> Co-authored-by: vtexgithubbot <[email protected]> Co-authored-by: Lucas Feijó <[email protected]> Co-authored-by: Luiz Falcão <[email protected]> Co-authored-by: Artur Santiago <[email protected]> Co-authored-by: Sahan Jayawardana <[email protected]> Co-authored-by: Mateus Pontes <[email protected]> Co-authored-by: Matheus Martins <[email protected]> Co-authored-by: renatomaurovtex <[email protected]> Co-authored-by: Leandro Rodrigues <[email protected]> Co-authored-by: Fanny Chien <[email protected]> Co-authored-by: Arthur Andrade <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Thiago Pereira <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Giuliana Rigaud <[email protected]> Co-authored-by: renato <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: BrunaCubos <[email protected]> Co-authored-by: Ícaro Oliveira <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Everton Ataide <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Otavio Moreira Meirelles <[email protected]> Co-authored-by: Marco Cardoso <[email protected]> Co-authored-by: Gabriel Paladino <[email protected]> Co-authored-by: CodeRabbit <[email protected]> Co-authored-by: dk-portal[bot] <134092483+dk-portal[bot]@users.noreply.github.com>


0 New Issues
0 Fixed Issues
0 Accepted Issues
What's the purpose of this pull request?
Sets up the SonarQube quality gate for FastStore. This is the foundation for "Clean as You Code" enforcement on new code: the monorepo now produces aggregated test coverage and runs a Sonar scan on every PR.
How it works?
api,cli,components,core,sdk) generates LCOV via Vitest (@vitest/coverage-v8, pinned inpnpm-workspace.yamlcatalog) through a newtest:coverageTurbo task.ci:dkcicdscript runsbuild → lint → size → test:coveragesequentially (avoids esbuild OOM) and merges all per-package LCOVs intocoverage/lcov.infowithlcov-result-merger..vtex/deployment.yamlrunsnode-ci-v2on PRs (amd64, Node 24, pnpm), pointing atsonarqube.vtex.systemswithgitBaseBranchName: devso "New Code" is compared against the right base.Summary by CodeRabbit
Tests
Chores