Skip to content

Commit

Permalink
fix(PN-10563): restore PF file
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahDonvito committed Apr 15, 2024
1 parent 0e675fb commit 7a89c6c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/pn-personafisica-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"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 @@ -87,6 +88,7 @@
"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
10 changes: 10 additions & 0 deletions packages/pn-personafisica-webapp/src/__test__/test-utils.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
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 @@ -36,6 +37,12 @@ const customRender = (
});
};

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

const createMockedStore = (preloadedState: any) =>
configureStore({
reducer: appReducers,
Expand All @@ -46,5 +53,8 @@ const createMockedStore = (preloadedState: any) =>
}),
});

expect.extend(toHaveNoViolations);

export * from '@testing-library/react';
export { customRender as render, createMockedStore, testStore };
export { axe };
18 changes: 18 additions & 0 deletions packages/pn-personafisica-webapp/vite.config.a11y.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';

import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig(() => {
return {
plugins: [react()],
test: {
globals: true,
setupFiles: './src/setupTests.ts',
environment: 'jsdom',
include: ['**/*.a11y.test.ts', '**/*.a11y.test.tsx'],
reporters: ['default'],
},
};
});
4 changes: 2 additions & 2 deletions packages/pn-personafisica-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,
exclude: [...configDefaults.exclude, '**/*.a11y.test.ts', '**/*.a11y.test.tsx'],
reporters: ['vitest-sonar-reporter', 'default'],
outputFile: 'test-report.xml',
coverage: {
provider: 'v8',
reporter: ['lcov'],
exclude: ['src/models/**'],
exclude: ['**/*.a11y.test.ts', '**/*.a11y.test.tsx', 'src/models/**'],
reportOnFailure: true,
},
},
Expand Down

0 comments on commit 7a89c6c

Please sign in to comment.