Import jest-axe matchers via setupFilesAfterEnv config property (#8217)
* Now expect is extended for jest-axe via the jest setupFilesAfterEnv config property. * Renamed a test setup file for jest.
This commit is contained in:
parent
699f9c8144
commit
a72831b952
3 changed files with 3 additions and 4 deletions
|
|
@ -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('<Onboarding />', () => {
|
||||
beforeAll(() => {
|
||||
expect.extend(toHaveNoViolations);
|
||||
});
|
||||
beforeEach(() => {
|
||||
fetch.resetMocks();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
1
testSetup.js
Normal file
1
testSetup.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import 'jest-axe/extend-expect';
|
||||
Loading…
Add table
Reference in a new issue