File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 1
- //@ts -ignore
2
- import nodeFetch from 'node-fetch'
3
- //@ts -ignore
4
- globalThis . fetch = nodeFetch
5
- //@ts -ignore
6
- globalThis . Request = nodeFetch . Request
7
- globalThis . Headers = nodeFetch . Headers
1
+ import nodeFetch , { Headers , Request } from 'node-fetch'
8
2
import { server } from './src/query/tests/mocks/server'
9
3
10
- beforeAll ( ( ) => server . listen ( { onUnhandledRequest : 'error' } ) )
11
- afterEach ( ( ) => server . resetHandlers ( ) )
12
- afterAll ( ( ) => server . close ( ) )
4
+ vi . stubGlobal ( 'fetch' , nodeFetch )
5
+ vi . stubGlobal ( 'Request' , Request )
6
+ vi . stubGlobal ( 'Headers' , Headers )
13
7
14
- process . on ( 'unhandledRejection' , ( error ) => {
15
- // eslint-disable-next-line no-undef
16
- fail ( error )
8
+ beforeAll ( ( ) => {
9
+ server . listen ( { onUnhandledRequest : 'error' } )
17
10
} )
18
11
19
- process . env . NODE_ENV = 'development'
12
+ afterEach ( ( ) => {
13
+ server . resetHandlers ( )
14
+ } )
15
+
16
+ afterAll ( ( ) => {
17
+ server . close ( )
18
+ } )
You can’t perform that action at this time.
0 commit comments