Repository navigation
test: add failing test for link component duplication - #32792
Conversation
|
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #32792 will not alter performanceComparing Summary
|
WalkthroughA new test case was added to the "head tags" suite in the test suite, specifically to check for the duplication of Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ 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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
test/fixtures/basic/app/pages/head-component.vue (2)
1-10: Trim the unnecessary wrapper elementVue 3 templates (and Nuxt pages) no longer require a single-root element, so the outer
<div>can be safely removed. Dropping it keeps the fixture minimal and avoids an extra node in the DOM snapshot.-<template> - <div> - <Head> - <Link - rel="alternate" - href="/" - /> - </Head> - </div> -</template> +<template> + <Head> + <Link + rel="alternate" + href="/" + /> + </Head> +</template>
1-10: Add an explicit (even empty)<script setup lang="ts">block to follow repository conventionsThe coding guidelines for
*.vuefiles specify using the composition API with<script setup lang="ts">.
Adding an empty block keeps fixtures consistent with the rest of the codebase and prevents future linter warnings.</template> + +<script setup lang="ts"> +// Intentionally left blank – fixture contains only static head markup +</script>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
test/basic.test.ts(1 hunks)test/fixtures/basic/app/pages/head-component.vue(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
test/basic.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/basic.test.ts
**/*.vue
📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)
Use
<script setup lang="ts">and the composition API when creating Vue components
Files:
test/fixtures/basic/app/pages/head-component.vue
🧠 Learnings (3)
📓 Common learnings
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
test/basic.test.ts (3)
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
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: huang-julien
PR: #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:
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : nullinstead of wrapping the import in a computed property or importing the component unconditionally.
test/fixtures/basic/app/pages/head-component.vue (2)
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: huang-julien
PR: #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:
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : nullinstead of wrapping the import in a computed property or importing the component unconditionally.
🔇 Additional comments (1)
test/basic.test.ts (1)
1059-1067: LGTM! Well-structured test for documenting the known issue.The test correctly:
- Uses
it.fails()to document the expected failure state- References the related GitHub issue in the TODO comment
- Waits for proper hydration before making assertions
- Counts the specific link elements with
rel="alternate"- Properly manages page resources by closing at the end
This follows the established testing patterns in the file and provides good documentation for issue #32670.
🔗 Linked issue
#32670
📚 Description
I added tests for #32670