-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
test: move tests for defineNuxtComponent
out of e2e test
#32848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
WalkthroughThis change set removes multiple Vue component files and associated test suites from the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (2)
test/nuxt/define-nuxt-component.test.ts (2)
4-4
: Consider using a more stable import pathImporting from internal package paths like
../../packages/nuxt/src/components/runtime/client-component
could break if the internal structure changes. Consider whether this functionality could be accessed through a more stable public API or alias.
357-359
: Verify if head option tests need to be implementedThese TODO tests indicate missing coverage for the head option functionality. Since this PR is moving tests from e2e to unit tests, were there existing head option tests in the e2e suite that should be implemented here?
Would you like me to help implement these head option tests if they were previously covered in the e2e suite?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
test/basic.test.ts
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/index.vue
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/inject.vue
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/inject/index.vue
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/nested/[foo].vue
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/route-1.vue
(0 hunks)test/fixtures/basic/app/pages/define-nuxt-component/route-2.vue
(0 hunks)test/fixtures/basic/app/pages/legacy/async-data.vue
(0 hunks)test/fixtures/basic/app/pages/legacy/async-data/index.vue
(0 hunks)test/fixtures/basic/app/pages/legacy/async-data/index/index.vue
(0 hunks)test/nuxt/define-nuxt-component.test.ts
(1 hunks)
💤 Files with no reviewable changes (10)
- test/fixtures/basic/app/pages/define-nuxt-component/route-1.vue
- test/fixtures/basic/app/pages/legacy/async-data/index/index.vue
- test/fixtures/basic/app/pages/define-nuxt-component/nested/[foo].vue
- test/fixtures/basic/app/pages/define-nuxt-component/inject/index.vue
- test/fixtures/basic/app/pages/define-nuxt-component/route-2.vue
- test/fixtures/basic/app/pages/legacy/async-data.vue
- test/fixtures/basic/app/pages/legacy/async-data/index.vue
- test/basic.test.ts
- test/fixtures/basic/app/pages/define-nuxt-component/index.vue
- test/fixtures/basic/app/pages/define-nuxt-component/inject.vue
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
test/nuxt/define-nuxt-component.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
Write unit tests for core functionality using
vitest
Files:
test/nuxt/define-nuxt-component.test.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/e2e/**/*.{ts,js} : Write end-to-end tests using Playwright and `@nuxt/test-utils`
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
Learnt from: huang-julien
PR: nuxt/nuxt#29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:
```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```
instead of wrapping the import in a computed property or importing the component unconditionally.
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx} : Write unit tests for core functionality using `vitest`
📚 Learning: applies to **/e2e/**/*.{ts,js} : write end-to-end tests using playwright and `@nuxt/test-utils`...
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/e2e/**/*.{ts,js} : Write end-to-end tests using Playwright and `@nuxt/test-utils`
Applied to files:
test/nuxt/define-nuxt-component.test.ts
📚 Learning: applies to **/*.{test,spec}.{ts,tsx,js,jsx} : write unit tests for core functionality using `vitest`...
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx} : Write unit tests for core functionality using `vitest`
Applied to files:
test/nuxt/define-nuxt-component.test.ts
📚 Learning: applies to **/*.vue : use `<script setup lang="ts">` and the composition api when creating vue compo...
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T16:46:07.446Z
Learning: Applies to **/*.vue : Use `<script setup lang="ts">` and the composition API when creating Vue components
Applied to files:
test/nuxt/define-nuxt-component.test.ts
📚 Learning: in `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally im...
Learnt from: huang-julien
PR: nuxt/nuxt#29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:
```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```
instead of wrapping the import in a computed property or importing the component unconditionally.
Applied to files:
test/nuxt/define-nuxt-component.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build
- GitHub Check: codeql (javascript-typescript)
- GitHub Check: code
🔇 Additional comments (1)
test/nuxt/define-nuxt-component.test.ts (1)
1-361
: Well-structured test suite with comprehensive coverageThis test file successfully consolidates the
defineNuxtComponent
tests from e2e to unit tests as intended. The test coverage is thorough, including basic functionality, state management, routing, legacy features, and error handling.To ensure all tests run successfully, please add all the missing Vue imports as noted in the individual comments above.
CodSpeed Performance ReportMerging #32848 will not alter performanceComparing Summary
|
🔗 Linked issue
📚 Description
this should save a bit of time on the e2e fixture