Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
declare global {
interface Window {
flushAllPromises: () => Promise
MutationObserver: MutationObserver
}
}
// Adds MutationObserver as a polyfill for testing
window.MutationObserver = MutationObserver
window.flushAllPromises = async () => {
return new Promise(resolve => setImmediate(resolve))
}
// mocks and stuff
fetchMock.enableMocks()
jest.mock('honeybadger-js', () => () => null)
// cleans up state between @testing-library/react tests
afterEach(() => {
cleanup()
fetchMock.resetMocks()
})
import '@testing-library/jest-dom/extend-expect';
import 'jest-styled-components';
require('jest-fetch-mock').enableMocks();