Skip to content

test: add failing test for link component duplication - #32792

Merged
danielroe merged 5 commits into
mainfrom
test/depicate-link-tag
Aug 6, 2025
Merged

danielroe merged 5 commits into
mainfrom
test/depicate-link-tag

Conversation

@wattanx

@wattanx wattanx commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

🔗 Linked issue

#32670

📚 Description

I added tests for #32670

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added 4.x 🧪 test Test additions or improvements labels Jul 28, 2025
@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2025 •

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@32792

nuxt

npm i https://pkg.pr.new/nuxt@32792

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@32792

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@32792

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@32792

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@32792

commit: 40e2236

@codspeed

codspeed Bot commented Jul 28, 2025 •

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #32792 will not alter performance

Comparing test/depicate-link-tag (40e2236) with main (664041b)

Summary

✅ 10 untouched benchmarks

@wattanx
wattanx marked this pull request as ready for review July 29, 2025 01:27
@wattanx
wattanx requested a review from danielroe as a code owner July 29, 2025 01:27
@coderabbitai

coderabbitai Bot commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A new test case was added to the "head tags" suite in the test suite, specifically to check for the duplication of <link rel="alternate"> tags on the /head-component page. This test is marked as expected to fail and references a related GitHub issue. Additionally, a new Vue component file, head-component.vue, was introduced. This component renders a <Head> element containing a single <Link rel="alternate" href="/"> tag. No other modifications or feature changes were made.

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/depicate-link-tag

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
test/fixtures/basic/app/pages/head-component.vue (2)

1-10: Trim the unnecessary wrapper element

Vue 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 conventions

The coding guidelines for *.vue files 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5d3ef93 and 40e2236.

📒 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')) : null

instead 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')) : null

instead 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.

@danielroe danielroe changed the title test: ensure single link tag in SSR test: add failing test for link component duplication Aug 6, 2025

@danielroe danielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x 🧪 test Test additions or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants