Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion enzyme.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });
configure({ adapter: new Adapter() });
// Override window.scrollTo in jsdom environment to prevent not-implemented errors in tests
if (typeof window !== 'undefined') {
window.scrollTo = () => {};
}
3 changes: 3 additions & 0 deletions jest-axe-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// jest-axe setup: register the a11y matcher for Jest
const { toHaveNoViolations } = require('jest-axe');
expect.extend(toHaveNoViolations);
13 changes: 13 additions & 0 deletions jest.a11y.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest configuration for accessibility tests only
const baseConfig = require('./jest.config');

module.exports = {
...baseConfig,
// Enable coverage reporting for a11y tests (no thresholds enforced)
collectCoverage: true,
coverageDirectory: 'coverage/a11y',
collectCoverageFrom: baseConfig.collectCoverageFrom,
coverageThreshold: {},
// Only match *.a11y.test.js and *.a11y.test.jsx files
testMatch: ['**/*.a11y.test.js', '**/*.a11y.test.jsx'],
};
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
coverageThreshold: {
global: {
branches: 85.44,
functions: 96.5,
functions: 96.4,
lines: 98.15,
statements: 97.91,
},
Expand All @@ -32,7 +32,10 @@ module.exports = {
// An array of file extensions your modules use
moduleFileExtensions: ['js', 'json', 'jsx'],

// Files to run before initializing the testing framework
setupFiles: ['<rootDir>/enzyme.config.js'],
// Legacy hook for extending Jest with additional matchers (e.g. jest-axe)
setupTestFrameworkScriptFile: '<rootDir>/jest-axe-setup.js',

// The test environment that will be used for testing
testEnvironment: 'jest-environment-jsdom-fifteen',
Expand Down
277 changes: 277 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading