Jest to Vitest migration (#230)

* working without clean up

* clean up dependencies

* use test not dev

* add tests for kclErrToDiagnostic

* remove jest config

* remove unneeded @ts-ignore
This commit is contained in:
Kurt Hutten
2023-08-08 10:50:27 +10:00
committed by GitHub
parent ca985dd1a8
commit 7a537eea8e
10 changed files with 796 additions and 1575 deletions

View File

@ -1,17 +1,5 @@
import '@testing-library/jest-dom'
import util from 'util'
import fetch from 'isomorphic-fetch'
import fs from 'fs'
jest.mock('./env', () => {
// and set all the env vars from .env.development
const mockVars: { [key: string]: string } = {}
fs.readFileSync('.env.development', 'utf8')
.split('\n')
.map((line) => line.split('='))
.forEach(([key, value]) => (mockVars[key] = value))
return mockVars
})
import { WebSocket } from 'ws'
class MockRTCPeerConnection {
constructor() {}
@ -47,8 +35,4 @@ class MockRTCPeerConnection {
// @ts-ignore
global.RTCPeerConnection = MockRTCPeerConnection
// @ts-ignore
global.fetch = fetch
// @ts-ignore
global.TextDecoder = util.TextDecoder
global.TextEncoder = util.TextEncoder
global.WebSocket = WebSocket