fix(config): browser setup in defineVitestProject#1724
Conversation
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
commit: |
1bbac88 to
4b90de9
Compare
📝 WalkthroughWalkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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 `@examples/app-vitest-workspace/app1/test/app.browser.spec.ts`:
- Around line 7-9: The assertion in the useAppConfig test block is checking for
exact key equality with toEqual(['nuxt']), which is brittle because it will fail
if any additional unrelated config keys are added. Instead of checking for exact
equality of all keys, change the expectation to use toContain('nuxt') to assert
only that the 'nuxt' key is present in the returned config object, making the
smoke test more resilient to future config additions.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 35d3e297-b4dd-4497-992c-2dd4d8f1484e
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
examples/app-vitest-workspace/app1/test/app.browser.spec.tsexamples/app-vitest-workspace/app1/vitest.browser.config.tsexamples/app-vitest-workspace/package.jsonsrc/config.ts
| it('useAppConfig', () => { | ||
| expect(Object.keys(useAppConfig())).toEqual(['nuxt']) | ||
| }) |
There was a problem hiding this comment.
Avoid strict full-key equality for useAppConfig() in this smoke test.
This assertion is brittle to unrelated config growth and can fail even when browser+Nuxt setup works. Assert the presence of the nuxt key instead.
Suggested patch
- expect(Object.keys(useAppConfig())).toEqual(['nuxt'])
+ expect(useAppConfig()).toHaveProperty('nuxt')🤖 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 `@examples/app-vitest-workspace/app1/test/app.browser.spec.ts` around lines 7 -
9, The assertion in the useAppConfig test block is checking for exact key
equality with toEqual(['nuxt']), which is brittle because it will fail if any
additional unrelated config keys are added. Instead of checking for exact
equality of all keys, change the expectation to use toContain('nuxt') to assert
only that the 'nuxt' key is present in the returned config object, making the
smoke test more resilient to future config additions.
🔗 Linked issue
📚 Description
Fixed an issue where the browser mode setup was not executed if the environment was not specified as
'nuxt'indefineVitestProject