Skip to content

Commit

Permalink
fix(PN-10565): remove jest-axe dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahDonvito committed Apr 15, 2024
1 parent 1a7c598 commit 839b185
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 35 deletions.
3 changes: 1 addition & 2 deletions packages/pn-personagiuridica-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"preview": "vite preview",
"test": "tsc && vitest --run",
"test:fast": "vitest --run",
"test:a11y": "vitest --run --config ./vite.config.a11y.ts",
"test:all": "vitest --run --config ./vite.config.all.ts",
"test:coverage": "tsc && vitest run --coverage",
"lint": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
Expand Down Expand Up @@ -74,6 +73,7 @@
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/jest": "^29.5.12",
"@types/mixpanel-browser": "^2.38.0",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
Expand All @@ -88,7 +88,6 @@
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-sonarjs": "^0.10.0",
"jest-axe": "^6.0.0",
"jsdom": "^24.0.0",
"prettier": "^2.4.1",
"sonarqube-scanner": "^3.3.0",
Expand Down
11 changes: 1 addition & 10 deletions packages/pn-personagiuridica-webapp/src/__test__/test-utils.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { configureAxe, toHaveNoViolations } from 'jest-axe';
import { ReactElement, ReactNode } from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
Expand Down Expand Up @@ -60,12 +59,6 @@ const customRender = (
});
};

const axe = configureAxe({
rules: {
region: { enabled: false },
},
});

const createMockedStore = (preloadedState: any) =>
configureStore({
reducer: appReducers,
Expand All @@ -76,9 +69,7 @@ const createMockedStore = (preloadedState: any) =>
}),
});

expect.extend(toHaveNoViolations);

// re-exporting everything
export * from '@testing-library/react';
// override render method
export { axe, createMockedStore, customRender as render, testStore };
export { createMockedStore, customRender as render, testStore };
18 changes: 0 additions & 18 deletions packages/pn-personagiuridica-webapp/vite.config.a11y.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/pn-personagiuridica-webapp/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const vitestConfig = defineVitestConfig({
globals: true,
setupFiles: './src/setupTests.ts',
environment: 'jsdom',
exclude: [...configDefaults.exclude, '**/*.a11y.test.ts', '**/*.a11y.test.tsx'],
exclude: configDefaults.exclude,
reporters: ['vitest-sonar-reporter', 'default'],
outputFile: 'test-report.xml',
coverage: {
provider: 'v8',
reporter: ['lcov'],
exclude: ['**/*.a11y.test.ts', '**/*.a11y.test.tsx', 'src/models/**'],
exclude: ['src/models/**'],
reportOnFailure: true,
},
},
Expand Down
Loading

0 comments on commit 839b185

Please sign in to comment.