mtcute/.config/vite-utils/polyfills-bun.ts
alina sireneva af54f6e1c3
test(e2e): massive rework of e2e tests
now they run as-is, without any bundling. this might seem like a downgrade, but we no longer really need to verify that we publish stuff correctly as we delegate that to `@fuman/build`

meow
2024-12-07 09:08:30 +03:00

30 lines
807 B
TypeScript

import * as vitestExpect from '@vitest/expect'
import * as vitestSpy from '@vitest/spy'
import { afterAll, afterEach, beforeAll, beforeEach, vi as bunVi, it, jest } from 'bun:test'
import * as chai from 'chai'
import { setupChai, stubGlobal, unstubAllGlobals, waitFor } from './polyfills'
setupChai(chai, vitestExpect)
export { afterAll, afterEach, beforeAll, beforeEach, it }
export const expect = chai.expect
export const vi = {
...jest,
...bunVi,
...vitestSpy,
mocked: fn => fn,
stubGlobal,
unstubAllGlobals,
waitFor,
...['setSystemTime', 'advanceTimersByTimeAsync', 'advanceTimersByTime', 'doMock'].reduce(
(acc, name) => ({
...acc,
[name]: () => {
throw new Error(name)
},
}),
{},
),
}