Skip to content

Commit

Permalink
feat(e2e): improve types for $fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 16, 2024
1 parent b61731f commit b21d9a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"eslint": "9.0.0",
"h3": "1.11.1",
"jiti": "1.21.0",
"nitropack": "^2.9.6",
"nuxt": "3.11.2",
"playwright-core": "1.42.1",
"rollup": "4.13.0",
Expand Down
11 changes: 6 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/core/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getRandomPort, waitForPort } from 'get-port-please'
import type { FetchOptions } from 'ofetch'
import { $fetch as _$fetch, fetch as _fetch } from 'ofetch'
import * as _kit from '@nuxt/kit'
import type { $Fetch } from 'nitropack'
import { resolve } from 'pathe'
import { useTestContext } from './context'

Expand Down Expand Up @@ -78,9 +79,9 @@ export function fetch(path: string, options?: RequestInit) {
return _fetch(url(path), options)
}

export function $fetch(path: string, options?: FetchOptions) {
export const $fetch = (function $fetch(path: string, options?: FetchOptions) {
return _$fetch(url(path), options)
}
}) as $Fetch

export function url(path: string) {
const ctx = useTestContext()
Expand Down

0 comments on commit b21d9a5

Please sign in to comment.