Skip to content

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Sep 19, 2025

This PR adds the following:

  • an E2E test case for Nitro $fetch requests
  • Upgrading the Nuxt 4 version (previously in alpha)
  • Deleting the app.vue file as this is not needed when using the app/pages directory (following the Nuxt docs)

@s1gr1d s1gr1d requested a review from andreiborza September 19, 2025 14:31
cursor[bot]

This comment was marked as outdated.

import { defineEventHandler } from '#imports';

export default defineEventHandler(async () => {
const data = await $fetch('https://ungh.cc/orgs/unjs/repos');
Copy link
Member

Choose a reason for hiding this comment

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

l/m: Never heard of ungh.cc, do we want to depend on this in the e2e tests? Wonder if example.com is not better.

I remember we've had issues with example.com too tho, so not sure.

Copy link
Member

@Lms24 Lms24 Sep 19, 2025

Choose a reason for hiding this comment

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

I'd recommend avoiding external requests entirely and just intercept the request in playwright. Examaple:

await page.route('**/foo', route => {
return route.fulfill({
status: 200,
body: JSON.stringify({
userNames: ['John', 'Jane'],
}),
headers: {
'Content-Type': 'application/json',
},
});
});

(not sure how consistent we are with this in e2e tests but this is what we do in the browser integration tests)

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the endpoint that Nitro uses in their examples: https://nitro.build/guide/fetch

But intercepting sounds like a good idea 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out it's not that straightforward to use page.route here. As the request is not made by the browser but the nitro server, it is not intercepted. And I cannot just call another Nitro server route as Nitro does not create a separate requests when it's within the server. For the test however, I want to specifically test calling an external API and example.com is okay for this case as the test does not fail if the endpoint cannot be reached. It's just about adding the span.

@s1gr1d s1gr1d enabled auto-merge (squash) September 22, 2025 14:48
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,130 - 9,362 -2%
GET With Sentry 1,378 15% 1,364 +1%
GET With Sentry (error only) 6,077 67% 6,234 -3%
POST Baseline 1,186 - 1,216 -2%
POST With Sentry 513 43% 530 -3%
POST With Sentry (error only) 1,053 89% 1,064 -1%
MYSQL Baseline 3,314 - 3,339 -1%
MYSQL With Sentry 451 14% 464 -3%
MYSQL With Sentry (error only) 2,666 80% 2,745 -3%

View base workflow run

@s1gr1d s1gr1d merged commit d7538cd into develop Sep 22, 2025
188 checks passed
@s1gr1d s1gr1d deleted the sig/e2e-nuxt-nitro branch September 22, 2025 15:09
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.

3 participants