Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `7.17`:
- [Bump [email protected]
(#161630)](#161630)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Patryk
Kopyciński","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-07-15T15:42:30Z","message":"Bump
[email protected] (#161630)\n\n## Summary\r\n\r\nBump `[email protected]` and
resolve duplicated jest-related
dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","backport:prev-MAJOR","v8.9.0","v8.10.0"],"number":161630,"url":"https://github.com/elastic/kibana/pull/161630","mergeCommit":{"message":"Bump
[email protected] (#161630)\n\n## Summary\r\n\r\nBump `[email protected]` and
resolve duplicated jest-related
dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/162008","number":162008,"state":"MERGED","mergeCommit":{"sha":"d3e1266850f2a6f03ce2fbe05a4732218d11e1f8","message":"[8.9]
Bump [email protected] (#161630) (#162008)\n\n# Backport\n\nThis will backport
the following commits from `main` to `8.9`:\n- [Bump
[email protected]\n(#161630)](https://github.com/elastic/kibana/pull/161630)\n\n<!---
Backport version: 8.9.7 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Patryk\nKopyciński\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2023-07-15T15:42:30Z\",\"message\":\"Bump\[email protected]
(#161630)\\n\\n## Summary\\r\\n\\r\\nBump `[email protected]` and\nresolve
duplicated
jest-related\ndependencies\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:
kibanamachine\n<[email protected]>\",\"sha\":\"b2b7cf6253252be011198feda6f04d892cfc5515\",\"branchLabelMapping\":{\"^v8.10.0$\":\"main\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"Team:uptime\",\"release_note:skip\",\"backport:prev-MAJOR\",\"v8.10.0\"],\"number\":161630,\"url\":\"https://github.com/elastic/kibana/pull/161630\",\"mergeCommit\":{\"message\":\"Bump\[email protected]
(#161630)\\n\\n## Summary\\r\\n\\r\\nBump `[email protected]` and\nresolve
duplicated
jest-related\ndependencies\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:
kibanamachine\n<[email protected]>\",\"sha\":\"b2b7cf6253252be011198feda6f04d892cfc5515\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v8.10.0\",\"labelRegex\":\"^v8.10.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/161630\",\"number\":161630,\"mergeCommit\":{\"message\":\"Bump\[email protected]
(#161630)\\n\\n## Summary\\r\\n\\r\\nBump `[email protected]` and\nresolve
duplicated
jest-related\ndependencies\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:
kibanamachine\n<[email protected]>\",\"sha\":\"b2b7cf6253252be011198feda6f04d892cfc5515\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Patryk Kopyciński
<[email protected]>"}},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161630","number":161630,"mergeCommit":{"message":"Bump
[email protected] (#161630)\n\n## Summary\r\n\r\nBump `[email protected]` and
resolve duplicated jest-related
dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515"}}]}]
BACKPORT-->
  • Loading branch information
patrykkopycinski authored Jul 17, 2023
1 parent 3545ce4 commit 376c1cd
Show file tree
Hide file tree
Showing 48 changed files with 648 additions and 897 deletions.
59 changes: 21 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,14 @@
"**/@babel/runtime": "^7.21.0",
"**/@babel/traverse": "^7.21.2",
"**/@babel/types": "^7.21.2",
"**/@jest/console": "29.3.1",
"**/@jest/reporters": "29.3.1",
"**/@types/babel__generator/@babel/types": "^7.21.0",
"**/@types/node": "16.11.7",
"**/@types/react-dom": "^16.9.8",
"**/babel-jest": "29.3.1",
"**/chokidar": "^3.4.3",
"**/expect": "29.3.1",
"**/globule/minimatch": "^3.1.2",
"**/hoist-non-react-statics": "^3.3.2",
"**/html-minifier/uglify-js": "^3.14.3",
"**/isomorphic-fetch/node-fetch": "^2.6.7",
"**/istanbul-instrumenter-loader/schema-utils": "1.0.0",
"**/jest": "29.3.1",
"**/jest-cli": "29.3.1",
"**/jest-config": "29.3.1",
"**/jest-diff": "29.3.1",
"**/jest-environment-jsdom": "29.3.1",
"**/jest-matcher-utils": "29.3.1",
"**/jest-mock": "29.3.1",
"**/jest-runtime": "29.3.1",
"**/jest-snapshot": "29.3.1",
"**/json-schema": "^0.4.0",
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
Expand Down Expand Up @@ -461,9 +447,10 @@
"@emotion/babel-preset-css-prop": "^11.11.0",
"@emotion/jest": "^11.3.0",
"@istanbuljs/schema": "^0.1.2",
"@jest/console": "29.3.1",
"@jest/reporters": "29.3.1",
"@jest/types": "29.3.1",
"@jest/console": "^29.6.1",
"@jest/reporters": "^29.6.1",
"@jest/transform": "^29.6.1",
"@jest/types": "^29.6.1",
"@kbn/babel-code-parser": "link:bazel-bin/packages/kbn-babel-code-parser",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset",
"@kbn/babel-register": "link:bazel-bin/packages/kbn-babel-register",
Expand Down Expand Up @@ -568,13 +555,12 @@
"@types/http-proxy": "^1.17.4",
"@types/inquirer": "^7.3.1",
"@types/intl-relativeformat": "^2.1.0",
"@types/jest": "29.2.0",
"@types/jest-specific-snapshot": "^0.5.5",
"@types/jest": "^29.5.3",
"@types/jest-when": "^2.7.2",
"@types/jquery": "^3.3.31",
"@types/js-search": "^1.4.0",
"@types/js-yaml": "^3.11.1",
"@types/jsdom": "^16.2.13",
"@types/jsdom": "^20.0.1",
"@types/json-stable-stringify": "^1.0.32",
"@types/json5": "^2.2.0",
"@types/license-checker": "15.0.0",
Expand Down Expand Up @@ -675,7 +661,7 @@
"argsplit": "^1.0.5",
"autoprefixer": "^10.4.7",
"axe-core": "^4.0.2",
"babel-jest": "29.3.1",
"babel-jest": "^29.6.1",
"babel-loader": "^8.2.5",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-istanbul": "^6.1.1",
Expand Down Expand Up @@ -756,23 +742,20 @@
"inquirer": "^7.3.3",
"is-glob": "^4.0.1",
"is-path-inside": "^3.0.2",
"istanbul-instrumenter-loader": "^3.0.1",
"jest": "29.3.1",
"jest-canvas-mock": "^2.3.1",
"jest-cli": "29.3.1",
"jest-config": "29.3.1",
"jest-diff": "29.3.1",
"jest-environment-jsdom": "29.3.1",
"jest-environment-jsdom-thirteen": "^1.0.1",
"jest-matcher-utils": "29.3.1",
"jest-mock": "29.3.1",
"jest-runtime": "29.3.1",
"jest-silent-reporter": "^0.5.0",
"jest-snapshot": "29.3.1",
"jest-specific-snapshot": "^5.0.0",
"jest": "^29.6.1",
"jest-canvas-mock": "^2.5.2",
"jest-cli": "^29.6.1",
"jest-config": "^29.6.1",
"jest-diff": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"jest-matcher-utils": "^29.6.1",
"jest-mock": "^29.6.1",
"jest-runtime": "^29.6.1",
"jest-snapshot": "^29.6.1",
"jest-specific-snapshot": "^8.0.0",
"jest-styled-components": "7.0.3",
"jest-when": "3.4.1",
"jsdom": "13.1.0",
"jest-when": "^3.5.2",
"jsdom": "^20.0.1",
"json-schema-typed": "^8.0.1",
"json5": "^2.2.3",
"jsondiffpatch": "0.4.1",
Expand Down Expand Up @@ -808,7 +791,7 @@
"postcss-loader": "^4.2.0",
"postcss-prefix-selector": "^1.16.0",
"prettier": "^2.7.1",
"pretty-format": "29.3.1",
"pretty-format": "^29.6.1",
"pretty-ms": "^5.0.0",
"proxy": "^2.1.1",
"q": "^1.5.1",
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/application/application_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ describe('#stop()', () => {
});

afterEach(() => {
jest.restoreAllMocks();
jest.clearAllMocks();
});

it('removes the beforeunload listener', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/logging/logging_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ beforeEach(() => {
});

afterEach(() => {
jest.restoreAllMocks();
jest.clearAllMocks();
mockCreateWriteStream.mockClear();
mockStreamWrite.mockClear();
});
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/metrics/collectors/os.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('OsMetricsCollector', () => {
});

afterEach(() => {
jest.restoreAllMocks();
jest.clearAllMocks();
});

it('collects platform info from the os package', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ describe('plugins discovery system', () => {
afterEach(() => {
mockFs.restore();
// restore the console.log behavior
jest.restoreAllMocks();
jest.clearAllMocks();
});

it('discovers plugins in the search locations', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/root/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ beforeEach(() => {
});

afterEach(() => {
jest.restoreAllMocks();
jest.clearAllMocks();
logger.asLoggerFactory.mockClear();
logger.stop.mockClear();
rawConfigService.getConfig$.mockClear();
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data/common/search/aggs/agg_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('AggConfig', () => {
];

beforeEach(() => {
jest.restoreAllMocks();
jest.clearAllMocks();
indexPattern = {
id: '1234',
title: 'logstash-*',
Expand Down Expand Up @@ -231,6 +231,7 @@ describe('AggConfig', () => {
objs.forEach((obj, i) => {
expect(obj).toHaveProperty('id', String(start + i));
});
spy.mockRestore();
});
});

Expand Down
16 changes: 9 additions & 7 deletions x-pack/plugins/alerting/server/rule_type_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let ruleTypeRegistryParams: ConstructorOptions;
const taskManager = taskManagerMock.createSetup();

beforeEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
mockedLicenseState = licenseStateMock.create();
ruleTypeRegistryParams = {
taskManager,
Expand Down Expand Up @@ -76,16 +76,18 @@ describe('register()', () => {

const invalidCharacters = [' ', ':', '*', '*', '/'];
for (const char of invalidCharacters) {
expect(() => registry.register({ ...alertType, id: `${alertType.id}${char}` })).toThrowError(
new Error(`expected AlertType Id not to include invalid character: ${char}`)
expect(() =>
registry.register({ ...alertType, id: `${alertType.id}${char}` })
).toThrowErrorMatchingInlineSnapshot(
`"expected AlertType Id not to include invalid character: ${char}"`
);
}

const [first, second] = invalidCharacters;
expect(() =>
registry.register({ ...alertType, id: `${first}${alertType.id}${second}` })
).toThrowError(
new Error(`expected AlertType Id not to include invalid characters: ${first}, ${second}`)
).toThrowErrorMatchingInlineSnapshot(
`"expected AlertType Id not to include invalid characters: ${first}, ${second}"`
);
});

Expand All @@ -107,8 +109,8 @@ describe('register()', () => {
};
const registry = new RuleTypeRegistry(ruleTypeRegistryParams);

expect(() => registry.register(alertType)).toThrowError(
new Error(`expected value of type [string] but got [number]`)
expect(() => registry.register(alertType)).toThrowErrorMatchingInlineSnapshot(
`"expected value of type [string] but got [number]"`
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ describe('TimeComparison', () => {
});

describe('TimeComparison component', () => {
const spy = jest.spyOn(urlHelpers, 'replace');
const spy = jest.spyOn(urlHelpers, 'replace').mockImplementation(() => {});
beforeEach(() => {
jest.resetAllMocks();
spy.mockClear();
});
describe('Time range is between 0 - 24 hours', () => {
it('sets default values', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jest.mock('../../common/lib/kibana');
describe('useActionTypes', () => {
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

test('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const configuration: ConnectorConfiguration = {
describe('useConfigure', () => {
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

test('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jest.mock('../../common/lib/kibana');
describe('useConnectors', () => {
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

test('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('useUpdateCases', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('useGetActionLicense', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('useGetCase', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('useGetCaseUserActions', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('useGetCases', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('useGetCasesStatus', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('useGetReporters', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('useGetTags', () => {
const abortCtrl = new AbortController();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('usePostCase', () => {
};
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('usePostComment', () => {
const updateCaseCallback = jest.fn();
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('useUpdateCase', () => {
};
beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('useUpdateComment', () => {

beforeEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

it('init', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,12 @@ services.alertInstanceFactory.mockImplementation((instanceID: string) => {
alertInstance.state = newState;
return alertInstance.instance;
});
alertInstance.instance.scheduleActions.mockImplementation((id: string, action: any) => {
alertInstance.actionQueue.push({ id, action });
return alertInstance.instance;
});
(alertInstance.instance.scheduleActions as jest.Mock).mockImplementation(
(id: string, action: any) => {
alertInstance.actionQueue.push({ id, action });
return alertInstance.instance;
}
);
return alertInstance.instance;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ describe('getElementPositionAndAttributes', () => {
});

afterEach(() => {
jest.restoreAllMocks();
document.body.innerHTML = '';
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('POST /diagnose/browser', () => {
});

afterEach(async () => {
jest.restoreAllMocks();
await server.stop();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('When the add exception modal is opened', () => {

afterEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

describe('when the modal is loading', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ describe('When the edit exception modal is opened', () => {

afterEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});

describe('when the modal is loading', () => {
Expand Down
Loading

0 comments on commit 376c1cd

Please sign in to comment.