Skip to content

test(vue/e2e): Add tests for Vue UI spans - #24001

Merged
s1gr1d merged 5 commits into
developfrom
sig/vue-no-mixins
Sep 3, 2026
Merged

test(vue/e2e): Add tests for Vue UI spans#24001
s1gr1d merged 5 commits into
developfrom
sig/vue-no-mixins

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 3, 2026

Copy link
Copy Markdown
Member

Nuxt 5 disables Vue's Options API by default (nuxt/nuxt#35791), which turns app.mixin() into a silent no-op.

Before we replace the mixin with a runtime mechanism, this PR pins down what it does today, so the replacement can be proven behavior-preserving. No SDK code changes.

  • Unit tests document that the root component is always tracked, per hook (create, update, activate), and that spans are keyed by operation.
  • vue-3 and nuxt-4 e2e now assert the root spans (Application Render, Vue <Root>).
  • nuxt-5 drops the vue: { optionsApi: true } escape hatch, so it now shows the Nuxt 5 default (tests are marked test.fail)

Reference: #23375

@s1gr1d
s1gr1d requested a review from a team as a code owner September 3, 2026 11:58
@s1gr1d
s1gr1d requested review from chargome and mydea and removed request for a team September 3, 2026 11:58
await page.goto(`/client-error`);

const rootSpan = await transactionPromise;
const uiSpans = rootSpan.spans.filter(span => span.origin === 'auto.ui.vue');

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.

Bug: The code accesses rootSpan.spans.filter(...) without a null guard, but spans is an optional property. This could cause a TypeError if spans is undefined.
Severity: LOW

Suggested Fix

To improve test robustness, add a null guard before accessing the spans property. Change the access from rootSpan.spans.filter(...) to (rootSpan.spans || []).filter(...). This ensures that if spans is undefined, the code will operate on an empty array instead of throwing an error.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/e2e-tests/test-applications/nuxt-4/tests/tracing.client.test.ts#L80

Potential issue: The `Event` interface defines the `spans` property as optional.
However, the test code accesses `rootSpan.spans.filter(...)` without a null check. If a
transaction event is processed that does not have any spans, the `spans` property will
be `undefined`, leading to a `TypeError` when the `.filter` method is called. While the
current test configuration is expected to always generate spans, this lack of a
defensive guard makes the test fragile and inconsistent with other tests in the codebase
that use `(rootSpan.spans || [])` to safely handle this case.

Also affects:

  • dev-packages/e2e-tests/test-applications/nuxt-5/tests/tracing.client.test.ts:114

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 28.69 kB - -
@sentry/browser - with treeshaking flags 26.99 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.89 kB - -
@sentry/browser (incl. Tracing) 49.07 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.07 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.98 kB - -
@sentry/browser (incl. Tracing, Replay) 88.55 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.24 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.18 kB - -
@sentry/browser (incl. Feedback) 46.17 kB - -
@sentry/browser (incl. sendFeedback) 33.75 kB - -
@sentry/browser (incl. FeedbackAsync) 38.85 kB - -
@sentry/browser (incl. Metrics) 29.66 kB - -
@sentry/browser (incl. Logs) 29.94 kB - -
@sentry/browser (incl. Metrics & Logs) 30.59 kB - -
@sentry/react 30.45 kB - -
@sentry/react (incl. Tracing) 51.28 kB - -
@sentry/vue 35.91 kB - -
@sentry/vue (incl. Tracing) 51.34 kB - -
@sentry/svelte 28.71 kB - -
CDN Bundle 30.43 kB - -
CDN Bundle (incl. Tracing) 49.6 kB - -
CDN Bundle (incl. Logs, Metrics) 32.66 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.53 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.25 kB - -
CDN Bundle (incl. Tracing, Replay) 87.1 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.97 kB - -
CDN Bundle - uncompressed 90.13 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.81 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.52 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.59 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.68 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.76 kB - -
@sentry/nextjs (client) 53.89 kB - -
@sentry/sveltekit (client) 49.51 kB - -
@sentry/core/server 40.96 kB - -
@sentry/core/browser 13.53 kB - -
@sentry/node 124.66 kB +0.02% +21 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB - -
@sentry/node - without tracing 88.5 kB +0.03% +22 B 🔺
@sentry/node - without channel injection 103.95 kB +0.03% +23 B 🔺
@sentry/aws-serverless 96.87 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 201.56 kB - -
@sentry/cloudflare (withSentry) 501.37 kB - -

View base workflow run

@s1gr1d
s1gr1d enabled auto-merge (squash) September 3, 2026 12:46
@s1gr1d
s1gr1d merged commit ccce5f8 into develop Sep 3, 2026
225 of 226 checks passed
@s1gr1d
s1gr1d deleted the sig/vue-no-mixins branch September 3, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants