Skip to content

test(vue): Add test cases for using Options API (mixins) - #23564

Merged
s1gr1d merged 1 commit into
developfrom
sig/vueIntegration-no-mixins
Aug 25, 2026
Merged

test(vue): Add test cases for using Options API (mixins)#23564
s1gr1d merged 1 commit into
developfrom
sig/vueIntegration-no-mixins

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Aug 25, 2026

Copy link
Copy Markdown
Member

Adds tests for the mixins API (we had none so far).

And also adds an E2E test variant without the Options API, to demonstrate that the SDK currently does not send UI spans without it (ui.render, ui.mount, ...).

Ref: #23375

Vue Options API Compile time flag: https://vuejs.org/api/compile-time-flags.html#VUE_OPTIONS_API

@s1gr1d
s1gr1d requested a review from a team as a code owner August 25, 2026 07:58
@s1gr1d
s1gr1d requested review from chargome and nicohrubec and removed request for a team August 25, 2026 07:58
Comment on lines 11 to +13
export default defineConfig({
plugins: [vue(), vueJsx()],
define: {

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 __VUE_OPTIONS_API__ flag is set to the string 'false', which is truthy in JavaScript, preventing the Vue Options API from being disabled as intended.
Severity: MEDIUM

Suggested Fix

The optionsApi variable should be a boolean, not a string. Change const optionsApi = process.env.VUE_OPTIONS_API === 'false' ? 'false' : 'true'; to const optionsApi = process.env.VUE_OPTIONS_API !== 'false';. This ensures a proper boolean value is passed to Vite's define configuration.

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/vue-3/vite.config.ts#L11-L13

Potential issue: In `vite.config.ts`, the `__VUE_OPTIONS_API__` flag is set to the
string `'false'` instead of the boolean `false`. Vite's `define` feature injects this as
a raw string literal. In JavaScript, the non-empty string `'false'` is truthy, so the
conditional check `if (__VUE_OPTIONS_API__)` in Vue's source evaluates to true. This
prevents the Options API from being disabled when intended. As a result, an E2E test
that is expected to fail (`test.fail`) when the Options API is disabled will instead
pass, masking the configuration bug.

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

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.34 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.25 kB - -
@sentry/browser (incl. Tracing, Replay) 87.74 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.2 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.45 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.13 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.47 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.33 kB - -
@sentry/react (incl. Tracing) 50.52 kB - -
@sentry/vue 35.4 kB - -
@sentry/vue (incl. Tracing) 50.32 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.32 kB - -
CDN Bundle (incl. Tracing) 48.87 kB - -
CDN Bundle (incl. Logs, Metrics) 32.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.74 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.91 kB - -
CDN Bundle (incl. Tracing, Replay) 86.33 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94 kB - -
CDN Bundle - uncompressed 89.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.13 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 151.81 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.4 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 284.76 kB - -
@sentry/nextjs (client) 53.07 kB - -
@sentry/sveltekit (client) 48.76 kB - -
@sentry/core/server 64.95 kB - -
@sentry/core/browser 52.11 kB - -
@sentry/node 117.49 kB +0.03% +24 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB - -
@sentry/node - without tracing 82.03 kB +0.03% +24 B 🔺
@sentry/aws-serverless 91.46 kB +0.03% +21 B 🔺
@sentry/cloudflare (withSentry) - minified 194.68 kB - -
@sentry/cloudflare (withSentry) 481.3 kB - -

View base workflow run

@s1gr1d
s1gr1d force-pushed the sig/vueIntegration-no-mixins branch from 3167826 to a30f15c Compare August 25, 2026 08:30
Comment on lines +83 to +91
initSentry: async ({ app, uiSpans }, use) => {
await use(({ tracing, sdk } = {}) => {
const client = Sentry.init({
dsn: PUBLIC_DSN,
defaultIntegrations: false,
traceLifecycle: 'static',
tracesSampleRate: 1,
app,
integrations: [Sentry.vueIntegration({ tracingOptions: { timeout: ROOT_SPAN_TIMEOUT_MS, ...tracing } })],

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 initSentry test fixture lacks cleanup logic, causing event listeners and Sentry clients to accumulate in memory across tests, leading to a memory leak.
Severity: LOW

Suggested Fix

The initSentry fixture should be updated to include teardown logic. The client.on() method returns an unsubscribe function that should be called after the test completes. This can be implemented in the fixture after the await use() call to ensure proper cleanup between tests.

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: packages/vue/test/integration/mixinRegistration.test.ts#L83-L91

Potential issue: The `initSentry` test fixture registers a `spanEnd` event listener on a
new Sentry client for each test that uses it. However, there is no corresponding cleanup
logic to unregister the listener or close the old client after the test completes. This
results in an accumulation of old client objects and their associated event listeners in
memory throughout the test run. While each test's `uiSpans` array is isolated, this
pattern creates a memory leak and violates test isolation principles, which could lead
to performance degradation or flaky tests in a larger test suite.

@s1gr1d
s1gr1d merged commit 3df629b into develop Aug 25, 2026
54 checks passed
@s1gr1d
s1gr1d deleted the sig/vueIntegration-no-mixins branch August 25, 2026 09:17
JPeer264 pushed a commit that referenced this pull request Aug 25, 2026
Adds tests for the mixins API (we had none so far). 

And also adds an E2E test variant without the Options API, to
demonstrate that the SDK currently does not send UI spans without it
(`ui.render`, `ui.mount`, ...).

Ref: #23375

Vue Options API Compile time flag:
https://vuejs.org/api/compile-time-flags.html#VUE_OPTIONS_API
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