File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 11import { consola } from 'consola'
2+ import type { LogType } from 'consola'
23import { useTestContext } from './context'
34
45export function mockFn ( ) {
56 const ctx = useTestContext ( )
67 return ctx . mockFn
78}
89
9- export function mockLogger ( ) : Record < string , Function > {
10- const mocks : any = { }
10+ export function mockLogger ( ) : Record < LogType , ( ... args : any [ ] ) => void > {
11+ const mocks : Partial < Record < LogType , ( ... args : any [ ] ) => void > > = { }
1112 consola . mockTypes ( ( type ) => {
1213 mocks [ type ] = mockFn ( )
13- return mocks [ type ]
14+ return mocks [ type ] !
1415 } )
15- return mocks
16+ return mocks as Record < LogType , ( ... args : any [ ] ) => void >
1617}
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export async function stopServer () {
7373 }
7474}
7575
76- export function fetch ( path : string , options ?: any ) {
76+ export function fetch ( path : string , options ?: RequestInit ) {
7777 return _fetch ( url ( path ) , options )
7878}
7979
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export interface TestContext {
3232 browser ?: Browser
3333 url ?: string
3434 serverProcess ?: ExecaChildProcess
35- mockFn ?: Function
35+ mockFn ?: ( ... args : any [ ] ) => unknown
3636 /**
3737 * Functions to run on the vitest `afterAll` hook.
3838 * Useful for removing anything created during the test.
You can’t perform that action at this time.
0 commit comments