Skip to content

Commit f4c5900

Browse files
authored
test(e2e): Add nuxt 3 minimum supported e2e test app with pinned nitro 2.9.7 dep (#14279)
We wanted to ensure our nitro rollup plugin fix also properly works for the lowest nuxt version the nuxt SDK supports. This pins nitro to `2.9.7` and nuxt to `3.13.2`.
1 parent 1434fd9 commit f4c5900

28 files changed

+540
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ jobs:
938938
'node-koa',
939939
'node-connect',
940940
'nuxt-3',
941+
'nuxt-3-min',
941942
'nuxt-4',
942943
'vue-3',
943944
'webpack-4',
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<NuxtLayout>
3+
<header>
4+
<nav>
5+
<ul>
6+
<li><NuxtLink to="/fetch-server-error">Fetch Server Error</NuxtLink></li>
7+
<li><NuxtLink to="/test-param/1234">Fetch Param</NuxtLink></li>
8+
<li><NuxtLink to="/client-error">Client Error</NuxtLink></li>
9+
</ul>
10+
</nav>
11+
</header>
12+
<NuxtPage />
13+
</NuxtLayout>
14+
</template>
15+
16+
<script setup>
17+
</script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup>
2+
import { defineProps } from 'vue';
3+
4+
const props = defineProps({
5+
errorText: {
6+
type: String,
7+
required: true
8+
},
9+
id: {
10+
type: String,
11+
required: true
12+
}
13+
})
14+
15+
const triggerError = () => {
16+
throw new Error(props.errorText);
17+
};
18+
</script>
19+
20+
<template>
21+
<button :id="props.id" @click="triggerError">Trigger Error</button>
22+
</template>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This script copies the `import-in-the-middle` content of the E2E test project root `node_modules` to the build output `node_modules`
2+
# For some reason, some files are missing in the output (like `hook.mjs`) and this is not reproducible in external, standalone projects.
3+
#
4+
# Things we tried (that did not fix the problem):
5+
# - Adding a resolution for `@vercel/nft` v0.27.0 (this worked in the standalone project)
6+
# - Also adding `@vercel/nft` v0.27.0 to pnpm `peerDependencyRules`
7+
cp -r node_modules/.pnpm/import-in-the-middle@1.*/node_modules/import-in-the-middle .output/server/node_modules/import-in-the-middle
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
modules: ['@sentry/nuxt/module'],
4+
imports: {
5+
autoImport: false,
6+
},
7+
runtimeConfig: {
8+
public: {
9+
sentry: {
10+
dsn: 'https://[email protected]/1337',
11+
},
12+
},
13+
},
14+
nitro: {
15+
rollupConfig: {
16+
// @sentry/... is set external to prevent bundling all of Sentry into the `runtime.mjs` file in the build output
17+
external: [/@sentry\/.*/],
18+
},
19+
},
20+
});
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "nuxt-3-min",
3+
"description": "E2E test app for the minimum nuxt 3 version our nuxt SDK supports.",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "nuxt build && bash ./copyIITM.bash",
8+
"dev": "nuxt dev",
9+
"generate": "nuxt generate",
10+
"preview": "nuxt preview",
11+
"start": "node .output/server/index.mjs",
12+
"clean": "npx nuxi cleanup",
13+
"test": "playwright test",
14+
"test:build": "pnpm install && npx playwright install && pnpm build",
15+
"test:assert": "pnpm test"
16+
},
17+
"dependencies": {
18+
"@sentry/nuxt": "latest || *",
19+
"nuxt": "3.13.2"
20+
},
21+
"devDependencies": {
22+
"@nuxt/test-utils": "^3.14.1",
23+
"@playwright/test": "^1.44.1",
24+
"@sentry-internal/test-utils": "link:../../../test-utils"
25+
},
26+
"overrides": {
27+
"nitropack": "2.9.7",
28+
"@vercel/nft": "^0.27.4"
29+
}
30+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup>
2+
import ErrorButton from '../components/ErrorButton.vue';
3+
</script>
4+
5+
<template>
6+
<ErrorButton id="errorBtn" error-text="Error thrown from Nuxt-3-min E2E test app"/>
7+
<ErrorButton id="errorBtn2" error-text="Another Error thrown from Nuxt-3-min E2E test app"/>
8+
</template>
9+
10+
11+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div>
3+
<button @click="fetchData">Fetch Server Data</button>
4+
</div>
5+
</template>
6+
7+
<script setup lang="ts">
8+
import { useFetch} from '#imports'
9+
10+
const fetchData = async () => {
11+
await useFetch('/api/server-error');
12+
}
13+
</script>

0 commit comments

Comments
 (0)