Skip to content

Instantly share code, notes, and snippets.

@Lokua
Created April 13, 2023 17:37
Show Gist options
  • Save Lokua/94f2a5f89f4385c8f0156d7950535b22 to your computer and use it in GitHub Desktop.
Save Lokua/94f2a5f89f4385c8f0156d7950535b22 to your computer and use it in GitHub Desktop.
const originalError = console.error
beforeAll(() => {
jest.spyOn(console, 'error').mockImplementation((...args) => {
if (
typeof args[0] === 'string' &&
args[0].includes('inside a test was not wrapped in act')
) {
return
}
return originalError(...args)
})
})
afterAll(() => {
console.error.mockRestore()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment