diff --git a/app/javascript/onboarding/__tests__/Onboarding.test.jsx b/app/javascript/onboarding/__tests__/Onboarding.test.jsx index 57d3bfcb5..c34c37eb5 100644 --- a/app/javascript/onboarding/__tests__/Onboarding.test.jsx +++ b/app/javascript/onboarding/__tests__/Onboarding.test.jsx @@ -1,7 +1,7 @@ import { h } from 'preact'; import { deep } from 'preact-render-spy'; import fetch from 'jest-fetch-mock'; -import { axe, toHaveNoViolations } from 'jest-axe'; +import { axe } from 'jest-axe'; import Onboarding from '../Onboarding'; import ProfileForm from '../components/ProfileForm'; @@ -53,9 +53,6 @@ function expectStepperToRender(onboardingSlides, activeDotCount) { } describe('', () => { - beforeAll(() => { - expect.extend(toHaveNoViolations); - }); beforeEach(() => { fetch.resetMocks(); }); diff --git a/jest.config.js b/jest.config.js index 8d7862988..540be60ed 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,6 +6,7 @@ process.env.TZ = 'UTC'; module.exports = { + setupFilesAfterEnv: ['./testSetup.js'], collectCoverageFrom: [ 'app/javascript/**/*.{js,jsx}', // This exclusion avoids running coverage on Barrel files, https://twitter.com/housecor/status/981558704708472832 diff --git a/testSetup.js b/testSetup.js new file mode 100644 index 000000000..dee020c20 --- /dev/null +++ b/testSetup.js @@ -0,0 +1 @@ +import 'jest-axe/extend-expect';