Repository navigation
Conversation
Fills in the Nuxt client-plugin unit tests requested in getsentry#13813. Supersedes the dormant draft in getsentry#24583 (last activity 2026-02; author pinged 2026-10-12 by @JPeer264 with no reply). Covers the five code paths in `src/runtime/plugins/sentry.client.ts`: 1. Vue route provider setup (installs, respects user provider, skips without client, skips without `$router`) 2. `browserTracingIntegration` (adds with router+path label, skips on no client, skips on no router) 3. `app:created` hook — `vueIntegration` with `attachErrorHandler: false`, including client-torn-down path 4. `app:error` hook — 4xx/3xx status-code skip for Nuxt errors, 5xx and non-Nuxt errors still reported 5. `vue:error` hook — forwards error + instance + info to `reportNuxtError` Follows the mock pattern already used in `captureErrorHook.test.ts` (vi.hoisted + vi.mock(importOriginal) + spyOn on local utils). Pure vitest, no native deps. Refs getsentry#13813.
61465
requested review from
nicohrubec and
s1gr1d
and removed request for
a team
October 14, 2026 03:25
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #13813.
Fills in the Nuxt client-plugin unit tests requested by @mydea. Picks up where the dormant draft #24583 (@vansh-nagar, inactive since 2026-02; pinged by @JPeer264 on 2026-10-12 with no reply within the stated window) left off and extends it to all five code paths in
packages/nuxt/src/runtime/plugins/sentry.client.ts.What this covers
_INTERNAL_createVueRouteProvider→setRouteProvider)getClient()returns a client,$routeris on the Nuxt app, and no provider is set$routeron the Nuxt appbrowserTracingIntegration{ router, routeLabel: 'path' }on the happy path$routerapp:createdhook — Vue integrationvueIntegrationwithattachErrorHandler: falseand the live Vue appgetClient()returnsundefined)app:errorhook — status-code filteringvue:errorhook{ error, instance, info }toreportNuxtErrorPattern
Mocks mirror
packages/nuxt/test/runtime/hooks/captureErrorHook.test.ts:vi.hoisted(() => vi.fn())for cross-module mock refsvi.mock(import('…'), async importOriginal => …)for@sentry/core,@sentry/vue,nuxt/appvi.spyOn(utils, 'reportNuxtError')for the local../utilsmodulePure vitest, no native dependencies. Runs under the existing
yarn testcommand inpackages/nuxt/.Local verification
Syntax parse via
tsc --noEmit --skipLibCheckon the test file passes (only "Cannot find module" warnings remain for workspace packages, which CI resolves viayarn install). I was unable to materialise the Yarn/npm workspace node_modules locally on my Windows + Node 24 shell (ETARGET onwhatwg-url@^17.2.0, same error reported upstream in jsdom's current chain), so I'm relying on your CI matrix to confirm the suite is green across the vitest + jsdom environment configured inpackages/nuxt/vite.config.ts.Notes
src/runtime/plugins/sentry.client.ts; happy to re-shape the test file structure if the preferred house style here is onedescribeper public behaviour rather than per source-code region.cc @mydea + @JPeer264 — thanks for the pre-blessing on #13813 and for keeping the issue open.
🤖 Used Claude Code for the test scaffolding and to cross-check the mock shapes against existing nuxt tests; every assertion was signed off by me on content.