[7.x] [npm] upgrade all jest related dependencies (#96367) (#97901)

* [npm] upgrade all jest related dependencies (#96367)

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* remove package added by other PR

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Spencer 2021-04-21 17:26:10 -07:00 committed by GitHub
parent 385ed29080
commit f442052f56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1612 additions and 2112 deletions

View file

@ -432,7 +432,7 @@
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^6.0.0",
"@istanbuljs/schema": "^0.1.2",
"@jest/reporters": "^26.5.2",
"@jest/reporters": "^26.6.2",
"@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset/npm_module",
"@kbn/cli-dev-mode": "link:packages/kbn-cli-dev-mode",
@ -469,11 +469,11 @@
"@storybook/node-logger": "^6.1.20",
"@storybook/react": "^6.1.20",
"@storybook/theming": "^6.1.20",
"@testing-library/dom": "^7.24.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.0.4",
"@testing-library/react-hooks": "^3.4.1",
"@testing-library/user-event": "^12.1.6",
"@testing-library/dom": "^7.30.3",
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.6",
"@testing-library/react-hooks": "^5.1.1",
"@testing-library/user-event": "^13.1.1",
"@types/accept": "3.1.1",
"@types/angular": "^1.6.56",
"@types/angular-mocks": "^1.7.0",
@ -482,7 +482,7 @@
"@types/base64-js": "^1.2.5",
"@types/bluebird": "^3.1.1",
"@types/chance": "^1.0.0",
"@types/cheerio": "^0.22.10",
"@types/cheerio": "^0.22.28",
"@types/chroma-js": "^1.4.2",
"@types/chromedriver": "^81.0.0",
"@types/classnames": "^2.2.9",
@ -502,7 +502,7 @@
"@types/delete-empty": "^2.0.0",
"@types/ejs": "^3.0.6",
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.10.5",
"@types/enzyme": "^3.10.8",
"@types/eslint": "^6.1.3",
"@types/extract-zip": "^1.6.2",
"@types/faker": "^5.1.5",
@ -530,9 +530,9 @@
"@types/http-proxy-agent": "^2.0.2",
"@types/inquirer": "^7.3.1",
"@types/intl-relativeformat": "^2.1.0",
"@types/jest": "^26.0.14",
"@types/jest-specific-snapshot": "^0.5.4",
"@types/jest-when": "^2.7.1",
"@types/jest": "^26.0.22",
"@types/jest-specific-snapshot": "^0.5.5",
"@types/jest-when": "^2.7.2",
"@types/joi": "^13.4.2",
"@types/jquery": "^3.3.31",
"@types/js-search": "^1.4.0",
@ -611,8 +611,8 @@
"@types/tar": "^4.0.3",
"@types/tar-fs": "^1.16.1",
"@types/tempy": "^0.2.0",
"@types/testing-library__jest-dom": "^5.9.3",
"@types/testing-library__react-hooks": "^3.4.0",
"@types/testing-library__jest-dom": "^5.9.5",
"@types/testing-library__react-hooks": "^4.0.0",
"@types/tinycolor2": "^1.4.1",
"@types/type-detect": "^4.0.1",
"@types/use-resize-observer": "^6.0.0",
@ -675,9 +675,9 @@
"dpdm": "3.5.0",
"ejs": "^3.1.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-adapter-utils": "^1.13.0",
"enzyme-to-json": "^3.4.4",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-adapter-utils": "^1.14.0",
"enzyme-to-json": "^3.6.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.15.0",
"eslint-import-resolver-node": "0.3.2",
@ -688,7 +688,7 @@
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jest": "^24.3.4",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-no-unsanitized": "^3.0.2",
@ -724,18 +724,17 @@
"is-path-inside": "^3.0.2",
"istanbul-instrumenter-loader": "^3.0.1",
"jest": "^26.6.3",
"jest-canvas-mock": "^2.2.0",
"jest-canvas-mock": "^2.3.1",
"jest-circus": "^26.6.3",
"jest-cli": "^26.6.3",
"jest-diff": "^26.6.2",
"jest-environment-jsdom": "^26.6.2",
"jest-environment-jsdom-thirteen": "^1.0.1",
"jest-raw-loader": "^1.0.1",
"jest-silent-reporter": "^0.2.1",
"jest-silent-reporter": "^0.5.0",
"jest-snapshot": "^26.6.2",
"jest-specific-snapshot": "2.0.0",
"jest-styled-components": "^7.0.2",
"jest-when": "^2.7.2",
"jest-styled-components": "^7.0.3",
"jest-when": "^3.2.1",
"jimp": "^0.14.0",
"jsdom": "13.1.0",
"json5": "^1.0.1",

View file

@ -80,7 +80,7 @@ describe('RenderingService', () => {
it('renders "core" page', async () => {
const content = await render(createKibanaRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('kbn-injected-metadata').attr('data'));
const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""');
expect(data).toMatchSnapshot(INJECTED_METADATA);
});
@ -90,7 +90,7 @@ describe('RenderingService', () => {
const content = await render(createKibanaRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('kbn-injected-metadata').attr('data'));
const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""');
expect(data).toMatchSnapshot(INJECTED_METADATA);
});
@ -99,7 +99,7 @@ describe('RenderingService', () => {
uiSettings.getUserProvided.mockResolvedValue({ 'theme:darkMode': { userValue: true } });
const content = await render(createKibanaRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('kbn-injected-metadata').attr('data'));
const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""');
expect(data).toMatchSnapshot(INJECTED_METADATA);
});
@ -109,7 +109,7 @@ describe('RenderingService', () => {
includeUserSettings: false,
});
const dom = load(content);
const data = JSON.parse(dom('kbn-injected-metadata').attr('data'));
const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""');
expect(data).toMatchSnapshot(INJECTED_METADATA);
});
@ -117,7 +117,7 @@ describe('RenderingService', () => {
it('renders "core" from legacy request', async () => {
const content = await render(createRawRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('kbn-injected-metadata').attr('data'));
const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""');
expect(data).toMatchSnapshot(INJECTED_METADATA);
});

View file

@ -8,13 +8,13 @@
interface CheerioSelector {
(selector: string): CustomCheerio;
(selector: string, context: string): CustomCheerio;
(selector: string, context: CheerioElement): CustomCheerio;
(selector: string, context: CheerioElement[]): CustomCheerio;
(selector: string, context: Cheerio): CustomCheerio;
(selector: string, context: cheerio.Element): CustomCheerio;
(selector: string, context: cheerio.Element[]): CustomCheerio;
(selector: string, context: cheerio.Cheerio): CustomCheerio;
(selector: string, context: string, root: string): CustomCheerio;
(selector: string, context: CheerioElement, root: string): CustomCheerio;
(selector: string, context: CheerioElement[], root: string): CustomCheerio;
(selector: string, context: Cheerio, root: string): CustomCheerio;
(selector: string, context: cheerio.Element, root: string): CustomCheerio;
(selector: string, context: cheerio.Element[], root: string): CustomCheerio;
(selector: string, context: cheerio.Cheerio, root: string): CustomCheerio;
(selector: any): CustomCheerio;
}
@ -24,13 +24,13 @@ export interface CustomCheerioStatic extends CheerioSelector {
// JQuery http://api.jquery.com
xml(): string;
root(): CustomCheerio;
contains(container: CheerioElement, contained: CheerioElement): boolean;
contains(container: cheerio.Element, contained: cheerio.Element): boolean;
parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[];
html(options?: CheerioOptionsInterface): string;
html(selector: string, options?: CheerioOptionsInterface): string;
html(element: CustomCheerio, options?: CheerioOptionsInterface): string;
html(element: CheerioElement, options?: CheerioOptionsInterface): string;
html(options?: cheerio.CheerioParserOptions): string;
html(selector: string, options?: cheerio.CheerioParserOptions): string;
html(element: CustomCheerio, options?: cheerio.CheerioParserOptions): string;
html(element: cheerio.Element, options?: cheerio.CheerioParserOptions): string;
//
// CUSTOM METHODS
@ -44,7 +44,7 @@ export interface CustomCheerio {
// Cheerio https://github.com/cheeriojs/cheerio
// JQuery http://api.jquery.com
[index: number]: CheerioElement;
[index: number]: cheerio.Element;
length: number;
// Attributes
@ -63,7 +63,7 @@ export interface CustomCheerio {
removeAttr(name: string): CustomCheerio;
has(selector: string): CustomCheerio;
has(element: CheerioElement): CustomCheerio;
has(element: cheerio.Element): CustomCheerio;
hasClass(className: string): boolean;
addClass(classNames: string): CustomCheerio;
@ -81,10 +81,10 @@ export interface CustomCheerio {
): CustomCheerio;
is(selector: string): boolean;
is(element: CheerioElement): boolean;
is(element: CheerioElement[]): boolean;
is(element: cheerio.Element): boolean;
is(element: cheerio.Element[]): boolean;
is(selection: CustomCheerio): boolean;
is(func: (index: number, element: CheerioElement) => boolean): boolean;
is(func: (index: number, element: cheerio.Element) => boolean): boolean;
// Form
serialize(): string;
@ -98,7 +98,7 @@ export interface CustomCheerio {
parent(selector?: string): CustomCheerio;
parents(selector?: string): CustomCheerio;
parentsUntil(selector?: string, filter?: string): CustomCheerio;
parentsUntil(element: CheerioElement, filter?: string): CustomCheerio;
parentsUntil(element: cheerio.Element, filter?: string): CustomCheerio;
parentsUntil(element: CustomCheerio, filter?: string): CustomCheerio;
prop(name: string): any;
@ -112,7 +112,7 @@ export interface CustomCheerio {
nextAll(selector: string): CustomCheerio;
nextUntil(selector?: string, filter?: string): CustomCheerio;
nextUntil(element: CheerioElement, filter?: string): CustomCheerio;
nextUntil(element: cheerio.Element, filter?: string): CustomCheerio;
nextUntil(element: CustomCheerio, filter?: string): CustomCheerio;
prev(selector?: string): CustomCheerio;
@ -120,7 +120,7 @@ export interface CustomCheerio {
prevAll(selector: string): CustomCheerio;
prevUntil(selector?: string, filter?: string): CustomCheerio;
prevUntil(element: CheerioElement, filter?: string): CustomCheerio;
prevUntil(element: cheerio.Element, filter?: string): CustomCheerio;
prevUntil(element: CustomCheerio, filter?: string): CustomCheerio;
slice(start: number, end?: number): CustomCheerio;
@ -131,19 +131,19 @@ export interface CustomCheerio {
contents(): CustomCheerio;
each(func: (index: number, element: CheerioElement) => any): CustomCheerio;
map(func: (index: number, element: CheerioElement) => any): CustomCheerio;
each(func: (index: number, element: cheerio.Element) => any): CustomCheerio;
map(func: (index: number, element: cheerio.Element) => any): CustomCheerio;
filter(selector: string): CustomCheerio;
filter(selection: CustomCheerio): CustomCheerio;
filter(element: CheerioElement): CustomCheerio;
filter(elements: CheerioElement[]): CustomCheerio;
filter(func: (index: number, element: CheerioElement) => boolean): CustomCheerio;
filter(element: cheerio.Element): CustomCheerio;
filter(elements: cheerio.Element[]): CustomCheerio;
filter(func: (index: number, element: cheerio.Element) => boolean): CustomCheerio;
not(selector: string): CustomCheerio;
not(selection: CustomCheerio): CustomCheerio;
not(element: CheerioElement): CustomCheerio;
not(func: (index: number, element: CheerioElement) => boolean): CustomCheerio;
not(element: cheerio.Element): CustomCheerio;
not(func: (index: number, element: cheerio.Element) => boolean): CustomCheerio;
first(): CustomCheerio;
last(): CustomCheerio;
@ -161,8 +161,8 @@ export interface CustomCheerio {
add(selectorOrHtml: string): CustomCheerio;
add(selector: string, context: Document): CustomCheerio;
add(element: CheerioElement): CustomCheerio;
add(elements: CheerioElement[]): CustomCheerio;
add(element: cheerio.Element): CustomCheerio;
add(elements: cheerio.Element[]): CustomCheerio;
add(selection: CustomCheerio): CustomCheerio;
addBack(): CustomCheerio;
@ -203,8 +203,8 @@ export interface CustomCheerio {
remove(selector?: string): CustomCheerio;
replaceWith(content: string): CustomCheerio;
replaceWith(content: CheerioElement): CustomCheerio;
replaceWith(content: CheerioElement[]): CustomCheerio;
replaceWith(content: cheerio.Element): CustomCheerio;
replaceWith(content: cheerio.Element[]): CustomCheerio;
replaceWith(content: CustomCheerio): CustomCheerio;
replaceWith(content: () => CustomCheerio): CustomCheerio;
@ -236,7 +236,7 @@ export interface CustomCheerio {
// Not Documented
toArray(): CheerioElement[];
toArray(): CustomCheerio[];
//
// CUSTOM METHODS

View file

@ -9,7 +9,4 @@ module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/plugins/lens'],
// TODO: migrate to "jest-environment-jsdom" https://github.com/elastic/kibana/issues/95202
testEnvironment: 'jest-environment-jsdom-thirteen',
};

View file

@ -19,7 +19,9 @@ const MOCKED_PATHS = [
beforeEach(() => {
const spy = jest.spyOn(fs, 'readFileSync').mockImplementation();
MOCKED_PATHS.forEach((file) => when(spy).calledWith(file).mockReturnValue(`contents-of-${file}`));
MOCKED_PATHS.forEach((file) =>
when(spy).calledWith(file, 'utf8').mockReturnValue(`contents-of-${file}`)
);
});
describe('config schema', () => {

View file

@ -33,22 +33,21 @@ describe('useUserInfo', () => {
const { result, waitForNextUpdate } = renderHook(() => useUserInfo());
await waitForNextUpdate();
expect(result).toEqual({
current: {
canUserCRUD: null,
hasEncryptionKey: null,
hasIndexManage: null,
hasIndexMaintenance: null,
hasIndexWrite: null,
hasIndexUpdateDelete: null,
isAuthenticated: null,
isSignalIndexExists: null,
loading: true,
signalIndexName: null,
signalIndexMappingOutdated: null,
},
error: undefined,
expect(result.all).toHaveLength(1);
expect(result.current).toEqual({
canUserCRUD: null,
hasEncryptionKey: null,
hasIndexManage: null,
hasIndexMaintenance: null,
hasIndexWrite: null,
hasIndexUpdateDelete: null,
isAuthenticated: null,
isSignalIndexExists: null,
loading: true,
signalIndexName: null,
signalIndexMappingOutdated: null,
});
expect(result.error).toBeUndefined();
});
});

View file

@ -33,7 +33,7 @@ export function AlertDetailsPageProvider({ getService }: FtrProviderContext) {
const $ = await table.parseDomContent();
return $.findTestSubjects('alert-instance-row')
.toArray()
.map((row: CheerioElement) => {
.map((row) => {
return {
instance: $(row)
.findTestSubject('alertInstancesTableCell-instance')
@ -87,7 +87,7 @@ export function AlertDetailsPageProvider({ getService }: FtrProviderContext) {
$.findTestSubjects('alert-instance-row')
.toArray()
.filter(
(row: CheerioElement) =>
(row) =>
$(row)
.findTestSubject('alertInstancesTableCell-instance')
.find('.euiTableCellContent')

View file

@ -6,7 +6,10 @@
*/
import expect from '@kbn/expect';
import { CustomCheerioStatic } from 'test/functional/services/lib/web_element_wrapper/custom_cheerio_api';
import {
CustomCheerio,
CustomCheerioStatic,
} from 'test/functional/services/lib/web_element_wrapper/custom_cheerio_api';
import { FtrProviderContext } from '../ftr_provider_context';
const ENTER_KEY = '\uE007';
@ -16,7 +19,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext)
const retry = getService('retry');
const testSubjects = getService('testSubjects');
function getRowItemData(row: CheerioElement, $: CustomCheerioStatic) {
function getRowItemData(row: CustomCheerio, $: CustomCheerioStatic) {
return {
name: $(row).findTestSubject('alertsTableCell-name').find('.euiTableCellContent').text(),
tagsText: $(row)
@ -79,7 +82,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext)
const $ = await table.parseDomContent();
return $.findTestSubjects('connectors-row')
.toArray()
.map((row: CheerioElement) => {
.map((row) => {
return {
name: $(row)
.findTestSubject('connectorsTableCell-name')
@ -97,7 +100,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext)
const $ = await table.parseDomContent();
return $.findTestSubjects('alert-row')
.toArray()
.map((row: CheerioElement) => {
.map((row) => {
return getRowItemData(row, $);
});
},
@ -106,7 +109,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext)
const $ = await table.parseDomContent();
return $.findTestSubjects('alert-row')
.toArray()
.map((row: CheerioElement) => {
.map((row) => {
const rowItem = getRowItemData(row, $);
return {
...rowItem,

691
yarn.lock

File diff suppressed because it is too large Load diff