Skip to content

Commit dd295d3

Browse files
committed
fix(e2e): revert changes for $fetch inference to unbreak build
1 parent 1636ced commit dd295d3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"h3": "*",
104104
"happy-dom": "^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
105105
"jsdom": "^22.0.0 || ^23.0.0 || ^24.0.0",
106+
"nitropack": "*",
106107
"playwright-core": "^1.34.3",
107108
"vite": "*",
108109
"vitest": "^0.34.6 || ^1.0.0",
@@ -153,4 +154,4 @@
153154
"node": "^14.18.0 || >=16.10.0"
154155
},
155156
"packageManager": "pnpm@8.15.5"
156-
}
157+
}

src/core/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { getRandomPort, waitForPort } from 'get-port-please'
33
import type { FetchOptions } from 'ofetch'
44
import { $fetch as _$fetch, fetch as _fetch } from 'ofetch'
55
import * as _kit from '@nuxt/kit'
6-
import type { $Fetch } from 'nitropack'
76
import { resolve } from 'pathe'
87
import { useTestContext } from './context'
98

@@ -39,7 +38,7 @@ export async function startServer(options: StartServerOptions = {}) {
3938
for (let i = 0; i < 150; i++) {
4039
await new Promise(resolve => setTimeout(resolve, 100))
4140
try {
42-
const res = await $fetch<string>(ctx.nuxt!.options.app.baseURL, { responseType: 'text' })
41+
const res = await $fetch(ctx.nuxt!.options.app.baseURL, { responseType: 'text' }) as string
4342
if (!res.includes('__NUXT_LOADING__')) {
4443
return
4544
}
@@ -79,9 +78,10 @@ export function fetch(path: string, options?: RequestInit) {
7978
return _fetch(url(path), options)
8079
}
8180

82-
export const $fetch = (function $fetch(path: string, options?: FetchOptions) {
81+
// TODO: fix type inference of `$fetch`
82+
export function $fetch(path: string, options?: FetchOptions) {
8383
return _$fetch(url(path), options)
84-
}) as $Fetch
84+
}
8585

8686
export function url(path: string) {
8787
const ctx = useTestContext()

0 commit comments

Comments
 (0)