-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathjest.setup.ts
More file actions
20 lines (16 loc) · 856 Bytes
/
jest.setup.ts
File metadata and controls
20 lines (16 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { config } from 'dotenv'
import 'jest-styled-components' // include style rules in snapshots
import fetchMock from 'jest-fetch-mock' // Mocks `fetch` calls in unittests
import { Readable } from 'stream'
import { TextDecoder, TextEncoder } from 'util'
// For simplicity, we will use CowSwap default .env for all projects and libs
config({ path: __dirname + '/apps/cowswap-frontend/.env' })
config({ path: __dirname + '/apps/cowswap-frontend/.env.development' })
config({ path: __dirname + '/apps/explorer/.env' })
config({ path: __dirname + '/apps/cow-fi/.env' })
if (typeof global.TextEncoder === 'undefined') {
global.ReadableStream = Readable as unknown as typeof globalThis.ReadableStream
global.TextEncoder = TextEncoder as typeof global.TextEncoder
global.TextDecoder = TextDecoder as typeof global.TextDecoder
}
fetchMock.dontMock()