workaround getComputedStyle issues in all jest tests (#14737)

This commit is contained in:
Suzanne Aitchison 2021-09-21 10:52:54 +01:00 committed by GitHub
parent 634ec98f11
commit b7d63a6e8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -15,11 +15,6 @@ const organizations = [
];
describe('<OrganizationPicker />', () => {
beforeAll(() => {
// TODO: Remove this once https://github.com/nickcolley/jest-axe/issues/147 is fixed.
window.getComputedStyle = () => {};
});
it('should have no a11y violations', async () => {
const { container } = render(
<OrganizationPicker

View file

@ -4,6 +4,10 @@ import './app/assets/javascripts/lib/xss';
global.setImmediate = global.setTimeout;
// TODO: Remove this once https://github.com/nickcolley/jest-axe/issues/147 is fixed.
const { getComputedStyle } = window;
window.getComputedStyle = (elt) => getComputedStyle(elt);
process.on('unhandledRejection', (error) => {
// Errors thrown here are typically fetch responses that have not been mocked.
throw error;