mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[a11y] Remove jext-axe and supporting code from kibana (#180694)
Removing jest-axe and supporting code from Kibana because this library (not regularly updated anymore and used only in one test file) is blocking me from updating axe-core. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
2ab8875a36
commit
3a65e17d78
6 changed files with 1 additions and 157 deletions
|
@ -1445,7 +1445,6 @@
|
|||
"@types/inquirer": "^7.3.1",
|
||||
"@types/intl-relativeformat": "^2.1.0",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/jest-axe": "^3.5.3",
|
||||
"@types/jquery": "^3.3.31",
|
||||
"@types/js-levenshtein": "^1.1.0",
|
||||
"@types/js-search": "^1.4.0",
|
||||
|
@ -1618,7 +1617,6 @@
|
|||
"http-proxy": "^1.18.1",
|
||||
"ignore": "^5.3.0",
|
||||
"jest": "^29.6.1",
|
||||
"jest-axe": "^5.0.0",
|
||||
"jest-canvas-mock": "^2.5.2",
|
||||
"jest-cli": "^29.6.1",
|
||||
"jest-config": "^29.6.1",
|
||||
|
|
|
@ -26,8 +26,6 @@ export * from './src/stub_web_worker';
|
|||
|
||||
export * from './src/testbed';
|
||||
|
||||
export * from './src/axe_helpers';
|
||||
|
||||
export const nextTick = () => new Promise((res) => process.nextTick(res));
|
||||
|
||||
export const delay = (time = 0) => new Promise((resolve) => setTimeout(resolve, time));
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { configureAxe } from 'jest-axe';
|
||||
import { Result } from 'axe-core';
|
||||
import { AXE_OPTIONS, AXE_CONFIG } from '@kbn/axe-config';
|
||||
import { ReactWrapper } from './testbed/types';
|
||||
|
||||
const axeRunner = configureAxe({ globalOptions: { ...AXE_CONFIG } });
|
||||
|
||||
/**
|
||||
* Function to test if a component doesn't have a11y violations from axe automated testing
|
||||
* @param component
|
||||
*/
|
||||
export const expectToBeAccessible = async (component: ReactWrapper): Promise<void> => {
|
||||
const violations = await getA11yViolations(component);
|
||||
expect(violations).toHaveLength(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a11y violations as found by axe testing
|
||||
* @param component
|
||||
*/
|
||||
export const getA11yViolations = async (component: ReactWrapper): Promise<Result[]> => {
|
||||
const axeResults = await axeRunner(component.html(), {
|
||||
...AXE_OPTIONS,
|
||||
resultTypes: ['violations'],
|
||||
});
|
||||
return axeResults.violations;
|
||||
};
|
|
@ -10,7 +10,6 @@
|
|||
],
|
||||
"kbn_references": [
|
||||
"@kbn/i18n-react",
|
||||
"@kbn/axe-config",
|
||||
"@kbn/shared-ux-router",
|
||||
],
|
||||
"exclude": [
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { expectToBeAccessible } from '@kbn/test-jest-helpers';
|
||||
import { IndicesTestBed, setup } from '../client_integration/home/indices_tab.helpers';
|
||||
import { setupEnvironment } from '../client_integration/helpers';
|
||||
import {
|
||||
createDataStreamBackingIndex,
|
||||
createNonDataStreamIndex,
|
||||
} from '../client_integration/home/data_streams_tab.helpers';
|
||||
|
||||
describe('A11y Indices tab', () => {
|
||||
let testBed: IndicesTestBed;
|
||||
let httpSetup: ReturnType<typeof setupEnvironment>['httpSetup'];
|
||||
let httpRequestsMockHelpers: ReturnType<typeof setupEnvironment>['httpRequestsMockHelpers'];
|
||||
|
||||
beforeEach(() => {
|
||||
const mockEnvironment = setupEnvironment();
|
||||
httpRequestsMockHelpers = mockEnvironment.httpRequestsMockHelpers;
|
||||
httpSetup = mockEnvironment.httpSetup;
|
||||
});
|
||||
|
||||
it('when there are no indices', async () => {
|
||||
httpRequestsMockHelpers.setLoadIndicesResponse([]);
|
||||
await act(async () => {
|
||||
testBed = await setup(httpSetup);
|
||||
});
|
||||
const { component } = testBed;
|
||||
component.update();
|
||||
await expectToBeAccessible(component);
|
||||
});
|
||||
|
||||
it('when there are indices', async () => {
|
||||
httpRequestsMockHelpers.setLoadIndicesResponse([
|
||||
createNonDataStreamIndex('non-data-stream-test-index'),
|
||||
createDataStreamBackingIndex('data-stream-test-index', 'test-data-stream'),
|
||||
]);
|
||||
await act(async () => {
|
||||
testBed = await setup(httpSetup);
|
||||
});
|
||||
const { component } = testBed;
|
||||
component.update();
|
||||
await expectToBeAccessible(component);
|
||||
});
|
||||
});
|
68
yarn.lock
68
yarn.lock
|
@ -9956,14 +9956,6 @@
|
|||
dependencies:
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
||||
"@types/jest-axe@^3.5.3":
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest-axe/-/jest-axe-3.5.3.tgz#5af918553388aa0a448af75603b44093985778c6"
|
||||
integrity sha512-ad9qI9f+00N8IlOuGh6dnZ6o0BDdV9VhGfTUr1zCejsPvOfZd6eohffe4JYxUoUuRYEftyMcaJ6Ux4+MsOpGHg==
|
||||
dependencies:
|
||||
"@types/jest" "*"
|
||||
axe-core "^3.5.5"
|
||||
|
||||
"@types/jest-specific-snapshot@^0.5.3":
|
||||
version "0.5.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest-specific-snapshot/-/jest-specific-snapshot-0.5.5.tgz#47ce738870be99898ed6d7b08dbf0240c74ae553"
|
||||
|
@ -12235,16 +12227,6 @@ aws4@^1.12.0, aws4@^1.8.0:
|
|||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3"
|
||||
integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==
|
||||
|
||||
axe-core@4.2.1:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.2.1.tgz#2e50bcf10ee5b819014f6e342e41e45096239e34"
|
||||
integrity sha512-evY7DN8qSIbsW2H/TWQ1bX3sXN1d4MNb5Vb4n7BzPuCwRHdkZ1H2eNLuSh73EoQqkGKUtju2G2HCcjCfhvZIAA==
|
||||
|
||||
axe-core@^3.5.5:
|
||||
version "3.5.6"
|
||||
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.6.tgz#e762a90d7f6dbd244ceacb4e72760ff8aad521b5"
|
||||
integrity sha512-LEUDjgmdJoA3LqklSTwKYqkjcZ4HKc4ddIYGSAiSkr46NTjzg2L9RNB+lekO9P7Dlpa87+hBtzc2Fzn/+GUWMQ==
|
||||
|
||||
axe-core@^4.2.0, axe-core@^4.6.2:
|
||||
version "4.7.2"
|
||||
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0"
|
||||
|
@ -13428,14 +13410,6 @@ chalk@2.4.2, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2:
|
|||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
chalk@4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
|
||||
integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==
|
||||
dependencies:
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
chalk@4.1.2, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2, chalk@~4.1.0:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||
|
@ -15581,11 +15555,6 @@ diff-sequences@^26.6.2:
|
|||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1"
|
||||
integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==
|
||||
|
||||
diff-sequences@^27.5.1:
|
||||
version "27.5.1"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327"
|
||||
integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==
|
||||
|
||||
diff-sequences@^29.4.3:
|
||||
version "29.4.3"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2"
|
||||
|
@ -20316,16 +20285,6 @@ jake@^10.8.5:
|
|||
filelist "^1.0.1"
|
||||
minimatch "^3.0.4"
|
||||
|
||||
jest-axe@^5.0.0:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-axe/-/jest-axe-5.0.1.tgz#26c43643b2e5f2bd4900c1ab36f8283635957a6e"
|
||||
integrity sha512-MMOWA6gT4pcZGbTLS8ZEqABH08Lnj5bInfLPpn9ADWX2wFF++odbbh8csmSfkwKjHaioVPzlCtIypAtxFDx/rw==
|
||||
dependencies:
|
||||
axe-core "4.2.1"
|
||||
chalk "4.1.0"
|
||||
jest-matcher-utils "27.0.2"
|
||||
lodash.merge "4.6.2"
|
||||
|
||||
jest-canvas-mock@^2.5.2:
|
||||
version "2.5.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz#7e21ebd75e05ab41c890497f6ba8a77f915d2ad6"
|
||||
|
@ -20424,16 +20383,6 @@ jest-diff@^26.0.0, jest-diff@^26.6.2:
|
|||
jest-get-type "^26.3.0"
|
||||
pretty-format "^26.6.2"
|
||||
|
||||
jest-diff@^27.0.2:
|
||||
version "27.5.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def"
|
||||
integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==
|
||||
dependencies:
|
||||
chalk "^4.0.0"
|
||||
diff-sequences "^27.5.1"
|
||||
jest-get-type "^27.5.1"
|
||||
pretty-format "^27.5.1"
|
||||
|
||||
jest-diff@^29.6.1:
|
||||
version "29.6.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.6.1.tgz#13df6db0a89ee6ad93c747c75c85c70ba941e545"
|
||||
|
@ -20493,11 +20442,6 @@ jest-get-type@^26.3.0:
|
|||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0"
|
||||
integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==
|
||||
|
||||
jest-get-type@^27.0.1, jest-get-type@^27.5.1:
|
||||
version "27.5.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1"
|
||||
integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==
|
||||
|
||||
jest-get-type@^29.4.3:
|
||||
version "29.4.3"
|
||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5"
|
||||
|
@ -20551,16 +20495,6 @@ jest-leak-detector@^29.6.1:
|
|||
jest-get-type "^29.4.3"
|
||||
pretty-format "^29.6.1"
|
||||
|
||||
jest-matcher-utils@27.0.2:
|
||||
version "27.0.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.0.2.tgz#f14c060605a95a466cdc759acc546c6f4cbfc4f0"
|
||||
integrity sha512-Qczi5xnTNjkhcIB0Yy75Txt+Ez51xdhOxsukN7awzq2auZQGPHcQrJ623PZj0ECDEMOk2soxWx05EXdXGd1CbA==
|
||||
dependencies:
|
||||
chalk "^4.0.0"
|
||||
jest-diff "^27.0.2"
|
||||
jest-get-type "^27.0.1"
|
||||
pretty-format "^27.0.2"
|
||||
|
||||
jest-matcher-utils@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a"
|
||||
|
@ -25310,7 +25244,7 @@ pretty-format@^26.0.0, pretty-format@^26.6.2:
|
|||
ansi-styles "^4.0.0"
|
||||
react-is "^17.0.1"
|
||||
|
||||
pretty-format@^27.0.2, pretty-format@^27.5.1:
|
||||
pretty-format@^27.0.2:
|
||||
version "27.5.1"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e"
|
||||
integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue