Skip to content

test(nuxt): Add fake module and composable to E2E test #16731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
</NuxtLayout>
</template>

<script setup>
<script setup lang="ts">
import { useSentryTestTag } from '#imports';

useSentryTestTag();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 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/nuxt';

export default function useSentryTestTag(): void {
setTag('test-tag', null);
}
Original file line number Diff line number Diff line change
@@ -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');
},
});
Original file line number Diff line number Diff line change
@@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@pinia/nuxt": "^0.5.5",
"@sentry/nuxt": "latest || *",
"nuxt": "^3.13.2"
"nuxt": "^3.17.5"
Copy link
Member Author

Choose a reason for hiding this comment

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

Just as a heads up: There is no version 4 of Nuxt yet. This test is called nuxt-4 as it uses the compatibility version 4.

},
"devDependencies": {
"@playwright/test": "~1.50.0",
Expand Down
Loading