File tree 3 files changed +7
-6
lines changed
3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { consola } from 'consola'
2
+ import type { LogType } from 'consola'
2
3
import { useTestContext } from './context'
3
4
4
5
export function mockFn ( ) {
5
6
const ctx = useTestContext ( )
6
7
return ctx . mockFn
7
8
}
8
9
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 > > = { }
11
12
consola . mockTypes ( ( type ) => {
12
13
mocks [ type ] = mockFn ( )
13
- return mocks [ type ]
14
+ return mocks [ type ] !
14
15
} )
15
- return mocks
16
+ return mocks as Record < LogType , ( ... args : any [ ] ) => void >
16
17
}
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export async function stopServer () {
73
73
}
74
74
}
75
75
76
- export function fetch ( path : string , options ?: any ) {
76
+ export function fetch ( path : string , options ?: RequestInit ) {
77
77
return _fetch ( url ( path ) , options )
78
78
}
79
79
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export interface TestContext {
32
32
browser ?: Browser
33
33
url ?: string
34
34
serverProcess ?: ExecaChildProcess
35
- mockFn ?: Function
35
+ mockFn ?: ( ... args : any [ ] ) => unknown
36
36
/**
37
37
* Functions to run on the vitest `afterAll` hook.
38
38
* Useful for removing anything created during the test.
You can’t perform that action at this time.
0 commit comments