From c440ad5663c5878d9f7b8b5eb46d2f8fada18502 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Wed, 25 Jun 2025 11:43:16 +0200 Subject: [PATCH 1/2] test(nuxt): Add fake module and composable to E2E test --- .../e2e-tests/test-applications/nuxt-4/app/app.vue | 5 ++++- .../nuxt-4/app/composables/use-sentry-test-tag.ts | 8 ++++++++ .../test-applications/nuxt-4/modules/another-module.ts | 9 +++++++++ .../e2e-tests/test-applications/nuxt-4/nuxt.config.ts | 2 +- .../e2e-tests/test-applications/nuxt-4/package.json | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts create mode 100644 dev-packages/e2e-tests/test-applications/nuxt-4/modules/another-module.ts diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue b/dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue index 23283a522546..6550bbe08887 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue @@ -13,5 +13,8 @@ - diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts new file mode 100644 index 000000000000..66ff0c7a407a --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts @@ -0,0 +1,8 @@ +// fixme: this needs to be imported from @sentry/core, not @sentry/nuxt (import-in-the-middle error in dev mode) +// This could also be a problem with the specific setup of the pnpm E2E test setup, because this could not be reproduced outside of the E2E test. +// Related to this: https://github.com/getsentry/sentry-javascript/issues/15204#issuecomment-2948908130 +import { setTag } from '@sentry/core'; + +export default function useSentryTestTag(): void { + setTag('test-tag', null); +} diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/modules/another-module.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/modules/another-module.ts new file mode 100644 index 000000000000..9c1a3ca80487 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/modules/another-module.ts @@ -0,0 +1,9 @@ +import { defineNuxtModule } from 'nuxt/kit'; + +// Just a fake module to check if the SDK works alongside other local Nuxt modules without breaking the build +export default defineNuxtModule({ + meta: { name: 'another-module' }, + setup() { + console.log('another-module setup called'); + }, +}); diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/nuxt.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/nuxt.config.ts index da988a9ee003..ce3d681c963f 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/nuxt.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/nuxt.config.ts @@ -1,7 +1,7 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ future: { compatibilityVersion: 4 }, - compatibilityDate: '2024-04-03', + compatibilityDate: '2025-06-06', imports: { autoImport: false }, modules: ['@pinia/nuxt', '@sentry/nuxt/module'], diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json index e3c7ec9c0a76..8e1074a04bc1 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json @@ -18,7 +18,7 @@ "dependencies": { "@pinia/nuxt": "^0.5.5", "@sentry/nuxt": "latest || *", - "nuxt": "^3.13.2" + "nuxt": "^3.17.5" }, "devDependencies": { "@playwright/test": "~1.50.0", From 928f619966effb94f12946faabf85bdae2046044 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Wed, 25 Jun 2025 11:46:18 +0200 Subject: [PATCH 2/2] change import --- .../nuxt-4/app/composables/use-sentry-test-tag.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts index 66ff0c7a407a..0d6642ca3d8c 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/app/composables/use-sentry-test-tag.ts @@ -1,7 +1,7 @@ -// fixme: this needs to be imported from @sentry/core, not @sentry/nuxt (import-in-the-middle error in dev mode) +// fixme: this needs to be imported from @sentry/core, not @sentry/nuxt in dev mode (because of import-in-the-middle error) // This could also be a problem with the specific setup of the pnpm E2E test setup, because this could not be reproduced outside of the E2E test. // Related to this: https://github.com/getsentry/sentry-javascript/issues/15204#issuecomment-2948908130 -import { setTag } from '@sentry/core'; +import { setTag } from '@sentry/nuxt'; export default function useSentryTestTag(): void { setTag('test-tag', null);