diff --git a/.eslintrc.js b/.eslintrc.js index f1d6f30a527e..80dcabbef8a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -114,7 +114,7 @@ Object.keys(require('eslint-plugin-mocha').rules).forEach((k) => { module.exports = { root: true, - extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'], + extends: ['@osd/eslint-config-opensearch-dashboards', 'plugin:@elastic/eui/recommended'], overrides: [ /** diff --git a/examples/bfetch_explorer/server/plugin.ts b/examples/bfetch_explorer/server/plugin.ts index 6360a846772f..b94a210d1444 100644 --- a/examples/bfetch_explorer/server/plugin.ts +++ b/examples/bfetch_explorer/server/plugin.ts @@ -67,7 +67,7 @@ export class BfetchExplorerPlugin implements Plugin { // Validate inputs. if (num < 0) throw new Error('Invalid number'); // Wait number of specified milliseconds. - await new Promise((r) => setTimeout(r, num)); + await new Promise((r) => setTimeout(r, num)); // Double the number and send it back. return { num: 2 * num }; }, diff --git a/examples/embeddable_examples/public/book/edit_book_action.tsx b/examples/embeddable_examples/public/book/edit_book_action.tsx index 4de270e95c82..654e8ce862c0 100644 --- a/examples/embeddable_examples/public/book/edit_book_action.tsx +++ b/examples/embeddable_examples/public/book/edit_book_action.tsx @@ -81,7 +81,7 @@ export const createEditBookAction = (getStartServices: () => Promise { - return new Promise(() => { + return new Promise(() => { return true; }); }, diff --git a/examples/state_containers_examples/public/todo/todo.tsx b/examples/state_containers_examples/public/todo/todo.tsx index 120331e28a26..f511a470ca69 100644 --- a/examples/state_containers_examples/public/todo/todo.tsx +++ b/examples/state_containers_examples/public/todo/todo.tsx @@ -326,7 +326,7 @@ export const TodoAppPage: React.FC<{ function withDefaultState( stateContainer: BaseStateContainer, - // eslint-disable-next-line no-shadow + // eslint-disable-next-line @typescript-eslint/no-shadow defaultState: State ): INullableBaseStateContainer { return { diff --git a/examples/state_containers_examples/public/with_data_services/components/app.tsx b/examples/state_containers_examples/public/with_data_services/components/app.tsx index bacccfccfd4d..466cf531c584 100644 --- a/examples/state_containers_examples/public/with_data_services/components/app.tsx +++ b/examples/state_containers_examples/public/with_data_services/components/app.tsx @@ -193,6 +193,7 @@ function useGlobalStateSyncing( }, [query, osdUrlStateStorage]); } +// eslint-disable-next-line @typescript-eslint/no-shadow function useAppStateSyncing( appStateContainer: BaseStateContainer, query: DataPublicPluginStart['query'], diff --git a/package.json b/package.json index 1354a73ce1ac..e81189740da1 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "**/minimist": "^1.2.5", "**/node-jose": "^2.1.0", "**/trim": "^0.0.3", - "**/typescript": "4.0.2" + "**/typescript": "4.1.6" }, "workspaces": { "packages": [ @@ -213,7 +213,6 @@ "@elastic/apm-rum": "^5.6.1", "@elastic/charts": "23.2.2", "@elastic/ems-client": "7.10.0", - "@elastic/eslint-config-kibana": "0.15.0", "@elastic/eslint-plugin-eui": "0.0.2", "@elastic/filesaver": "1.1.2", "@elastic/github-checks-reporter": "0.0.20b3", @@ -222,6 +221,7 @@ "@microsoft/api-extractor": "^7.19.3", "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", + "@osd/eslint-config-opensearch-dashboards": "1.0.0", "@osd/eslint-import-resolver-opensearch-dashboards": "2.0.0", "@osd/eslint-plugin-eslint": "1.0.0", "@osd/expect": "1.0.0", @@ -246,7 +246,7 @@ "@types/babel__core": "^7.1.17", "@types/bluebird": "^3.1.1", "@types/chance": "^1.0.0", - "@types/cheerio": "^0.22.10", + "@types/cheerio": "^0.22.30", "@types/chromedriver": "^81.0.0", "@types/classnames": "^2.2.9", "@types/color": "^3.0.0", @@ -255,7 +255,7 @@ "@types/deep-freeze-strict": "^1.1.0", "@types/delete-empty": "^2.0.0", "@types/elasticsearch": "^5.0.33", - "@types/enzyme": "^3.10.5", + "@types/enzyme": "^3.10.11", "@types/eslint": "^6.1.3", "@types/fetch-mock": "^7.3.1", "@types/flot": "^0.0.31", @@ -270,6 +270,7 @@ "@types/has-ansi": "^3.0.0", "@types/history": "^4.7.3", "@types/hjson": "^2.4.2", + "@types/istanbul-lib-coverage": "^2.0.4", "@types/jest": "^27.4.0", "@types/joi": "^13.4.2", "@types/jquery": "^3.3.31", @@ -320,8 +321,8 @@ "@types/webpack": "^4.41.31", "@types/webpack-env": "^1.16.3", "@types/zen-observable": "^0.8.0", - "@typescript-eslint/eslint-plugin": "^3.10.0", - "@typescript-eslint/parser": "^3.10.0", + "@typescript-eslint/eslint-plugin": "^5.15.0", + "@typescript-eslint/parser": "^5.15.0", "angular-aria": "^1.8.0", "angular-mocks": "^1.8.2", "angular-recursion": "^1.0.5", @@ -334,7 +335,7 @@ "brace": "0.11.1", "chai": "3.5.0", "chance": "1.0.18", - "cheerio": "0.22.0", + "cheerio": "^1.0.0-rc.10", "chromedriver": "^91.0.1", "classnames": "2.2.6", "compare-versions": "3.5.1", @@ -343,8 +344,8 @@ "dedent": "^0.7.0", "delete-empty": "^2.0.0", "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.2", - "enzyme-to-json": "^3.4.4", + "enzyme-adapter-react-16": "^1.15.6", + "enzyme-to-json": "^3.6.2", "eslint": "^6.8.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-babel": "^5.3.1", @@ -360,7 +361,7 @@ "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.20.3", - "eslint-plugin-react-hooks": "^4.0.4", + "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-perf": "^3.2.3", "exit-hook": "^2.2.0", "fetch-mock": "^7.3.9", @@ -437,7 +438,7 @@ "topojson-client": "3.0.0", "tough-cookie": "^4.0.0", "tree-kill": "^1.2.2", - "typescript": "4.0.2", + "typescript": "4.1.6", "ui-select": "0.19.8", "vega": "^5.17.3", "vega-lite": "^4.16.8", diff --git a/packages/opensearch-eslint-config-opensearch-dashboards/README.md b/packages/opensearch-eslint-config-opensearch-dashboards/README.md index 4fb3f13c8f29..ea23347cb391 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/README.md +++ b/packages/opensearch-eslint-config-opensearch-dashboards/README.md @@ -10,7 +10,7 @@ in your `.eslintrc`: ```javascript { extends: [ - '@elastic/eslint-config-kibana' + '@osd/eslint-config-opensearch-dashboards' ] } ``` @@ -18,14 +18,14 @@ in your `.eslintrc`: ## Optional jest config If the project uses the [jest test runner](https://facebook.github.io/jest/), -the `@elastic/eslint-config-kibana/jest` config can be extended as well to use +the `@osd/eslint-config-opensearch-dashboards/jest` config can be extended as well to use `eslint-plugin-jest` and add settings specific to it: ```javascript { extends: [ - '@elastic/eslint-config-kibana', - '@elastic/eslint-config-kibana/jest' + '@osd/eslint-config-opensearch-dashboards', + '@osd/eslint-config-opensearch-dashboards/jest' ] } ``` diff --git a/packages/opensearch-eslint-config-opensearch-dashboards/package.json b/packages/opensearch-eslint-config-opensearch-dashboards/package.json index 1cafb013a600..e4edae620f49 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/package.json +++ b/packages/opensearch-eslint-config-opensearch-dashboards/package.json @@ -1,6 +1,6 @@ { - "name": "@elastic/eslint-config-kibana", - "version": "0.15.0", + "name": "@osd/eslint-config-opensearch-dashboards", + "version": "1.0.0", "description": "The eslint config used by the opensearch dashboards team", "main": ".eslintrc.js", "repository": { @@ -18,8 +18,8 @@ }, "homepage": "https://github.com/opensearch-project/OpenSearch-Dashboards/tree/main/packages/opensearch-eslint-config-opensearch-dashboards", "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^3.10.0", - "@typescript-eslint/parser": "^3.10.0", + "@typescript-eslint/eslint-plugin": "^5.15.0", + "@typescript-eslint/parser": "^5.15.0", "babel-eslint": "^10.0.3", "eslint": "^6.8.0", "eslint-plugin-babel": "^5.3.1", @@ -32,6 +32,6 @@ "eslint-plugin-no-unsanitized": "^3.0.2", "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-react": "^7.17.0", - "eslint-plugin-react-hooks": "^4.0.4" + "eslint-plugin-react-hooks": "^4.2.0" } } diff --git a/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js b/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js index 84e64897e225..840b35cd51a2 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js +++ b/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js @@ -38,8 +38,7 @@ const semver = require('semver'); const PKG = require('../../package.json'); -const eslintConfigPrettierTypescriptEslintRules = require('eslint-config-prettier/@typescript-eslint') - .rules; +const eslintConfigPrettierTypescriptEslintRules = require('eslint-config-prettier/@typescript-eslint').rules; // The current implementation excluded all the variables matching the regexp. // We should remove it as soon as multiple underscores are supported by the linter. @@ -52,7 +51,13 @@ module.exports = { files: ['**/*.{ts,tsx}'], parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'ban', 'import', 'prefer-object-spread', 'eslint-comments'], + plugins: [ + '@typescript-eslint', + 'ban', + 'import', + 'prefer-object-spread', + 'eslint-comments' + ], settings: { 'import/resolver': { @@ -74,10 +79,9 @@ module.exports = { parserOptions: { sourceType: 'module', - ecmaVersion: 6, + ecmaVersion: 2018, ecmaFeatures: { - experimentalObjectRestSpread: true, - jsx: true, + jsx: true }, // NOTE: That is to avoid a known performance issue related with the `ts.Program` used by // typescript eslint. As we are not using rules that need types information, we can safely @@ -86,7 +90,7 @@ module.exports = { // https://github.com/typescript-eslint/typescript-eslint/issues/389 // https://github.com/typescript-eslint/typescript-eslint/issues/243 // https://github.com/typescript-eslint/typescript-eslint/pull/361 - project: undefined, + project: undefined }, // NOTE: we can't override the extends option here to apply @@ -96,45 +100,39 @@ module.exports = { // // For now we are using an workaround to create // those extended rules arrays - rules: { - ...{ + rules: Object.assign( + { // Most of the ports were done according // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md // // Old recommended tslint rules '@typescript-eslint/adjacent-overload-signatures': 'error', - '@typescript-eslint/array-type': [ - 'error', - { default: 'array-simple', readonly: 'array-simple' }, - ], - '@typescript-eslint/ban-types': [ - 'error', - { + '@typescript-eslint/array-type': ['error', { default: 'array-simple', readonly: 'array-simple' }], + '@typescript-eslint/ban-types': ['error', { types: { SFC: { message: 'Use FC or FunctionComponent instead.', - fixWith: 'FC', + fixWith: 'FC' }, 'React.SFC': { message: 'Use FC or FunctionComponent instead.', - fixWith: 'React.FC', + fixWith: 'React.FC' }, StatelessComponent: { message: 'Use FunctionComponent instead.', - fixWith: 'FunctionComponent', + fixWith: 'FunctionComponent' }, 'React.StatelessComponent': { message: 'Use FunctionComponent instead.', - fixWith: 'React.FunctionComponent', + fixWith: 'React.FunctionComponent' }, // used in the codebase in the wild '{}': false, - object: false, - Function: false, - }, - }, - ], - camelcase: 'off', + 'object': false, + 'Function': false, + } + }], + 'camelcase': 'off', '@typescript-eslint/naming-convention': [ 'error', { @@ -142,8 +140,8 @@ module.exports = { format: ['camelCase'], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'variable', @@ -154,40 +152,43 @@ module.exports = { ], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'parameter', - format: ['camelCase', 'PascalCase'], + format: [ + 'camelCase', + 'PascalCase', + ], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'memberLike', format: [ 'camelCase', 'PascalCase', - 'snake_case', // keys in elasticsearch requests / responses - 'UPPER_CASE', + 'snake_case', // keys in OpenSearch requests / responses + 'UPPER_CASE' ], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'function', format: [ 'camelCase', - 'PascalCase', // React.FunctionComponent = + 'PascalCase' // React.FunctionComponent = ], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'typeLike', @@ -199,51 +200,65 @@ module.exports = { selector: 'enum', format: ['PascalCase', 'UPPER_CASE', 'camelCase'], }, + // https://typescript-eslint.io/rules/naming-convention/#ignore-properties-that-require-quotes + // restore check behavior before https://github.com/typescript-eslint/typescript-eslint/pull/4582 + { + selector: [ + 'classProperty', + 'objectLiteralProperty', + 'typeProperty', + 'classMethod', + 'objectLiteralMethod', + 'typeMethod', + 'accessor', + 'enumMember' + ], + format: null, + modifiers: ['requiresQuotes'] + } ], - '@typescript-eslint/explicit-member-accessibility': [ - 'error', + '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'off', overrides: { accessors: 'explicit', constructors: 'no-public', - parameterProperties: 'explicit', - }, - }, + parameterProperties: 'explicit' + } + } ], '@typescript-eslint/prefer-function-type': 'error', '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], - '@typescript-eslint/member-ordering': [ - 'error', - { - default: ['public-static-field', 'static-field', 'instance-field'], - }, - ], + '@typescript-eslint/member-ordering': ['error', { + 'default': ['public-static-field', 'static-field', 'instance-field'] + }], '@typescript-eslint/consistent-type-assertions': 'error', '@typescript-eslint/no-empty-interface': 'error', '@typescript-eslint/no-extra-non-null-assertion': 'error', '@typescript-eslint/no-misused-new': 'error', '@typescript-eslint/no-namespace': 'error', - '@typescript-eslint/triple-slash-reference': [ - 'error', - { + '@typescript-eslint/no-shadow': 'error', + // rely on typescript + '@typescript-eslint/no-undef': 'off', + 'no-undef': 'off', + '@typescript-eslint/triple-slash-reference': ['error', { path: 'never', types: 'never', - lib: 'never', - }, - ], + lib: 'never' + }], '@typescript-eslint/no-var-requires': 'error', '@typescript-eslint/unified-signatures': 'error', 'constructor-super': 'error', 'dot-notation': 'error', - eqeqeq: ['error', 'always', { null: 'ignore' }], + 'eqeqeq': ['error', 'always', {'null': 'ignore'}], 'guard-for-in': 'error', - 'import/order': [ - 'error', - { - groups: [['external', 'builtin'], 'internal', ['parent', 'sibling', 'index']], - }, - ], + 'import/order': ['error', { + 'groups': [ + ['external', 'builtin'], + 'internal', + ['parent', 'sibling', 'index'], + ], + }], 'max-classes-per-file': ['error', 1], 'no-bitwise': 'error', 'no-caller': 'error', @@ -255,7 +270,6 @@ module.exports = { 'no-eval': 'error', 'no-new-wrappers': 'error', 'no-script-url': 'error', - 'no-shadow': 'error', 'no-throw-literal': 'error', 'no-undef-init': 'error', 'no-unsafe-finally': 'error', @@ -265,33 +279,28 @@ module.exports = { 'no-unused-labels': 'error', 'no-var': 'error', 'object-shorthand': 'error', - 'one-var': ['error', 'never'], + 'one-var': [ 'error', 'never' ], 'prefer-const': 'error', 'prefer-rest-params': 'error', - radix: 'error', - 'spaced-comment': [ - 'error', - 'always', - { - exceptions: ['/'], - }, - ], + 'radix': 'error', + 'spaced-comment': ["error", "always", { + "exceptions": ["/"] + }], 'use-isnan': 'error', - // Old tslint yml override or defined rules 'ban/ban': [ 2, - { name: ['describe', 'only'], message: 'No exclusive suites.' }, - { name: ['it', 'only'], message: 'No exclusive tests.' }, - { name: ['test', 'only'], message: 'No exclusive tests.' }, + {'name': ['describe', 'only'], 'message': 'No exclusive suites.'}, + {'name': ['it', 'only'], 'message': 'No exclusive tests.'}, + {'name': ['test', 'only'], 'message': 'No exclusive tests.'}, + ], 'import/no-default-export': 'error', - 'eslint-comments/no-unused-disable': 'error', - 'eslint-comments/no-unused-enable': 'error', + 'eslint-comments/no-unused-enable': 'error' }, - ...eslintConfigPrettierTypescriptEslintRules, - }, - }, - ], + eslintConfigPrettierTypescriptEslintRules + ) + } + ] }; diff --git a/packages/osd-ace/package.json b/packages/osd-ace/package.json index 5a2f3141ddd5..2a9a35545121 100644 --- a/packages/osd-ace/package.json +++ b/packages/osd-ace/package.json @@ -15,7 +15,7 @@ "@osd/dev-utils": "1.0.0", "@osd/babel-preset": "1.0.0", "raw-loader": "^4.0.2", - "typescript": "4.0.2", + "typescript": "4.1.6", "webpack": "^4.41.5" } } diff --git a/packages/osd-analytics/package.json b/packages/osd-analytics/package.json index d460ab335a2d..a4106d97152a 100644 --- a/packages/osd-analytics/package.json +++ b/packages/osd-analytics/package.json @@ -17,6 +17,6 @@ "@babel/cli": "^7.16.0", "@osd/dev-utils": "1.0.0", "@osd/babel-preset": "1.0.0", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/packages/osd-apm-config-loader/package.json b/packages/osd-apm-config-loader/package.json index 261b74950463..4080cd8c879a 100644 --- a/packages/osd-apm-config-loader/package.json +++ b/packages/osd-apm-config-loader/package.json @@ -17,7 +17,7 @@ "lodash": "^4.17.21" }, "devDependencies": { - "typescript": "4.0.2", + "typescript": "4.1.6", "tsd": "^0.16.0" } } diff --git a/packages/osd-config-schema/package.json b/packages/osd-config-schema/package.json index 5e727f3423c6..042247e46ea8 100644 --- a/packages/osd-config-schema/package.json +++ b/packages/osd-config-schema/package.json @@ -10,7 +10,7 @@ "osd:bootstrap": "yarn build" }, "devDependencies": { - "typescript": "4.0.2", + "typescript": "4.1.6", "tsd": "^0.16.0" }, "peerDependencies": { diff --git a/packages/osd-config/package.json b/packages/osd-config/package.json index a9c0d2875c26..9ef6b3ac6ad7 100644 --- a/packages/osd-config/package.json +++ b/packages/osd-config/package.json @@ -24,7 +24,7 @@ "devDependencies": { "@osd/dev-utils": "1.0.0", "@osd/utility-types": "1.0.0", - "typescript": "4.0.2", + "typescript": "4.1.6", "tsd": "^0.16.0" } } diff --git a/packages/osd-dev-utils/package.json b/packages/osd-dev-utils/package.json index 3177d8b9fb59..c98b55bc4d5a 100644 --- a/packages/osd-dev-utils/package.json +++ b/packages/osd-dev-utils/package.json @@ -17,7 +17,6 @@ "@osd/utils": "1.0.0", "axios": "^0.21.4", "chalk": "^4.1.0", - "cheerio": "0.22.0", "dedent": "^0.7.0", "execa": "^4.0.2", "exit-hook": "^2.2.0", @@ -37,6 +36,7 @@ "@osd/expect": "1.0.0", "@types/vinyl": "^2.0.4", "chance": "1.0.18", - "typescript": "4.0.2" + "cheerio": "^1.0.0-rc.10", + "typescript": "4.1.6" } } diff --git a/packages/osd-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts b/packages/osd-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts index 991e0dc2ae25..a222abeb5449 100644 --- a/packages/osd-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts +++ b/packages/osd-dev-utils/src/ci_stats_reporter/ci_stats_reporter.ts @@ -174,7 +174,7 @@ export class CiStatsReporter { `failed to reach opensearch-dashboards-ci-stats service [reason=${reason}], retrying in ${attempt} seconds` ); - await new Promise((resolve) => setTimeout(resolve, attempt * 1000)); + await new Promise((resolve) => setTimeout(resolve, attempt * 1000)); } } } diff --git a/packages/osd-dev-utils/src/osd_client/osd_client_requester.ts b/packages/osd-dev-utils/src/osd_client/osd_client_requester.ts index b1471677b732..8acd157e7e69 100644 --- a/packages/osd-dev-utils/src/osd_client/osd_client_requester.ts +++ b/packages/osd-dev-utils/src/osd_client/osd_client_requester.ts @@ -78,7 +78,7 @@ export interface ReqOptions { } const delay = (ms: number) => - new Promise((resolve) => { + new Promise((resolve) => { setTimeout(resolve, ms); }); diff --git a/packages/osd-dev-utils/src/proc_runner/proc.ts b/packages/osd-dev-utils/src/proc_runner/proc.ts index f563818b9d98..19082560acaf 100644 --- a/packages/osd-dev-utils/src/proc_runner/proc.ts +++ b/packages/osd-dev-utils/src/proc_runner/proc.ts @@ -65,7 +65,7 @@ async function withTimeout( try { await Promise.race([ attempt(), - new Promise((_, reject) => setTimeout(() => reject(TIMEOUT), ms)), + new Promise((_, reject) => setTimeout(() => reject(TIMEOUT), ms)), ]); } catch (error) { if (error === TIMEOUT) { diff --git a/packages/osd-dev-utils/src/proc_runner/proc_runner.ts b/packages/osd-dev-utils/src/proc_runner/proc_runner.ts index f830bfa42829..6600eb9a8bfd 100644 --- a/packages/osd-dev-utils/src/proc_runner/proc_runner.ts +++ b/packages/osd-dev-utils/src/proc_runner/proc_runner.ts @@ -150,7 +150,7 @@ export class ProcRunner { // processes and stopping, but consumers of run() shouldn't have to // prepare for that, so just return a never-resolving promise if (this.closing) { - await new Promise(noop); + await new Promise(noop); } } } diff --git a/packages/osd-dev-utils/src/proc_runner/with_proc_runner.test.ts b/packages/osd-dev-utils/src/proc_runner/with_proc_runner.test.ts index 9eadf12ba296..e2cc4092be51 100644 --- a/packages/osd-dev-utils/src/proc_runner/with_proc_runner.test.ts +++ b/packages/osd-dev-utils/src/proc_runner/with_proc_runner.test.ts @@ -67,7 +67,7 @@ it('waits for promise to resolve before tearing down proc', async () => { let teardownSpy; await withProcRunner(new ToolingLog(), async (proc) => { - await new Promise((resolve) => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 500)); teardownSpy = jest.spyOn(proc, 'teardown'); }); @@ -81,7 +81,7 @@ it('waits for promise to reject before tearing down proc and rejecting with the await expect( withProcRunner(new ToolingLog(), async (proc) => { - await new Promise((resolve) => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 500)); teardownSpy = jest.spyOn(proc, 'teardown'); throw error; }) diff --git a/packages/osd-dev-utils/src/run/run_with_commands.test.ts b/packages/osd-dev-utils/src/run/run_with_commands.test.ts index a4e6cc4bcac0..c6a202a6519b 100644 --- a/packages/osd-dev-utils/src/run/run_with_commands.test.ts +++ b/packages/osd-dev-utils/src/run/run_with_commands.test.ts @@ -60,7 +60,7 @@ beforeEach(() => { }); it('extends the context using extendContext()', async () => { - const context: any = await new Promise((resolve) => { + const context: any = await new Promise((resolve) => { testCli.command({ name: 'foo', description: 'some command', run: resolve }).execute(); }); diff --git a/packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_webpack_config.js b/packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_webpack_config.js index 2d92e434f6f1..6fd9ec69ac71 100755 --- a/packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_webpack_config.js +++ b/packages/osd-eslint-import-resolver-opensearch-dashboards/lib/get_webpack_config.js @@ -42,7 +42,6 @@ exports.getWebpackConfig = function (opensearchDashboardsPath) { alias: { // Dev defaults for test bundle https://github.com/opensearch-project/OpenSearch-Dashboards/blob/6998f074542e8c7b32955db159d15661aca253d7/src/core_plugins/tests_bundle/index.js#L73-L78 fixtures: resolve(opensearchDashboardsPath, 'src/fixtures'), - test_utils: resolve(opensearchDashboardsPath, 'src/test_utils/public'), }, unsafeCache: true, }, diff --git a/packages/osd-i18n/GUIDELINE.md b/packages/osd-i18n/GUIDELINE.md index ae5b2b5ca298..80bf4f841015 100644 --- a/packages/osd-i18n/GUIDELINE.md +++ b/packages/osd-i18n/GUIDELINE.md @@ -391,7 +391,7 @@ Testing React component that uses the `injectI18n` higher-order component is mor With shallow rendering only top level component is rendered, that is a wrapper itself, not the original component. Since we want to test the rendering of the original component, we need to access it via the wrapper's `WrappedComponent` property. Its value will be the component we passed into `injectI18n()`. -When testing such component, use the `shallowWithIntl` helper function defined in `test_utils/enzyme_helpers` and pass the component's `WrappedComponent` property to render the wrapped component. This will shallow render the component with Enzyme and inject the necessary context and props to use the `intl` mock defined in `test_utils/mocks/intl`. +When testing such component, use the `shallowWithIntl` helper function defined in `@osd/test/jest` and pass the component's `WrappedComponent` property to render the wrapped component. This will shallow render the component with Enzyme and inject the necessary context and props to use the `intl` mock defined in `test_utils/mocks/intl`. Use the `mountWithIntl` helper function to mount render the component. diff --git a/packages/osd-i18n/package.json b/packages/osd-i18n/package.json index e3acaba58604..a8b9e1c99867 100644 --- a/packages/osd-i18n/package.json +++ b/packages/osd-i18n/package.json @@ -21,7 +21,7 @@ "del": "^5.1.0", "getopts": "^2.2.5", "supports-color": "^7.0.0", - "typescript": "4.0.2" + "typescript": "4.1.6" }, "dependencies": { "intl-format-cache": "^2.1.0", diff --git a/packages/osd-i18n/src/react/index.tsx b/packages/osd-i18n/src/react/index.tsx index e40208519637..eea740a9b012 100644 --- a/packages/osd-i18n/src/react/index.tsx +++ b/packages/osd-i18n/src/react/index.tsx @@ -31,9 +31,7 @@ */ import { InjectedIntl as _InjectedIntl, InjectedIntlProps as _InjectedIntlProps } from 'react-intl'; - -export type InjectedIntl = _InjectedIntl; -export type InjectedIntlProps = _InjectedIntlProps; +export type { InjectedIntl, InjectedIntlProps } from 'react-intl'; export { intlShape, diff --git a/packages/osd-logging/package.json b/packages/osd-logging/package.json index 1d8374ced5ee..8e381f6ca34e 100644 --- a/packages/osd-logging/package.json +++ b/packages/osd-logging/package.json @@ -13,6 +13,6 @@ "@osd/std": "1.0.0" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/packages/osd-monaco/package.json b/packages/osd-monaco/package.json index 8754663f891c..3442c69d31c7 100644 --- a/packages/osd-monaco/package.json +++ b/packages/osd-monaco/package.json @@ -20,7 +20,7 @@ "del": "^5.1.0", "raw-loader": "^4.0.2", "supports-color": "^7.0.0", - "typescript": "4.0.2", + "typescript": "4.1.6", "webpack": "^4.41.5", "webpack-cli": "^4.9.2" } diff --git a/packages/osd-opensearch-archiver/package.json b/packages/osd-opensearch-archiver/package.json index e1c28cc47484..576602eb4bb3 100644 --- a/packages/osd-opensearch-archiver/package.json +++ b/packages/osd-opensearch-archiver/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@osd/dev-utils": "1.0.0", + "@osd/test": "1.0.0", "elasticsearch": "^16.7.0" }, "devDependencies": { diff --git a/packages/osd-opensearch-archiver/src/cli.ts b/packages/osd-opensearch-archiver/src/cli.ts index a1cdcb92f6dd..303b9e63273a 100644 --- a/packages/osd-opensearch-archiver/src/cli.ts +++ b/packages/osd-opensearch-archiver/src/cli.ts @@ -241,7 +241,7 @@ export function runCli() { output: process.stdout, }); - await new Promise((resolveInput) => { + await new Promise((resolveInput) => { rl.question(`Press enter when you're done`, () => { rl.close(); resolveInput(); diff --git a/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts b/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts index 58abb84ec13c..f8612a73148f 100644 --- a/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts +++ b/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts @@ -82,7 +82,7 @@ describe('opensearchArchiver createParseArchiveStreams', () => { it('provides each JSON object as soon as it is parsed', async () => { let onReceived: (resolved: any) => void; - const receivedPromise = new Promise((resolve) => (onReceived = resolve)); + const receivedPromise = new Promise((resolve) => (onReceived = resolve)); const input = new PassThrough(); const check = new Transform({ writableObjectMode: true, diff --git a/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts b/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts index f42beba2472d..1af73a313974 100644 --- a/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts +++ b/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts @@ -122,7 +122,7 @@ export async function waitForSnapshotCompletion(client: Client, index: string, l while (await isSnapshotPending(repository, found.snapshot)) { // wait a bit before getting status again - await new Promise((resolve) => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 500)); } return; diff --git a/packages/osd-optimizer/src/common/event_stream_helpers.test.ts b/packages/osd-optimizer/src/common/event_stream_helpers.test.ts index 3f6e1b42423d..3ef524e41671 100644 --- a/packages/osd-optimizer/src/common/event_stream_helpers.test.ts +++ b/packages/osd-optimizer/src/common/event_stream_helpers.test.ts @@ -247,6 +247,6 @@ it('stops an infinite stream when unsubscribed', async () => { // ensure summarizer still only called 10 times after a timeout expect(summarize).toHaveBeenCalledTimes(10); - await new Promise((resolve) => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); expect(summarize).toHaveBeenCalledTimes(10); }); diff --git a/packages/osd-optimizer/src/node/cache.ts b/packages/osd-optimizer/src/node/cache.ts index 23f87ea4344d..270eab77068e 100644 --- a/packages/osd-optimizer/src/node/cache.ts +++ b/packages/osd-optimizer/src/node/cache.ts @@ -216,7 +216,9 @@ export class Cache { } } else { // delay a smidge to allow other things to happen before the next batch of checks - promises.add(new Promise((resolve) => setTimeout(resolve, 1))); + promises.add( + new Promise((resolve) => setTimeout(resolve, 1)) + ); } invalidKeys.length = 0; diff --git a/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts b/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts index 86d434f26a47..cfac6aac6c5c 100644 --- a/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts +++ b/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts @@ -19,7 +19,7 @@ import { BundleRefModule } from './bundle_ref_module'; const RESOLVE_EXTENSIONS = ['.js', '.ts', '.tsx']; function safeStat(path: string): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { Fs.stat(path, (error, stat) => { if (error?.code === 'ENOENT') { resolve(undefined); diff --git a/packages/osd-plugin-generator/template/.eslintrc.js.ejs b/packages/osd-plugin-generator/template/.eslintrc.js.ejs index 45a5c8e230a7..0ff5ed9b3528 100644 --- a/packages/osd-plugin-generator/template/.eslintrc.js.ejs +++ b/packages/osd-plugin-generator/template/.eslintrc.js.ejs @@ -1,7 +1,7 @@ module.exports = { root: true, extends: [ -'@elastic/eslint-config-kibana', +'@osd/eslint-config-opensearch-dashboards', 'plugin:@elastic/eui/recommended' ], rules: { diff --git a/packages/osd-plugin-helpers/package.json b/packages/osd-plugin-helpers/package.json index 447199730184..3853bcbb47e3 100644 --- a/packages/osd-plugin-helpers/package.json +++ b/packages/osd-plugin-helpers/package.json @@ -30,6 +30,6 @@ "@types/gulp-zip": "^4.0.1", "@types/inquirer": "^7.3.1", "extract-zip": "^2.0.1", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/packages/osd-pm/package.json b/packages/osd-pm/package.json index 3af720ce1691..4dd86de897d2 100644 --- a/packages/osd-pm/package.json +++ b/packages/osd-pm/package.json @@ -62,7 +62,7 @@ "strip-ansi": "^6.0.0", "strong-log-transformer": "^2.1.0", "tempy": "^0.3.0", - "typescript": "4.0.2", + "typescript": "4.1.6", "unlazy-loader": "^0.1.3", "webpack": "^4.41.5", "webpack-cli": "^4.9.2", diff --git a/packages/osd-pm/src/utils/parallelize.test.ts b/packages/osd-pm/src/utils/parallelize.test.ts index edc1336eda11..4cfdde50dfc7 100644 --- a/packages/osd-pm/src/utils/parallelize.test.ts +++ b/packages/osd-pm/src/utils/parallelize.test.ts @@ -35,7 +35,7 @@ import { parallelizeBatches } from './parallelize'; // As promises resolve async, we use this helper to wait for all promises that // have been resolved to complete (aka call `then`). const tick = () => - new Promise((resolve) => { + new Promise((resolve) => { setTimeout(resolve, 0); }); @@ -138,7 +138,7 @@ test('rejects if any promise rejects', async () => { function createPromiseWithResolve() { let resolve: (val?: any) => void; let reject: (err?: any) => void; - const promise = new Promise((res, rej) => { + const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); diff --git a/packages/osd-std/package.json b/packages/osd-std/package.json index 731eee02a448..f4c4b05140cc 100644 --- a/packages/osd-std/package.json +++ b/packages/osd-std/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@osd/utility-types": "1.0.0", - "typescript": "4.0.2", + "typescript": "4.1.6", "tsd": "^0.16.0" } } diff --git a/packages/osd-std/src/promise.test.ts b/packages/osd-std/src/promise.test.ts index 23b0ca49d795..190c88f852a8 100644 --- a/packages/osd-std/src/promise.test.ts +++ b/packages/osd-std/src/promise.test.ts @@ -33,7 +33,7 @@ import { withTimeout } from './promise'; const delay = (ms: number, resolveValue?: any) => - new Promise((resolve) => setTimeout(resolve, ms, resolveValue)); + new Promise((resolve) => setTimeout(resolve, ms, resolveValue)); describe('withTimeout', () => { it('resolves with a promise value if resolved in given timeout', async () => { @@ -57,7 +57,7 @@ describe('withTimeout', () => { await expect( withTimeout({ - promise: new Promise((i) => i), + promise: new Promise((i) => i), timeout: 10, errorMessage: 'error-message', }) diff --git a/packages/osd-std/src/promise.ts b/packages/osd-std/src/promise.ts index 5febb25a9b46..c693b4b84a11 100644 --- a/packages/osd-std/src/promise.ts +++ b/packages/osd-std/src/promise.ts @@ -41,6 +41,8 @@ export function withTimeout({ }) { return Promise.race([ promise, - new Promise((resolve, reject) => setTimeout(() => reject(new Error(errorMessage)), timeout)), + new Promise((resolve, reject) => + setTimeout(() => reject(new Error(errorMessage)), timeout) + ), ]) as Promise; } diff --git a/packages/osd-telemetry-tools/package.json b/packages/osd-telemetry-tools/package.json index b697f7012df3..13fd4d9640af 100644 --- a/packages/osd-telemetry-tools/package.json +++ b/packages/osd-telemetry-tools/package.json @@ -20,6 +20,6 @@ "normalize-path": "^3.0.0", "@types/lodash": "^4.14.170", "moment": "^2.24.0", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/packages/osd-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap b/packages/osd-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap index 4725be77533a..54018d260fe6 100644 --- a/packages/osd-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap +++ b/packages/osd-telemetry-tools/src/tools/__snapshots__/extract_collectors.test.ts.snap @@ -9,7 +9,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -31,7 +31,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -53,7 +53,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -75,7 +75,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -98,11 +98,11 @@ Array [ "typeDescriptor": Object { "@@INDEX@@": Object { "count_1": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, "count_2": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, }, @@ -127,7 +127,7 @@ Array [ "fetch": Object { "typeDescriptor": Object { "locale": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -149,12 +149,12 @@ Array [ "fetch": Object { "typeDescriptor": Object { "flat": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, "my_objects": Object { "total": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, "type": Object { @@ -163,7 +163,7 @@ Array [ }, }, "my_str": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, @@ -196,13 +196,13 @@ Array [ "fetch": Object { "typeDescriptor": Object { "flat": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, "my_array": Object { "items": Object { "total": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, "type": Object { @@ -213,13 +213,13 @@ Array [ }, "my_index_signature_prop": Object { "@@INDEX@@": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, }, "my_objects": Object { "total": Object { - "kind": 143, + "kind": 144, "type": "NumberKeyword", }, "type": Object { @@ -228,12 +228,12 @@ Array [ }, }, "my_str": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, "my_str_array": Object { "items": Object { - "kind": 146, + "kind": 147, "type": "StringKeyword", }, }, diff --git a/packages/osd-telemetry-tools/src/tools/check_collector__integrity.test.ts b/packages/osd-telemetry-tools/src/tools/check_collector__integrity.test.ts index 424cd2d3ed91..368e3eaa5b9c 100644 --- a/packages/osd-telemetry-tools/src/tools/check_collector__integrity.test.ts +++ b/packages/osd-telemetry-tools/src/tools/check_collector__integrity.test.ts @@ -102,7 +102,6 @@ describe('checkCompatibleTypeDescriptor', () => { ]); expect(incompatibles).toHaveLength(1); const { diff, message } = incompatibles[0]; - // eslint-disable-next-line @typescript-eslint/naming-convention expect(diff).toEqual({ '.@@INDEX@@.count_2.kind': 'number' }); expect(message).toHaveLength(1); expect(message).toEqual([ diff --git a/packages/osd-test/jest-preset.js b/packages/osd-test/jest-preset.js new file mode 100644 index 000000000000..c17650573c38 --- /dev/null +++ b/packages/osd-test/jest-preset.js @@ -0,0 +1,99 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +const { resolve } = require('path'); + +module.exports = { + // The directory where Jest should output its coverage files + coverageDirectory: '/target/opensearch-dashboards-coverage/jest', + + // An array of regexp pattern strings used to skip coverage collection + coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'], + + // A list of reporter names that Jest uses when writing coverage reports + coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'], + + // An array of file extensions your modules use + moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'], + + // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + moduleNameMapper: { + '@elastic/eui/lib/(.*)?': '/node_modules/@elastic/eui/test-env/$1', + '@elastic/eui$': '/node_modules/@elastic/eui/test-env', + '\\.module.(css|scss)$': '/packages/osd-test/target/jest/mocks/css_module_mock.js', + '\\.(css|less|scss)$': '/packages/osd-test/target/jest/mocks/style_mock.js', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': + '/packages/osd-test/target/jest/mocks/file_mock.js', + '\\.ace\\.worker.js$': '/packages/osd-test/target/jest/mocks/worker_module_mock.js', + '\\.editor\\.worker.js$': '/packages/osd-test/target/jest/mocks/worker_module_mock.js', + '^(!!)?file-loader!': '/packages/osd-test/target/jest/mocks/file_mock.js', + '^fixtures/(.*)': '/src/fixtures/$1', + '^src/core/(.*)': '/src/core/$1', + '^src/legacy/(.*)': '/src/legacy/$1', + '^src/plugins/(.*)': '/src/plugins/$1', + }, + + // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + modulePathIgnorePatterns: [ + '__fixtures__/', + 'target/', + '/src/plugins/maps_legacy', + '/src/plugins/region_map', + ], + + // Use this configuration option to add custom reporters to Jest + reporters: ['default', resolve(__dirname, './target/jest/junit_reporter.js')], + + // The paths to modules that run some code to configure or set up the testing environment before each test + setupFiles: [ + '/packages/osd-test/target/jest/setup/babel_polyfill.js', + '/packages/osd-test/target/jest/setup/polyfills.js', + '/packages/osd-test/target/jest/setup/enzyme.js', + ], + + // A list of paths to modules that run some code to configure or set up the testing framework before each test + setupFilesAfterEnv: [ + '/packages/osd-test/target/jest/setup/setup_test.js', + '/packages/osd-test/target/jest/setup/mocks.js', + '/packages/osd-test/target/jest/setup/react_testing_library.js', + ], + + // A list of paths to snapshot serializer modules Jest should use for snapshot testing + snapshotSerializers: [ + '/src/plugins/opensearch_dashboards_react/public/util/test_helpers/react_mount_serializer.ts', + '/node_modules/enzyme-to-json/serializer', + ], + + // The test environment that will be used for testing + testEnvironment: 'jest-environment-jsdom', + + // The glob patterns Jest uses to detect test files + testMatch: ['**/*.test.{js,mjs,ts,tsx}'], + + // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + testPathIgnorePatterns: [ + '/packages/osd-ui-framework/(dist|doc_site|generator-kui)/', + '/packages/osd-pm/dist/', + `integration_tests/`, + ], + + // This option allows use of a custom test runner + testRunner: 'jest-circus/runner', + + // A map from regular expressions to paths to transformers + transform: { + '^.+\\.(js|tsx?)$': '/packages/osd-test/target/jest/babel_transform.js', + '^.+\\.txt?$': 'jest-raw-loader', + '^.+\\.html?$': 'jest-raw-loader', + }, + + // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + transformIgnorePatterns: [ + // ignore all node_modules except monaco-editor which requires babel transforms to handle dynamic import() + // since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842) + '[/\\\\]node_modules(?![\\/\\\\](monaco-editor|weak-lru-cache|ordered-binary))[/\\\\].+\\.js$', + 'packages/osd-pm/dist/index.js', + ], +}; diff --git a/packages/osd-test/jest/package.json b/packages/osd-test/jest/package.json new file mode 100644 index 000000000000..c1c4ec87243f --- /dev/null +++ b/packages/osd-test/jest/package.json @@ -0,0 +1,4 @@ +{ + "main": "../target/jest", + "types": "../target/types/jest/index.d.ts" +} diff --git a/packages/osd-test/package.json b/packages/osd-test/package.json index 4016e4dcc05c..da8c3da4e57f 100644 --- a/packages/osd-test/package.json +++ b/packages/osd-test/package.json @@ -5,17 +5,20 @@ "license": "Apache-2.0", "main": "./target/index.js", "scripts": { - "build": "babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/** --source-maps=inline", - "osd:bootstrap": "yarn build", - "osd:watch": "yarn build --watch" + "build": "node scripts/build", + "osd:bootstrap": "node scripts/build --source-maps", + "osd:watch": "node scripts/build --watch --source-maps" }, "opensearchDashboards": { "devOnly": true }, "devDependencies": { "@babel/cli": "^7.16.0", + "@jest/reporters": "^27.5.1", + "@jest/types": "^27.5.1", "@osd/babel-preset": "1.0.0", "@osd/dev-utils": "1.0.0", + "@osd/i18n": "1.0.0", "@osd/utils": "1.0.0", "@types/joi": "^13.4.2", "@types/lodash": "^4.14.170", @@ -28,11 +31,14 @@ "chalk": "^4.1.0", "dedent": "^0.7.0", "del": "^5.1.0", + "execa": "^4.0.2", "exit-hook": "^2.2.0", "getopts": "^2.2.5", "glob": "^7.1.7", + "globby": "^8.0.1", "joi": "^13.5.2", "lodash": "^4.17.21", + "mustache": "^2.3.2", "parse-link-header": "^2.0.0", "rxjs": "^6.5.5", "strip-ansi": "^6.0.0", diff --git a/packages/osd-test/scripts/build.js b/packages/osd-test/scripts/build.js new file mode 100644 index 000000000000..504d5fe3c234 --- /dev/null +++ b/packages/osd-test/scripts/build.js @@ -0,0 +1,77 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +const { resolve } = require('path'); + +const del = require('del'); +const supportsColor = require('supports-color'); +const { run, withProcRunner } = require('@osd/dev-utils'); + +const ROOT_DIR = resolve(__dirname, '..'); +const BUILD_DIR = resolve(ROOT_DIR, 'target'); + +const padRight = (width, str) => + str.length >= width ? str : `${str}${' '.repeat(width - str.length)}`; + +run( + async ({ log, flags }) => { + await withProcRunner(log, async (proc) => { + log.info('Deleting old output'); + await del(BUILD_DIR); + + const cwd = ROOT_DIR; + const env = { ...process.env }; + if (supportsColor.stdout) { + env.FORCE_COLOR = 'true'; + } + + log.info(`Starting babel and typescript${flags.watch ? ' in watch mode' : ''}`); + await Promise.all([ + proc.run(padRight(10, `babel`), { + cmd: 'babel', + args: [ + 'src', + '--config-file', + require.resolve('../babel.config.js'), + '--out-dir', + BUILD_DIR, + '--extensions', + '.ts,.js,.tsx', + ...(flags.watch ? ['--watch'] : ['--quiet']), + ...(!flags['source-maps'] || !!process.env.CODE_COVERAGE + ? [] + : ['--source-maps', 'inline']), + ], + wait: true, + env, + cwd, + }), + + proc.run(padRight(10, 'tsc'), { + cmd: 'tsc', + args: [ + ...(flags.watch ? ['--watch', '--preserveWatchOutput', 'true'] : []), + ...(flags['source-maps'] ? ['--declarationMap', 'true'] : []), + ], + wait: true, + env, + cwd, + }), + ]); + + log.success('Complete'); + }); + }, + { + description: 'Simple build tool for @osd/i18n package', + flags: { + boolean: ['watch', 'source-maps'], + help: ` + --watch Run in watch mode + --source-maps Include sourcemaps + `, + }, + } +); diff --git a/packages/osd-test/src/failed_tests_reporter/github_api.ts b/packages/osd-test/src/failed_tests_reporter/github_api.ts index 8613656ba2ba..6b538874745c 100644 --- a/packages/osd-test/src/failed_tests_reporter/github_api.ts +++ b/packages/osd-test/src/failed_tests_reporter/github_api.ts @@ -246,7 +246,7 @@ export class GithubApi { this.log.error(`Unable to reach github, waiting ${waitMs}ms to retry`); } - await new Promise((resolve) => setTimeout(resolve, waitMs)); + await new Promise((resolve) => setTimeout(resolve, waitMs)); return await this.request( { ...options, diff --git a/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js index d46a73ec1435..d2ad906dfa34 100644 --- a/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/reporter/reporter.js @@ -36,12 +36,11 @@ import Mocha from 'mocha'; import { ToolingLogTextWriter } from '@osd/dev-utils'; import moment from 'moment'; -import { setupJUnitReportGeneration } from '../../../../../../../src/dev'; import * as colors from './colors'; import * as symbols from './symbols'; import { ms } from './ms'; import { writeEpilogue } from './write_epilogue'; -import { recordLog, snapshotLogsForRunnable } from '../../../../../../../src/dev/mocha/log_cache'; +import { recordLog, snapshotLogsForRunnable, setupJUnitReportGeneration } from '../../../../mocha'; export function MochaReporterProvider({ getService }) { const log = getService('log'); diff --git a/packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts b/packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts index 2da42c81bc85..ec6e5d859473 100644 --- a/packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts +++ b/packages/osd-test/src/functional_test_runner/lib/mocha/run_tests.ts @@ -52,7 +52,7 @@ export async function runTests(lifecycle: Lifecycle, mocha: Mocha) { if (!runComplete) runner.abort(); }); - return new Promise((resolve) => { + return new Promise((resolve) => { const respond = () => resolve(runner.failures); // if there are no tests, mocha.run() is sync diff --git a/packages/osd-test/src/index.ts b/packages/osd-test/src/index.ts index b50c3b9f6f27..0233c8068eee 100644 --- a/packages/osd-test/src/index.ts +++ b/packages/osd-test/src/index.ts @@ -61,9 +61,14 @@ export { readConfigFile } from './functional_test_runner/lib/config/read_config_ export { runFtrCli } from './functional_test_runner/cli'; -export { runFailedTestsReporterCli } from './failed_tests_reporter'; +export { + createAutoJUnitReporter, + runMochaCli, + setupJUnitReportGeneration, + escapeCdata, +} from './mocha'; -export { getUniqueJunitReportPath } from './junit_report_path'; +export { runFailedTestsReporterCli } from './failed_tests_reporter'; export { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; diff --git a/src/dev/jest/babel_transform.js b/packages/osd-test/src/jest/babel_transform.js similarity index 100% rename from src/dev/jest/babel_transform.js rename to packages/osd-test/src/jest/babel_transform.js diff --git a/packages/osd-test/src/jest/index.ts b/packages/osd-test/src/jest/index.ts new file mode 100644 index 000000000000..079132ce99d2 --- /dev/null +++ b/packages/osd-test/src/jest/index.ts @@ -0,0 +1,6 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './utils'; diff --git a/packages/osd-test/src/jest/integration_tests/__fixtures__/jest.config.js b/packages/osd-test/src/jest/integration_tests/__fixtures__/jest.config.js new file mode 100644 index 000000000000..ac4abfb49c0c --- /dev/null +++ b/packages/osd-test/src/jest/integration_tests/__fixtures__/jest.config.js @@ -0,0 +1,23 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +const { resolve } = require('path'); +const { REPO_ROOT } = require('@osd/utils'); + +module.exports = { + reporters: [ + 'default', + [ + `${REPO_ROOT}/packages/osd-test/target/jest/junit_reporter`, + { + reportName: 'JUnit Reporter Integration Test', + rootDirectory: resolve( + REPO_ROOT, + 'packages/osd-test/src/jest/integration_tests/__fixtures__' + ), + }, + ], + ], +}; diff --git a/src/dev/jest/integration_tests/__fixtures__/test.js b/packages/osd-test/src/jest/integration_tests/__fixtures__/test.js similarity index 100% rename from src/dev/jest/integration_tests/__fixtures__/test.js rename to packages/osd-test/src/jest/integration_tests/__fixtures__/test.js diff --git a/src/dev/jest/junit_reporter.js b/packages/osd-test/src/jest/junit_reporter.ts similarity index 75% rename from src/dev/jest/junit_reporter.js rename to packages/osd-test/src/jest/junit_reporter.ts index 082d9bc9a1b0..d62760f7968c 100644 --- a/src/dev/jest/junit_reporter.js +++ b/packages/osd-test/src/jest/junit_reporter.ts @@ -35,21 +35,32 @@ import { writeFileSync, mkdirSync } from 'fs'; import xmlBuilder from 'xmlbuilder'; -import { escapeCdata } from '../xml'; -import { getUniqueJunitReportPath } from '@osd/test'; +import { REPO_ROOT } from '@osd/utils'; +import type { Config } from '@jest/types'; +import { AggregatedResult, Test, BaseReporter } from '@jest/reporters'; -const ROOT_DIR = dirname(require.resolve('../../../package.json')); +import { escapeCdata } from '../mocha/xml'; +import { getUniqueJunitReportPath } from '../report_path'; + +interface ReporterOptions { + reportName?: string; + rootDirectory?: string; +} /** * Jest reporter that produces JUnit report when running on CI * @class JestJUnitReporter */ -export default class JestJUnitReporter { - constructor(globalConfig, options = {}) { - const { reportName = 'Jest Tests', rootDirectory = ROOT_DIR } = options; - this._reportName = reportName; - this._rootDirectory = resolve(rootDirectory); +// eslint-disable-next-line import/no-default-export +export default class JestJUnitReporter extends BaseReporter { + private _reportName: string; + private _rootDirectory: string; + + constructor(globalConfig: Config.GlobalConfig, { rootDirectory, reportName }: ReporterOptions) { + super(); + this._reportName = reportName || 'Jest Tests'; + this._rootDirectory = rootDirectory ? resolve(rootDirectory) : REPO_ROOT; } /** @@ -58,7 +69,7 @@ export default class JestJUnitReporter { * @param {JestResults} results see https://facebook.github.io/jest/docs/en/configuration.html#testresultsprocessor-string * @return {undefined} */ - onRunComplete(contexts, results) { + onRunComplete(contexts: Set, results: AggregatedResult): void { if (!process.env.CI || process.env.DISABLE_JUNIT_REPORTER || !results.testResults.length) { return; } @@ -69,18 +80,19 @@ export default class JestJUnitReporter { 'testsuites', { encoding: 'utf-8' }, {}, - { skipNullAttributes: true } + { keepNullAttributes: false } ); - const msToIso = (ms) => (ms ? new Date(ms).toISOString().slice(0, -5) : undefined); - const msToSec = (ms) => (ms ? (ms / 1000).toFixed(3) : undefined); + const msToIso = (ms: number | null | undefined) => + ms ? new Date(ms).toISOString().slice(0, -5) : undefined; + const msToSec = (ms: number | null | undefined) => (ms ? (ms / 1000).toFixed(3) : undefined); root.att({ name: 'jest', timestamp: msToIso(results.startTime), time: msToSec(Date.now() - results.startTime), tests: results.numTotalTests, - failures: results.numFailingTests, + failures: results.numFailedTests, skipped: results.numPendingTests, }); diff --git a/src/dev/jest/mocks/css_module_mock.js b/packages/osd-test/src/jest/mocks/css_module_mock.js similarity index 100% rename from src/dev/jest/mocks/css_module_mock.js rename to packages/osd-test/src/jest/mocks/css_module_mock.js diff --git a/src/dev/jest/mocks/file_mock.js b/packages/osd-test/src/jest/mocks/file_mock.js similarity index 100% rename from src/dev/jest/mocks/file_mock.js rename to packages/osd-test/src/jest/mocks/file_mock.js diff --git a/src/dev/jest/mocks/style_mock.js b/packages/osd-test/src/jest/mocks/style_mock.js similarity index 100% rename from src/dev/jest/mocks/style_mock.js rename to packages/osd-test/src/jest/mocks/style_mock.js diff --git a/src/dev/jest/mocks/worker_module_mock.js b/packages/osd-test/src/jest/mocks/worker_module_mock.js similarity index 100% rename from src/dev/jest/mocks/worker_module_mock.js rename to packages/osd-test/src/jest/mocks/worker_module_mock.js diff --git a/src/dev/jest/setup/after_env.integration.js b/packages/osd-test/src/jest/setup/after_env.integration.js similarity index 100% rename from src/dev/jest/setup/after_env.integration.js rename to packages/osd-test/src/jest/setup/after_env.integration.js diff --git a/src/dev/jest/setup/babel_polyfill.js b/packages/osd-test/src/jest/setup/babel_polyfill.js similarity index 100% rename from src/dev/jest/setup/babel_polyfill.js rename to packages/osd-test/src/jest/setup/babel_polyfill.js diff --git a/src/dev/jest/setup/enzyme.js b/packages/osd-test/src/jest/setup/enzyme.js similarity index 100% rename from src/dev/jest/setup/enzyme.js rename to packages/osd-test/src/jest/setup/enzyme.js diff --git a/src/dev/jest/setup/mocks.js b/packages/osd-test/src/jest/setup/mocks.js similarity index 100% rename from src/dev/jest/setup/mocks.js rename to packages/osd-test/src/jest/setup/mocks.js diff --git a/src/dev/jest/setup/polyfills.js b/packages/osd-test/src/jest/setup/polyfills.js similarity index 100% rename from src/dev/jest/setup/polyfills.js rename to packages/osd-test/src/jest/setup/polyfills.js diff --git a/src/test_utils/public/helpers/index.ts b/packages/osd-test/src/jest/setup/react_mount_serializer.ts similarity index 74% rename from src/test_utils/public/helpers/index.ts rename to packages/osd-test/src/jest/setup/react_mount_serializer.ts index b86a472d175d..4b2df4ec1e23 100644 --- a/src/test_utils/public/helpers/index.ts +++ b/packages/osd-test/src/jest/setup/react_mount_serializer.ts @@ -30,17 +30,14 @@ * GitHub history for details. */ -export { findTestSubject } from './find_test_subject'; +export function test(value: any) { + return value && value.__reactMount__; +} -export { WithStore } from './redux_helpers'; - -export { WithMemoryRouter, WithRoute, reactRouterMock } from './router_helpers'; - -export * from './utils'; - -export { - setSVGElementGetBBox, - setHTMLElementOffset, - setHTMLElementClientSizes, - setSVGElementGetComputedTextLength, -} from './jsdom_svg_mocks'; +export function print(value: any, serialize: any) { + // there is no proper way to correctly indent multiline values + // so the trick here is to use the Object representation and rewriting the root object name + return serialize({ + reactNode: value.__reactMount__, + }).replace('Object', 'MountPoint'); +} diff --git a/src/dev/jest/setup/react_testing_library.js b/packages/osd-test/src/jest/setup/react_testing_library.js similarity index 100% rename from src/dev/jest/setup/react_testing_library.js rename to packages/osd-test/src/jest/setup/react_testing_library.js diff --git a/packages/osd-test/src/jest/setup/setup_test.js b/packages/osd-test/src/jest/setup/setup_test.js new file mode 100644 index 000000000000..94f9888b77fd --- /dev/null +++ b/packages/osd-test/src/jest/setup/setup_test.js @@ -0,0 +1,6 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import '@testing-library/jest-dom'; diff --git a/src/test_utils/public/enzyme_helpers.tsx b/packages/osd-test/src/jest/utils/enzyme_helpers.tsx similarity index 100% rename from src/test_utils/public/enzyme_helpers.tsx rename to packages/osd-test/src/jest/utils/enzyme_helpers.tsx diff --git a/src/test_utils/public/helpers/find_test_subject.ts b/packages/osd-test/src/jest/utils/find_test_subject.ts similarity index 100% rename from src/test_utils/public/helpers/find_test_subject.ts rename to packages/osd-test/src/jest/utils/find_test_subject.ts diff --git a/packages/osd-test/src/jest/utils/get_url.test.ts b/packages/osd-test/src/jest/utils/get_url.test.ts new file mode 100644 index 000000000000..6041714f761e --- /dev/null +++ b/packages/osd-test/src/jest/utils/get_url.test.ts @@ -0,0 +1,52 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { getUrl } from './get_url'; + +describe('getUrl', function () { + it('should convert to a url', function () { + const url = getUrl( + { + protocol: 'http', + hostname: 'localhost', + }, + { + pathname: 'foo', + } + ); + + expect(url).toBe('http://localhost/foo'); + }); + + it('should convert to a url with port', function () { + const url = getUrl( + { + protocol: 'http', + hostname: 'localhost', + port: 9220, + }, + { + pathname: 'foo', + } + ); + + expect(url).toBe('http://localhost:9220/foo'); + }); + + it('should convert to a secure hashed url', function () { + expect( + getUrl( + { + protocol: 'https', + hostname: 'localhost', + }, + { + pathname: 'foo', + hash: 'bar', + } + ) + ).toBe('https://localhost/foo#bar'); + }); +}); diff --git a/packages/osd-test/src/jest/utils/get_url.ts b/packages/osd-test/src/jest/utils/get_url.ts new file mode 100644 index 000000000000..3d4019984edb --- /dev/null +++ b/packages/osd-test/src/jest/utils/get_url.ts @@ -0,0 +1,61 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import _ from 'lodash'; +import url from 'url'; + +interface UrlParam { + hash?: string; + host?: string; + hostname?: string; + href?: string; + password?: string; + pathname?: string; + port?: number; + protocol?: string; + search?: string; + username?: string; +} + +interface App { + pathname?: string; + hash?: string; +} + +/** + * Converts a config and a pathname to a url + * @param {object} config A url config + * example: + * { + * protocol: 'http', + * hostname: 'localhost', + * port: 9220, + * auth: opensearchDashboardsTestUser.username + ':' + opensearchDashboardsTestUser.password + * } + * @param {object} app The params to append + * example: + * { + * pathname: 'app/opensearch-dashboards', + * hash: '/discover' + * } + * @return {string} + */ + +function getUrl(config: UrlParam, app: App) { + return url.format(_.assign({}, config, app)); +} + +getUrl.noAuth = function getUrlNoAuth(config: UrlParam, app: App) { + config = _.pickBy(config, function (val, param) { + return param !== 'auth'; + }); + return getUrl(config, app); +}; + +getUrl.baseUrl = function getBaseUrl(config: UrlParam) { + return url.format(_.pick(config, 'protocol', 'hostname', 'port')); +}; + +export { getUrl }; diff --git a/packages/osd-test/src/jest/utils/index.ts b/packages/osd-test/src/jest/utils/index.ts new file mode 100644 index 000000000000..c7f7399b3462 --- /dev/null +++ b/packages/osd-test/src/jest/utils/index.ts @@ -0,0 +1,26 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './enzyme_helpers'; + +export * from './find_test_subject'; + +export * from './jsdom_svg_mocks'; + +export * from './random'; + +export * from './redux_helpers'; + +export * from './router_helpers'; + +export * from './stub_browser_storage'; + +export * from './stub_web_worker'; + +export * from './testbed'; + +export const nextTick = () => new Promise((res) => process.nextTick(res)); + +export const delay = (time = 0) => new Promise((resolve) => setTimeout(resolve, time)); diff --git a/src/test_utils/public/helpers/jsdom_svg_mocks.ts b/packages/osd-test/src/jest/utils/jsdom_svg_mocks.ts similarity index 100% rename from src/test_utils/public/helpers/jsdom_svg_mocks.ts rename to packages/osd-test/src/jest/utils/jsdom_svg_mocks.ts diff --git a/src/test_utils/public/helpers/utils.ts b/packages/osd-test/src/jest/utils/random.ts similarity index 94% rename from src/test_utils/public/helpers/utils.ts rename to packages/osd-test/src/jest/utils/random.ts index 7a0aebeb5378..2eecd3deaa2b 100644 --- a/src/test_utils/public/helpers/utils.ts +++ b/packages/osd-test/src/jest/utils/random.ts @@ -35,8 +35,6 @@ import Chance from 'chance'; const chance = new Chance(); const CHARS_POOL = 'abcdefghijklmnopqrstuvwxyz'; -export const nextTick = (time = 0) => new Promise((resolve) => setTimeout(resolve, time)); - export const getRandomNumber = (range: { min: number; max: number } = { min: 1, max: 20 }) => chance.integer(range); diff --git a/src/test_utils/public/helpers/redux_helpers.tsx b/packages/osd-test/src/jest/utils/redux_helpers.tsx similarity index 100% rename from src/test_utils/public/helpers/redux_helpers.tsx rename to packages/osd-test/src/jest/utils/redux_helpers.tsx diff --git a/src/test_utils/public/helpers/router_helpers.tsx b/packages/osd-test/src/jest/utils/router_helpers.tsx similarity index 94% rename from src/test_utils/public/helpers/router_helpers.tsx rename to packages/osd-test/src/jest/utils/router_helpers.tsx index ef370067a377..fbaafbad6015 100644 --- a/src/test_utils/public/helpers/router_helpers.tsx +++ b/packages/osd-test/src/jest/utils/router_helpers.tsx @@ -42,9 +42,10 @@ export const WithMemoryRouter = (initialEntries: string[] = ['/'], initialIndex: ); -export const WithRoute = (componentRoutePath = '/', onRouter = (router: any) => {}) => ( - WrappedComponent: ComponentType -) => { +export const WithRoute = ( + componentRoutePath: string | string[] = '/', + onRouter = (router: any) => {} +) => (WrappedComponent: ComponentType) => { // Create a class component that will catch the router // and forward it to our "onRouter()" handler. const CatchRouter = withRouter( diff --git a/src/test_utils/public/stub_browser_storage.test.ts b/packages/osd-test/src/jest/utils/stub_browser_storage.test.ts similarity index 100% rename from src/test_utils/public/stub_browser_storage.test.ts rename to packages/osd-test/src/jest/utils/stub_browser_storage.test.ts diff --git a/src/test_utils/public/stub_browser_storage.ts b/packages/osd-test/src/jest/utils/stub_browser_storage.ts similarity index 100% rename from src/test_utils/public/stub_browser_storage.ts rename to packages/osd-test/src/jest/utils/stub_browser_storage.ts diff --git a/packages/osd-test/src/jest/utils/stub_web_worker.ts b/packages/osd-test/src/jest/utils/stub_web_worker.ts new file mode 100644 index 000000000000..55decd23309d --- /dev/null +++ b/packages/osd-test/src/jest/utils/stub_web_worker.ts @@ -0,0 +1,22 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +function stubWebWorker() { + if (!window.Worker) { + // @ts-ignore we aren't honoring the real Worker spec here + window.Worker = function Worker() { + this.postMessage = jest.fn(); + + // @ts-ignore TypeScript doesn't think this exists on the Worker interface + // https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate + this.terminate = jest.fn(); + }; + } +} + +stubWebWorker(); + +// Add an export to avoid TS complaining "stub_web_worker.ts" is not a module. +export { stubWebWorker }; diff --git a/src/test_utils/public/testbed/index.ts b/packages/osd-test/src/jest/utils/testbed/index.ts similarity index 100% rename from src/test_utils/public/testbed/index.ts rename to packages/osd-test/src/jest/utils/testbed/index.ts diff --git a/src/test_utils/public/testbed/mount_component.tsx b/packages/osd-test/src/jest/utils/testbed/mount_component.tsx similarity index 96% rename from src/test_utils/public/testbed/mount_component.tsx rename to packages/osd-test/src/jest/utils/testbed/mount_component.tsx index 6d64e7f44446..7bd293728c29 100644 --- a/src/test_utils/public/testbed/mount_component.tsx +++ b/packages/osd-test/src/jest/utils/testbed/mount_component.tsx @@ -36,7 +36,8 @@ import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { mountWithIntl } from '../enzyme_helpers'; -import { WithMemoryRouter, WithRoute, WithStore } from '../helpers'; +import { WithMemoryRouter, WithRoute } from '../router_helpers'; +import { WithStore } from '../redux_helpers'; import { MemoryRouterConfig } from './types'; interface Config { diff --git a/src/test_utils/public/testbed/testbed.ts b/packages/osd-test/src/jest/utils/testbed/testbed.ts similarity index 81% rename from src/test_utils/public/testbed/testbed.ts rename to packages/osd-test/src/jest/utils/testbed/testbed.ts index 77b4cca1a70b..a851f6473fdb 100644 --- a/src/test_utils/public/testbed/testbed.ts +++ b/packages/osd-test/src/jest/utils/testbed/testbed.ts @@ -1,38 +1,12 @@ /* + * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. */ import { ComponentType, ReactWrapper } from 'enzyme'; -import { findTestSubject, reactRouterMock } from '../helpers'; +import { findTestSubject } from '../find_test_subject'; +import { reactRouterMock } from '../router_helpers'; import { mountComponentSync, mountComponentAsync, @@ -56,12 +30,10 @@ const defaultConfig: TestBedConfig = { * * @example ```typescript - import { registerTestBed } from '../../../../test_utils'; + import { registerTestBed } from '@osd/test/jest'; import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; import { remoteClustersStore } from '../../app/store'; - const setup = registerTestBed(RemoteClusterList, { store: remoteClustersStore }); - describe(', () > { test('it should have a table', () => { const { exists } = setup(); @@ -164,33 +136,23 @@ export const registerTestBed = ( }); }; - const waitFor: TestBed['waitFor'] = async (testSubject: T, count = 1) => { + const waitForFn: TestBed['waitForFn'] = async (predicate, errMessage) => { const triggeredAt = Date.now(); - /** - * The way jest run tests in parallel + the not deterministic DOM update from React "hooks" - * add flakiness to the tests. This is especially true for component integration tests that - * make many update to the DOM. - * - * For this reason, when we _know_ that an element should be there after we updated some state, - * we will give it 30 seconds to appear in the DOM, checking every 100 ms for its presence. - */ const MAX_WAIT_TIME = 30000; - const WAIT_INTERVAL = 100; + const WAIT_INTERVAL = 50; const process = async (): Promise => { - const elemFound = exists(testSubject, count); + const isOK = await predicate(); - if (elemFound) { + if (isOK) { // Great! nothing else to do here. return; } const timeElapsed = Date.now() - triggeredAt; if (timeElapsed > MAX_WAIT_TIME) { - throw new Error( - `I waited patiently for the "${testSubject}" test subject to appear with no luck. It is nowhere to be found!` - ); + throw new Error(errMessage); } return new Promise((resolve) => setTimeout(resolve, WAIT_INTERVAL)).then(() => { @@ -202,6 +164,13 @@ export const registerTestBed = ( return process(); }; + const waitFor: TestBed['waitFor'] = (testSubject: T, count = 1) => { + return waitForFn( + () => Promise.resolve(exists(testSubject, count)), + `I waited patiently for the "${testSubject}" test subject to appear with no luck. It is nowhere to be found!` + ); + }; + /** * ---------------------------------------------------------------- * Forms @@ -272,8 +241,7 @@ export const registerTestBed = ( const formInput = findTestSubject(comboBox, 'comboBoxSearchInput'); setInputValue(formInput, value); - // keyCode 13 === ENTER - comboBox.simulate('keydown', { keyCode: 13 }); + comboBox.simulate('keydown', { key: 'Enter' }); component.update(); }; @@ -337,6 +305,7 @@ export const registerTestBed = ( find, setProps, waitFor, + waitForFn, table: { getMetaData, }, diff --git a/src/test_utils/public/testbed/types.ts b/packages/osd-test/src/jest/utils/testbed/types.ts similarity index 98% rename from src/test_utils/public/testbed/types.ts rename to packages/osd-test/src/jest/utils/testbed/types.ts index ffa3bf6662da..65749fbfacdb 100644 --- a/src/test_utils/public/testbed/types.ts +++ b/packages/osd-test/src/jest/utils/testbed/types.ts @@ -87,6 +87,7 @@ export interface TestBed { * and we need to wait for the data to be fetched (and bypass any "loading" state). */ waitFor: (testSubject: T, count?: number) => Promise; + waitForFn: (predicate: () => Promise, errMessage: string) => Promise; form: { /** * Set the value of a form text input. @@ -188,7 +189,7 @@ export interface MemoryRouterConfig { /** The React Router **initial index** setting ([see documentation](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/MemoryRouter.md)) */ initialIndex?: number; /** The route **path** for the mounted component (defaults to `"/"`) */ - componentRoutePath?: string; + componentRoutePath?: string | string[]; /** A callBack that will be called with the React Router instance once mounted */ onRouter?: (router: any) => void; } diff --git a/src/dev/mocha/__tests__/fixtures/project/test.js b/packages/osd-test/src/mocha/__tests__/fixtures/project/test.js similarity index 100% rename from src/dev/mocha/__tests__/fixtures/project/test.js rename to packages/osd-test/src/mocha/__tests__/fixtures/project/test.js diff --git a/src/dev/mocha/__tests__/junit_report_generation.js b/packages/osd-test/src/mocha/__tests__/junit_report_generation.js similarity index 98% rename from src/dev/mocha/__tests__/junit_report_generation.js rename to packages/osd-test/src/mocha/__tests__/junit_report_generation.js index 9ed4ab207389..d62dde4e5ab2 100644 --- a/src/dev/mocha/__tests__/junit_report_generation.js +++ b/packages/osd-test/src/mocha/__tests__/junit_report_generation.js @@ -38,7 +38,7 @@ import { parseString } from 'xml2js'; import del from 'del'; import Mocha from 'mocha'; import expect from '@osd/expect'; -import { getUniqueJunitReportPath } from '@osd/test'; +import { getUniqueJunitReportPath } from '../../report_path'; import { setupJUnitReportGeneration } from '../junit_report_generation'; diff --git a/src/dev/mocha/auto_junit_reporter.js b/packages/osd-test/src/mocha/auto_junit_reporter.js similarity index 100% rename from src/dev/mocha/auto_junit_reporter.js rename to packages/osd-test/src/mocha/auto_junit_reporter.js diff --git a/src/dev/mocha/index.js b/packages/osd-test/src/mocha/index.ts similarity index 91% rename from src/dev/mocha/index.js rename to packages/osd-test/src/mocha/index.ts index e83661e5c1f1..7a2d4ebcc514 100644 --- a/src/dev/mocha/index.js +++ b/packages/osd-test/src/mocha/index.ts @@ -36,3 +36,6 @@ export { createAutoJUnitReporter } from './auto_junit_reporter'; export { setupJUnitReportGeneration } from './junit_report_generation'; // @ts-ignore not typed yet export { runMochaCli } from './run_mocha_cli'; +// @ts-ignore not typed yet +export { recordLog, snapshotLogsForRunnable } from './log_cache'; +export { escapeCdata } from './xml'; diff --git a/src/dev/mocha/junit_report_generation.js b/packages/osd-test/src/mocha/junit_report_generation.js similarity index 96% rename from src/dev/mocha/junit_report_generation.js rename to packages/osd-test/src/mocha/junit_report_generation.js index 1e675e09dbc8..15897c6cbefe 100644 --- a/src/dev/mocha/junit_report_generation.js +++ b/packages/osd-test/src/mocha/junit_report_generation.js @@ -35,17 +35,17 @@ import { writeFileSync, mkdirSync } from 'fs'; import { inspect } from 'util'; import xmlBuilder from 'xmlbuilder'; -import { getUniqueJunitReportPath } from '@osd/test'; +import { getUniqueJunitReportPath } from '../report_path'; import { getSnapshotOfRunnableLogs } from './log_cache'; -import { escapeCdata } from '../xml'; +import { escapeCdata } from './xml'; const dateNow = Date.now.bind(Date); export function setupJUnitReportGeneration(runner, options = {}) { const { reportName = 'Unnamed Mocha Tests', - rootDirectory = dirname(require.resolve('../../../package.json')), + rootDirectory = dirname(require.resolve('../../../../package.json')), getTestMetadata = () => ({}), } = options; diff --git a/src/dev/mocha/log_cache.js b/packages/osd-test/src/mocha/log_cache.js similarity index 100% rename from src/dev/mocha/log_cache.js rename to packages/osd-test/src/mocha/log_cache.js diff --git a/src/dev/mocha/run_mocha_cli.js b/packages/osd-test/src/mocha/run_mocha_cli.js similarity index 97% rename from src/dev/mocha/run_mocha_cli.js rename to packages/osd-test/src/mocha/run_mocha_cli.js index 2e64d9d1ae02..86c59f2af4cb 100644 --- a/src/dev/mocha/run_mocha_cli.js +++ b/packages/osd-test/src/mocha/run_mocha_cli.js @@ -54,7 +54,7 @@ export function runMochaCli() { process.argv.push('--globals', '__core-js_shared__,core,_, '); // ensure that mocha requires the setup_node_env script - process.argv.push('--require', require.resolve('../../setup_node_env')); + process.argv.push('--require', require.resolve('../../../../src/setup_node_env')); // set default test timeout if (opts.timeout == null && !opts['no-timeouts']) { diff --git a/src/dev/mocha/server_junit_reporter.js b/packages/osd-test/src/mocha/server_junit_reporter.js similarity index 96% rename from src/dev/mocha/server_junit_reporter.js rename to packages/osd-test/src/mocha/server_junit_reporter.js index b1b330f73075..bf266d1a5476 100644 --- a/src/dev/mocha/server_junit_reporter.js +++ b/packages/osd-test/src/mocha/server_junit_reporter.js @@ -31,7 +31,7 @@ */ // when the reporter is loaded by mocha in child process it might be before setup_node_env -require('../../setup_node_env'); +require('../../../../src/setup_node_env'); module.exports = require('./auto_junit_reporter').createAutoJUnitReporter({ reportName: 'Server Mocha Tests', diff --git a/src/dev/xml.ts b/packages/osd-test/src/mocha/xml.ts similarity index 100% rename from src/dev/xml.ts rename to packages/osd-test/src/mocha/xml.ts diff --git a/packages/osd-test/src/junit_report_path.ts b/packages/osd-test/src/report_path.ts similarity index 100% rename from packages/osd-test/src/junit_report_path.ts rename to packages/osd-test/src/report_path.ts diff --git a/packages/osd-test/tsconfig.json b/packages/osd-test/tsconfig.json index 5c765855fab3..3219e6cf3d6e 100644 --- a/packages/osd-test/tsconfig.json +++ b/packages/osd-test/tsconfig.json @@ -1,11 +1,19 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "tsBuildInfoFile": "../../build/tsbuildinfo/packages/osd-test" - }, "include": [ "types/**/*", "src/**/*", "index.d.ts" - ] + ], + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./target/types", + "types": [ + "jest", + "node" + ], + "stripInternal": true, + "declarationMap": true + } } diff --git a/packages/osd-ui-framework/package.json b/packages/osd-ui-framework/package.json index 5ee583ba1295..ccf4e7a494c9 100644 --- a/packages/osd-ui-framework/package.json +++ b/packages/osd-ui-framework/package.json @@ -20,8 +20,8 @@ "uuid": "3.3.2" }, "peerDependencies": { - "enzyme": "^3.8.0", - "enzyme-adapter-react-16": "^1.9.1" + "enzyme": "^3.11.0", + "enzyme-adapter-react-16": "^1.15.6" }, "devDependencies": { "@elastic/eui": "29.3.2", diff --git a/packages/osd-utils/package.json b/packages/osd-utils/package.json index 802b03a0adb0..ff5013e16c9f 100644 --- a/packages/osd-utils/package.json +++ b/packages/osd-utils/package.json @@ -14,6 +14,6 @@ "load-json-file": "^6.2.0" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/scripts/mocha.js b/scripts/mocha.js index 66910153fc47..6707946b8dde 100644 --- a/scripts/mocha.js +++ b/scripts/mocha.js @@ -31,4 +31,4 @@ */ require('../src/setup_node_env'); -require('../src/dev/mocha').runMochaCli(); +require('@osd/test').runMochaCli(); diff --git a/src/cli/cluster/worker.ts b/src/cli/cluster/worker.ts index d8e6ab0bcefa..0ac36f03a097 100644 --- a/src/cli/cluster/worker.ts +++ b/src/cli/cluster/worker.ts @@ -151,7 +151,7 @@ export class Worker extends EventEmitter { this.processBinder.destroy(); // wait until the cluster reports this fork has exited, then resolve - await new Promise((resolve) => this.once('fork:exit', resolve)); + await new Promise((resolve) => this.once('fork:exit', resolve)); } } @@ -203,7 +203,7 @@ export class Worker extends EventEmitter { if (this.fork) { // once "exit" event is received with 0 status, start() is called again this.shutdown(); - await new Promise((cb) => this.once('online', cb)); + await new Promise((cb) => this.once('online', cb)); return; } @@ -229,6 +229,6 @@ export class Worker extends EventEmitter { this.processBinder.on('exit', () => this.shutdown()); // wait for the fork to report it is online before resolving - await new Promise((cb) => this.once('fork:online', cb)); + await new Promise((cb) => this.once('fork:online', cb)); } } diff --git a/src/cli/serve/integration_tests/reload_logging_config.test.ts b/src/cli/serve/integration_tests/reload_logging_config.test.ts index e296773ae596..cca7358afa27 100644 --- a/src/cli/serve/integration_tests/reload_logging_config.test.ts +++ b/src/cli/serve/integration_tests/reload_logging_config.test.ts @@ -106,7 +106,7 @@ describe('Server logging configuration', function () { afterEach(async () => { if (child !== undefined) { - const exitPromise = new Promise((resolve) => child?.once('exit', resolve)); + const exitPromise = new Promise((resolve) => child?.once('exit', resolve)); child.kill('SIGKILL'); await exitPromise; } @@ -135,7 +135,7 @@ describe('Server logging configuration', function () { '--verbose', ]); - const message$ = Rx.fromEvent(child.stdout, 'data').pipe( + const message$ = Rx.fromEvent(child.stdout!, 'data').pipe( map((messages) => String(messages).split('\n').filter(Boolean)) ); @@ -206,7 +206,7 @@ describe('Server logging configuration', function () { configFilePath, ]); - const message$ = Rx.fromEvent(child.stdout, 'data').pipe( + const message$ = Rx.fromEvent(child.stdout!, 'data').pipe( map((messages) => String(messages).split('\n').filter(Boolean)) ); diff --git a/src/cli_plugin/install/settings.test.js b/src/cli_plugin/install/settings.test.js index 0808ddf03cdc..1ec68ed17e59 100644 --- a/src/cli_plugin/install/settings.test.js +++ b/src/cli_plugin/install/settings.test.js @@ -38,8 +38,8 @@ import { parseMilliseconds, parse } from './settings'; const SECOND = 1000; const MINUTE = SECOND * 60; -const ORIGINAL_PLATFORM = process.platform; -const ORIGINAL_ARCHITECTURE = process.arch; +const ORIGINAL_PLATFORM = 'linux'; +const ORIGINAL_ARCHITECTURE = 'x64'; expect.addSnapshotSerializer(createAbsolutePathSerializer()); @@ -65,7 +65,7 @@ describe('parse function', function () { const defaultOptions = { pluginDir: fromRoot('plugins') }; const osdPackage = { version: 1234 }; - afterAll(() => { + beforeAll(() => { Object.defineProperties(process, { platform: { value: ORIGINAL_PLATFORM, diff --git a/src/core/public/application/application_service.test.ts b/src/core/public/application/application_service.test.ts index a2f6092015a3..6f98f57e4906 100644 --- a/src/core/public/application/application_service.test.ts +++ b/src/core/public/application/application_service.test.ts @@ -706,11 +706,11 @@ describe('#start()', () => { const history = createMemoryHistory(); setupDeps.history = history; - const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); // Create an app and a promise that allows us to control when the app completes mounting const createWaitingApp = (props: Partial): [App, () => void] => { let finishMount: () => void; - const mountPromise = new Promise((resolve) => (finishMount = resolve)); + const mountPromise = new Promise((resolve) => (finishMount = resolve)); const app = { id: 'some-id', title: 'some-title', diff --git a/src/core/public/application/integration_tests/application_service.test.tsx b/src/core/public/application/integration_tests/application_service.test.tsx index e0468be51668..57c1570e0191 100644 --- a/src/core/public/application/integration_tests/application_service.test.tsx +++ b/src/core/public/application/integration_tests/application_service.test.tsx @@ -44,7 +44,7 @@ import { AppMountParameters } from '../types'; import { Observable } from 'rxjs'; import { MountPoint } from 'opensearch-dashboards/public'; -const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); +const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); describe('ApplicationService', () => { let setupDeps: MockLifecycle<'setup'>; @@ -79,7 +79,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -113,7 +113,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -455,7 +455,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -493,7 +493,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); diff --git a/src/core/public/application/integration_tests/utils.tsx b/src/core/public/application/integration_tests/utils.tsx index dff29169603c..731e6989475d 100644 --- a/src/core/public/application/integration_tests/utils.tsx +++ b/src/core/public/application/integration_tests/utils.tsx @@ -45,7 +45,7 @@ export const createRenderer = (element: ReactElement | null): Renderer => { const dom: Dom = element && mount({element}); return () => - new Promise(async (resolve) => { + new Promise(async (resolve) => { if (dom) { await act(async () => { dom.update(); diff --git a/src/core/public/application/ui/app_container.test.tsx b/src/core/public/application/ui/app_container.test.tsx index 73281ec69513..31b6534e3b78 100644 --- a/src/core/public/application/ui/app_container.test.tsx +++ b/src/core/public/application/ui/app_container.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { mount } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { AppContainer } from './app_container'; import { Mounter, AppMountParameters, AppStatus } from '../types'; @@ -52,7 +52,7 @@ describe('AppContainer', () => { }); const flushPromises = async () => { - await new Promise(async (resolve) => { + await new Promise(async (resolve) => { setImmediate(() => resolve()); }); }; diff --git a/src/core/public/chrome/ui/header/branding/opensearch_dashboards_custom_logo.test.tsx b/src/core/public/chrome/ui/header/branding/opensearch_dashboards_custom_logo.test.tsx index 8de0812b9c24..c2178c9be03b 100644 --- a/src/core/public/chrome/ui/header/branding/opensearch_dashboards_custom_logo.test.tsx +++ b/src/core/public/chrome/ui/header/branding/opensearch_dashboards_custom_logo.test.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { CustomLogo } from './opensearch_dashboards_custom_logo'; describe('Header logo ', () => { diff --git a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx index e9824d09db38..391730286269 100644 --- a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx +++ b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx @@ -34,7 +34,7 @@ import { mount, ReactWrapper } from 'enzyme'; import React from 'react'; import { BehaviorSubject } from 'rxjs'; import sinon from 'sinon'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { ChromeNavLink, DEFAULT_APP_CATEGORIES } from '../../..'; import { httpServiceMock } from '../../../http/http_service.mock'; import { ChromeRecentlyAccessedHistoryItem } from '../../recently_accessed'; diff --git a/src/core/public/chrome/ui/header/header.test.tsx b/src/core/public/chrome/ui/header/header.test.tsx index 740e9d9145dc..32495c0c85b5 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -33,11 +33,11 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject } from 'rxjs'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { httpServiceMock } from '../../../http/http_service.mock'; import { applicationServiceMock } from '../../../mocks'; import { Header } from './header'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ htmlIdGenerator: () => () => 'mockId', diff --git a/src/core/public/chrome/ui/header/header_action_menu.test.tsx b/src/core/public/chrome/ui/header/header_action_menu.test.tsx index 9e04cebb4123..00c6bb9411fe 100644 --- a/src/core/public/chrome/ui/header/header_action_menu.test.tsx +++ b/src/core/public/chrome/ui/header/header_action_menu.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ -import React from 'react'; +import React, { Component } from 'react'; import { mount, ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject } from 'rxjs'; @@ -50,7 +50,7 @@ describe('HeaderActionMenu', () => { }); const refresh = () => { - new Promise(async (resolve) => { + new Promise>>(async (resolve) => { if (component) { act(() => { component.update(); diff --git a/src/core/public/core_app/status/components/server_status.test.tsx b/src/core/public/core_app/status/components/server_status.test.tsx index 61b4dacd37df..d421de08a0cf 100644 --- a/src/core/public/core_app/status/components/server_status.test.tsx +++ b/src/core/public/core_app/status/components/server_status.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { ServerStatus } from './server_status'; import { FormattedStatus } from '../lib'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; const getStatus = (parts: Partial = {}): FormattedStatus['state'] => ({ id: 'green', diff --git a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx index 20bdb77d27f8..358a10e70870 100644 --- a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx +++ b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx @@ -34,7 +34,7 @@ import { EuiCallOut } from '@elastic/eui'; import testSubjSelector from '@osd/test-subj-selector'; import React from 'react'; import * as Rx from 'rxjs'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@osd/test/jest'; import { FatalErrorsScreen } from './fatal_errors_screen'; diff --git a/src/core/public/integrations/moment/moment_service.test.ts b/src/core/public/integrations/moment/moment_service.test.ts index f041af19dbb8..95d08eb8b168 100644 --- a/src/core/public/integrations/moment/moment_service.test.ts +++ b/src/core/public/integrations/moment/moment_service.test.ts @@ -45,7 +45,7 @@ describe('MomentService', () => { }); afterEach(() => service.stop()); - const flushPromises = () => new Promise((resolve) => setTimeout(resolve, 100)); + const flushPromises = () => new Promise((resolve) => setTimeout(resolve, 100)); test('sets initial moment config', async () => { const tz$ = new BehaviorSubject('tz1'); diff --git a/src/core/public/integrations/styles/styles_service.test.ts b/src/core/public/integrations/styles/styles_service.test.ts index 25c7148a349a..d52cab54ca4b 100644 --- a/src/core/public/integrations/styles/styles_service.test.ts +++ b/src/core/public/integrations/styles/styles_service.test.ts @@ -38,7 +38,7 @@ import { StylesService } from './styles_service'; import { uiSettingsServiceMock } from '../../ui_settings/ui_settings_service.mock'; describe('StylesService', () => { - const flushPromises = () => new Promise((resolve) => setTimeout(resolve, 100)); + const flushPromises = () => new Promise((resolve) => setTimeout(resolve, 100)); const getDisableAnimationsTag = () => document.querySelector('style#disableAnimationsCss')!; afterEach(() => getDisableAnimationsTag().remove()); diff --git a/src/core/public/notifications/toasts/error_toast.test.tsx b/src/core/public/notifications/toasts/error_toast.test.tsx index 381ad12505fb..c401880fea43 100644 --- a/src/core/public/notifications/toasts/error_toast.test.tsx +++ b/src/core/public/notifications/toasts/error_toast.test.tsx @@ -32,7 +32,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ErrorToast } from './error_toast'; diff --git a/src/core/public/overlays/modal/modal_service.tsx b/src/core/public/overlays/modal/modal_service.tsx index 13e61785d232..a755f91b712d 100644 --- a/src/core/public/overlays/modal/modal_service.tsx +++ b/src/core/public/overlays/modal/modal_service.tsx @@ -171,7 +171,7 @@ export class ModalService { this.cleanupDom(); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let resolved = false; const closeModal = (confirmed: boolean) => { resolved = true; diff --git a/src/core/public/plugins/plugin.test.ts b/src/core/public/plugins/plugin.test.ts index 5a7f8b54111e..9d72cb29e020 100644 --- a/src/core/public/plugins/plugin.test.ts +++ b/src/core/public/plugins/plugin.test.ts @@ -115,7 +115,7 @@ describe('PluginWrapper', () => { setup: jest.fn(), start: jest.fn(async () => { // Add small delay to ensure startDependencies is not resolved until after the plugin instance's start resolves. - await new Promise((resolve) => setTimeout(resolve, 10)); + await new Promise((resolve) => setTimeout(resolve, 10)); expect(startDependenciesResolved).toBe(false); return pluginStartContract; }), diff --git a/src/core/public/plugins/plugins_service.test.ts b/src/core/public/plugins/plugins_service.test.ts index ac506c8e0082..54f2f732ddab 100644 --- a/src/core/public/plugins/plugins_service.test.ts +++ b/src/core/public/plugins/plugins_service.test.ts @@ -267,7 +267,7 @@ describe('PluginsService', () => { }); describe('timeout', () => { - const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); beforeAll(() => { jest.useFakeTimers('legacy'); setImmediate(() => {}); @@ -280,7 +280,7 @@ describe('PluginsService', () => { mockPluginInitializers.set( 'pluginA', jest.fn(() => ({ - setup: jest.fn(() => new Promise((i) => i)), + setup: jest.fn(() => new Promise((i) => i)), start: jest.fn(() => ({ value: 1 })), stop: jest.fn(), })) diff --git a/src/core/public/saved_objects/saved_objects_client.ts b/src/core/public/saved_objects/saved_objects_client.ts index 85ccac59b541..6f58228a9c5f 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -387,7 +387,7 @@ export class SavedObjectsClient { return Promise.reject(new Error('requires type and id')); } - return new Promise((resolve, reject) => { + return new Promise>((resolve, reject) => { this.batchQueue.push({ type, id, resolve, reject } as BatchQueueEntry); this.processBatchQueue(); }); diff --git a/src/core/public/ui_settings/ui_settings_api.ts b/src/core/public/ui_settings/ui_settings_api.ts index 91c3bd297c24..eb09696ae812 100644 --- a/src/core/public/ui_settings/ui_settings_api.ts +++ b/src/core/public/ui_settings/ui_settings_api.ts @@ -83,7 +83,7 @@ export class UiSettingsApi { if (error) { reject(error); } else { - resolve(resp); + resolve(resp!); } }, }; diff --git a/src/core/public/utils/crypto/sha256.ts b/src/core/public/utils/crypto/sha256.ts index fdfa4a1bc80a..dd126f0e0f2f 100644 --- a/src/core/public/utils/crypto/sha256.ts +++ b/src/core/public/utils/crypto/sha256.ts @@ -143,7 +143,7 @@ type BufferEncoding = | 'binary' | 'hex'; -/* eslint-disable no-bitwise, no-shadow */ +/* eslint-disable no-bitwise, @typescript-eslint/no-shadow */ export class Sha256 { private _a: number; private _b: number; diff --git a/src/core/server/http/cookie_session_storage.test.ts b/src/core/server/http/cookie_session_storage.test.ts index a08cf4ead2a2..49a89be11786 100644 --- a/src/core/server/http/cookie_session_storage.test.ts +++ b/src/core/server/http/cookie_session_storage.test.ts @@ -119,7 +119,7 @@ const userData = { id: '42' }; const sessionDurationMs = 1000; const path = '/'; const sessVal = () => ({ value: userData, expires: Date.now() + sessionDurationMs, path }); -const delay = (ms: number) => new Promise((res) => setTimeout(res, ms)); +const delay = (ms: number) => new Promise((res) => setTimeout(res, ms)); const cookieOptions = { name: 'sid', encryptionKey: 'something_at_least_32_characters', diff --git a/src/core/server/http/http_tools.test.ts b/src/core/server/http/http_tools.test.ts index 5ce6eb80b755..d8cfc64cd308 100644 --- a/src/core/server/http/http_tools.test.ts +++ b/src/core/server/http/http_tools.test.ts @@ -106,7 +106,7 @@ describe('timeouts', () => { test('closes sockets on timeout', async () => { const router = new Router('', logger.get(), enhanceWithContext); router.get({ path: '/a', validate: false }, async (context, req, res) => { - await new Promise((resolve) => setTimeout(resolve, 2000)); + await new Promise((resolve) => setTimeout(resolve, 2000)); return res.ok({}); }); router.get({ path: '/b', validate: false }, (context, req, res) => res.ok({})); diff --git a/src/core/server/http/integration_tests/request.test.ts b/src/core/server/http/integration_tests/request.test.ts index 7173ec9ad603..65c5cf03de14 100644 --- a/src/core/server/http/integration_tests/request.test.ts +++ b/src/core/server/http/integration_tests/request.test.ts @@ -62,7 +62,7 @@ afterEach(async () => { await server.stop(); }); -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); describe('OpenSearchDashboardsRequest', () => { describe('auth', () => { describe('isAuthenticated', () => { diff --git a/src/core/server/http/integration_tests/router.test.ts b/src/core/server/http/integration_tests/router.test.ts index caac880474cd..18da2b6a563d 100644 --- a/src/core/server/http/integration_tests/router.test.ts +++ b/src/core/server/http/integration_tests/router.test.ts @@ -319,7 +319,7 @@ describe('Options', () => { describe('timeout', () => { const writeBodyCharAtATime = (request: supertest.Test, body: string, interval: number) => { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let i = 0; const intervalId = setInterval(() => { if (i < body.length) { @@ -480,7 +480,7 @@ describe('Options', () => { }, }, async (context, req, res) => { - await new Promise((resolve) => setTimeout(resolve, 2000)); + await new Promise((resolve) => setTimeout(resolve, 2000)); return res.ok({}); } ); @@ -505,7 +505,7 @@ describe('Options', () => { }, }, async (context, req, res) => { - await new Promise((resolve) => setTimeout(resolve, 10)); + await new Promise((resolve) => setTimeout(resolve, 10)); return res.ok({}); } ); diff --git a/src/core/server/logging/appenders/file/file_appender.test.ts b/src/core/server/logging/appenders/file/file_appender.test.ts index 530a6a9567b5..e4f520099138 100644 --- a/src/core/server/logging/appenders/file/file_appender.test.ts +++ b/src/core/server/logging/appenders/file/file_appender.test.ts @@ -35,7 +35,7 @@ import { mockCreateWriteStream } from './file_appender.test.mocks'; import { LogRecord, LogLevel } from '@osd/logging'; import { FileAppender } from './file_appender'; -const tickMs = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +const tickMs = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); beforeEach(() => { mockCreateWriteStream.mockReset(); diff --git a/src/core/server/logging/appenders/file/file_appender.ts b/src/core/server/logging/appenders/file/file_appender.ts index 9e8d34a34219..35e703e5298c 100644 --- a/src/core/server/logging/appenders/file/file_appender.ts +++ b/src/core/server/logging/appenders/file/file_appender.ts @@ -84,7 +84,7 @@ export class FileAppender implements DisposableAppender { * Disposes `FileAppender`. Waits for the underlying file stream to be completely flushed and closed. */ public async dispose() { - await new Promise((resolve) => { + await new Promise((resolve) => { if (this.outputStream === undefined) { return resolve(); } diff --git a/src/core/server/metrics/collectors/process.ts b/src/core/server/metrics/collectors/process.ts index fed71316a936..bffa9c8dfa0e 100644 --- a/src/core/server/metrics/collectors/process.ts +++ b/src/core/server/metrics/collectors/process.ts @@ -54,7 +54,7 @@ export class ProcessMetricsCollector implements MetricsCollector => { const bench = new Bench(); - return new Promise((resolve) => { + return new Promise((resolve) => { setImmediate(() => { return resolve(bench.elapsed()); }); diff --git a/src/core/server/metrics/integration_tests/server_collector.test.ts b/src/core/server/metrics/integration_tests/server_collector.test.ts index a3d20626f968..6819bff7efd0 100644 --- a/src/core/server/metrics/integration_tests/server_collector.test.ts +++ b/src/core/server/metrics/integration_tests/server_collector.test.ts @@ -47,7 +47,7 @@ describe('ServerMetricsCollector', () => { let hapiServer: HapiServer; let router: IRouter; - const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const sendGet = (path: string) => supertest(hapiServer.listener).get(path); beforeEach(async () => { @@ -94,7 +94,7 @@ describe('ServerMetricsCollector', () => { }); it('collect disconnects requests infos', async () => { - const never = new Promise((resolve) => undefined); + const never = new Promise((resolve) => undefined); const hitSubject = new BehaviorSubject(0); router.get({ path: '/', validate: false }, async (ctx, req, res) => { diff --git a/src/core/server/metrics/metrics_service.test.ts b/src/core/server/metrics/metrics_service.test.ts index 8f3a7c98161e..29afa7595e2d 100644 --- a/src/core/server/metrics/metrics_service.test.ts +++ b/src/core/server/metrics/metrics_service.test.ts @@ -103,7 +103,7 @@ describe('MetricsService', () => { const nextEmission = async () => { jest.advanceTimersByTime(testInterval); await getOpsMetrics$().pipe(take(1)).toPromise(); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); }; expect(mockOpsCollector.collect).toHaveBeenCalledTimes(1); @@ -137,7 +137,7 @@ describe('MetricsService', () => { const nextEmission = async () => { jest.advanceTimersByTime(testInterval); const emission = await getOpsMetrics$().pipe(take(1)).toPromise(); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); return emission; }; diff --git a/src/core/server/opensearch/client/cluster_client.test.ts b/src/core/server/opensearch/client/cluster_client.test.ts index 872ac9506bce..af26d6c9c69f 100644 --- a/src/core/server/opensearch/client/cluster_client.test.ts +++ b/src/core/server/opensearch/client/cluster_client.test.ts @@ -436,7 +436,7 @@ describe('ClusterClient', () => { let closeScopedClient: () => void; internalClient.close.mockReturnValue( - new Promise((resolve) => { + new Promise((resolve) => { closeInternalClient = resolve; }).then(() => { expect(clusterClientClosed).toBe(false); @@ -444,7 +444,7 @@ describe('ClusterClient', () => { }) ); scopedClient.close.mockReturnValue( - new Promise((resolve) => { + new Promise((resolve) => { closeScopedClient = resolve; }).then(() => { expect(clusterClientClosed).toBe(false); diff --git a/src/core/server/opensearch/legacy/cluster_client.ts b/src/core/server/opensearch/legacy/cluster_client.ts index a38df7cf5956..6f9110edc2d4 100644 --- a/src/core/server/opensearch/legacy/cluster_client.ts +++ b/src/core/server/opensearch/legacy/cluster_client.ts @@ -80,7 +80,7 @@ const callAPI = async ( const apiContext = clientPath.length === 1 ? client : get(client, clientPath.slice(0, -1)); try { - return await new Promise((resolve, reject) => { + return await new Promise((resolve, reject) => { const request = api.call(apiContext, clientParams); if (options.signal) { options.signal.addEventListener('abort', () => { diff --git a/src/core/server/opensearch/opensearch_service.test.ts b/src/core/server/opensearch/opensearch_service.test.ts index ceb6848c1ad1..8fc4c5c614f6 100644 --- a/src/core/server/opensearch/opensearch_service.test.ts +++ b/src/core/server/opensearch/opensearch_service.test.ts @@ -47,7 +47,7 @@ import { opensearchClientMock } from './client/mocks'; import { duration } from 'moment'; const delay = async (durationMs: number) => - await new Promise((resolve) => setTimeout(resolve, durationMs)); + await new Promise((resolve) => setTimeout(resolve, durationMs)); let opensearchService: OpenSearchService; const configService = configServiceMock.create(); diff --git a/src/core/server/plugins/integration_tests/plugins_service.test.ts b/src/core/server/plugins/integration_tests/plugins_service.test.ts index 9d78829190c6..5a7ad1fc340a 100644 --- a/src/core/server/plugins/integration_tests/plugins_service.test.ts +++ b/src/core/server/plugins/integration_tests/plugins_service.test.ts @@ -158,7 +158,7 @@ describe('PluginsService', () => { }, start: async (core, plugins) => { contextFromStart = { core, plugins }; - await new Promise((resolve) => setTimeout(resolve, 10)); + await new Promise((resolve) => setTimeout(resolve, 10)); expect(startDependenciesResolved).toBe(false); return pluginStartContract; }, diff --git a/src/core/server/plugins/plugin.test.ts b/src/core/server/plugins/plugin.test.ts index 040f7c247aad..72b5f3da9dbe 100644 --- a/src/core/server/plugins/plugin.test.ts +++ b/src/core/server/plugins/plugin.test.ts @@ -327,7 +327,7 @@ test("`start` resolves `startDependencies` Promise after plugin's start", async setup: jest.fn(), start: async () => { // delay to ensure startDependencies is not resolved until after the plugin instance's start resolves. - await new Promise((resolve) => setTimeout(resolve, 10)); + await new Promise((resolve) => setTimeout(resolve, 10)); expect(startDependenciesResolved).toBe(false); return pluginStartContract; }, diff --git a/src/core/server/plugins/plugins_system.test.ts b/src/core/server/plugins/plugins_system.test.ts index 12ec90c47ce8..3de1deffea8c 100644 --- a/src/core/server/plugins/plugins_system.test.ts +++ b/src/core/server/plugins/plugins_system.test.ts @@ -451,7 +451,7 @@ describe('setup', () => { }); it('throws timeout error if "setup" was not completed in 30 sec.', async () => { const plugin: PluginWrapper = createPlugin('timeout-setup'); - jest.spyOn(plugin, 'setup').mockImplementation(() => new Promise((i) => i)); + jest.spyOn(plugin, 'setup').mockImplementation(() => new Promise((i) => i)); pluginsSystem.addPlugin(plugin); mockCreatePluginSetupContext.mockImplementation(() => ({})); @@ -489,7 +489,7 @@ describe('start', () => { it('throws timeout error if "start" was not completed in 30 sec.', async () => { const plugin: PluginWrapper = createPlugin('timeout-start'); jest.spyOn(plugin, 'setup').mockResolvedValue({}); - jest.spyOn(plugin, 'start').mockImplementation(() => new Promise((i) => i)); + jest.spyOn(plugin, 'start').mockImplementation(() => new Promise((i) => i)); pluginsSystem.addPlugin(plugin); mockCreatePluginSetupContext.mockImplementation(() => ({})); diff --git a/src/core/server/rendering/rendering_service.test.ts b/src/core/server/rendering/rendering_service.test.ts index e4d52dc13648..a2427e331c9c 100644 --- a/src/core/server/rendering/rendering_service.test.ts +++ b/src/core/server/rendering/rendering_service.test.ts @@ -93,7 +93,7 @@ describe('RenderingService', () => { it('renders "core" page', async () => { const content = await render(createOpenSearchDashboardsRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('osd-injected-metadata').attr('data')); + const data = JSON.parse(dom('osd-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -103,7 +103,7 @@ describe('RenderingService', () => { const content = await render(createOpenSearchDashboardsRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('osd-injected-metadata').attr('data')); + const data = JSON.parse(dom('osd-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -112,7 +112,7 @@ describe('RenderingService', () => { uiSettings.getUserProvided.mockResolvedValue({ 'theme:darkMode': { userValue: true } }); const content = await render(createOpenSearchDashboardsRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('osd-injected-metadata').attr('data')); + const data = JSON.parse(dom('osd-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -122,7 +122,7 @@ describe('RenderingService', () => { includeUserSettings: false, }); const dom = load(content); - const data = JSON.parse(dom('osd-injected-metadata').attr('data')); + const data = JSON.parse(dom('osd-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -130,7 +130,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('osd-injected-metadata').attr('data')); + const data = JSON.parse(dom('osd-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); diff --git a/src/core/server/rendering/views/template.test.tsx b/src/core/server/rendering/views/template.test.tsx index fd75258816ff..042393d64403 100644 --- a/src/core/server/rendering/views/template.test.tsx +++ b/src/core/server/rendering/views/template.test.tsx @@ -34,7 +34,7 @@ import React from 'react'; import { injectedMetadataServiceMock } from '../../../public/mocks'; import { httpServiceMock } from '../../http/http_service.mock'; import { Template } from './template'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@osd/test/jest'; const http = httpServiceMock.createStartContract(); const injectedMetadata = injectedMetadataServiceMock.createSetupContract(); diff --git a/src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts b/src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts index dee6d64feba6..f76eae8802e1 100644 --- a/src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts +++ b/src/core/server/saved_objects/migrations/core/migrate_raw_docs.ts @@ -86,7 +86,7 @@ function transformNonBlocking( ): (doc: SavedObjectUnsanitizedDoc) => Promise { // promises aren't enough to unblock the event loop return (doc: SavedObjectUnsanitizedDoc) => - new Promise((resolve, reject) => { + new Promise((resolve, reject) => { // set immediate is though setImmediate(() => { try { diff --git a/src/core/server/saved_objects/migrations/core/migration_coordinator.ts b/src/core/server/saved_objects/migrations/core/migration_coordinator.ts index 20ff81795743..4ffbfaf65635 100644 --- a/src/core/server/saved_objects/migrations/core/migration_coordinator.ts +++ b/src/core/server/saved_objects/migrations/core/migration_coordinator.ts @@ -131,5 +131,5 @@ async function waitForMigration( } function sleep(ms: number) { - return new Promise((r) => setTimeout(r, ms)); + return new Promise((r) => setTimeout(r, ms)); } diff --git a/src/core/server/saved_objects/migrations/core/opensearch_index.ts b/src/core/server/saved_objects/migrations/core/opensearch_index.ts index aca47217d68d..e5d55a752d8b 100644 --- a/src/core/server/saved_objects/migrations/core/opensearch_index.ts +++ b/src/core/server/saved_objects/migrations/core/opensearch_index.ts @@ -214,7 +214,7 @@ export async function migrationsUpToDate( throw e; } - await new Promise((r) => setTimeout(r, 1000)); + await new Promise((r) => setTimeout(r, 1000)); return await migrationsUpToDate(client, index, migrationVersion, retryCount - 1); } @@ -369,7 +369,7 @@ async function reindex( let completed = false; while (!completed) { - await new Promise((r) => setTimeout(r, pollInterval)); + await new Promise((r) => setTimeout(r, pollInterval)); const { body } = await client.tasks.get({ task_id: task, diff --git a/src/core/server/status/plugins_status.test.ts b/src/core/server/status/plugins_status.test.ts index 5301027715da..311da99f305b 100644 --- a/src/core/server/status/plugins_status.test.ts +++ b/src/core/server/status/plugins_status.test.ts @@ -315,7 +315,7 @@ describe('PluginStatusService', () => { const subscription = service .getDependenciesStatus$('b') .subscribe((status) => statusUpdates.push(status)); - const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); pluginA$.next(degraded); pluginA$.next(available); diff --git a/src/core/server/status/status_service.test.ts b/src/core/server/status/status_service.test.ts index 71849c61b750..4068340e552d 100644 --- a/src/core/server/status/status_service.test.ts +++ b/src/core/server/status/status_service.test.ts @@ -50,7 +50,7 @@ describe('StatusService', () => { service = new StatusService(mockCoreContext.create()); }); - const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const available: ServiceStatus = { level: ServiceStatusLevels.available, summary: 'Available', diff --git a/src/core/server/utils/streams/list_stream.test.ts b/src/core/server/utils/streams/list_stream.test.ts index 812011d7a218..8f4015088019 100644 --- a/src/core/server/utils/streams/list_stream.test.ts +++ b/src/core/server/utils/streams/list_stream.test.ts @@ -38,7 +38,7 @@ describe('listStream', () => { const onData = jest.fn(); str.on('data', onData); - await new Promise((resolve) => str.on('end', resolve)); + await new Promise((resolve) => str.on('end', resolve)); expect(onData).toHaveBeenCalledTimes(4); expect(onData.mock.calls[0]).toEqual([1]); @@ -51,7 +51,7 @@ describe('listStream', () => { const list = [1, 2, 3, 4]; const str = createListStream(list); str.resume(); - await new Promise((resolve) => str.on('end', resolve)); + await new Promise((resolve) => str.on('end', resolve)); expect(list).toEqual([1, 2, 3, 4]); }); }); diff --git a/src/core/server/utils/streams/promise_from_streams.test.ts b/src/core/server/utils/streams/promise_from_streams.test.ts index 4ca8c75a8296..7bcf20bf0401 100644 --- a/src/core/server/utils/streams/promise_from_streams.test.ts +++ b/src/core/server/utils/streams/promise_from_streams.test.ts @@ -38,9 +38,9 @@ describe('promiseFromStreams', () => { test('pipes together an array of streams', async () => { const str1 = createListStream([1, 2, 3]); const str2 = createReduceStream((acc, n) => acc + n, 0); - const sumPromise = new Promise((resolve) => str2.once('data', resolve)); + const sumPromise = new Promise((resolve) => str2.once('data', resolve)); createPromiseFromStreams([str1, str2]); - await new Promise((resolve) => str2.once('end', resolve)); + await new Promise((resolve) => str2.once('end', resolve)); expect(await sumPromise).toBe(6); }); @@ -100,7 +100,7 @@ describe('promiseFromStreams', () => { write(chunk, enc, cb) { duplexReadQueue.push( - new Promise((resolve) => { + new Promise((resolve) => { setTimeout(() => { written += chunk; cb(); diff --git a/src/core/server/utils/streams/promise_from_streams.ts b/src/core/server/utils/streams/promise_from_streams.ts index 09cf61965221..406654828206 100644 --- a/src/core/server/utils/streams/promise_from_streams.ts +++ b/src/core/server/utils/streams/promise_from_streams.ts @@ -75,7 +75,7 @@ export async function createPromiseFromStreams(streams: [Readable, ...Writabl ); } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { // @ts-expect-error 'pipeline' doesn't support variable length of arguments pipeline(...streams, (err) => { if (err) return reject(err); diff --git a/src/core/server/utils/streams/reduce_stream.test.ts b/src/core/server/utils/streams/reduce_stream.test.ts index 7c3f89534b6d..f739eae4d37b 100644 --- a/src/core/server/utils/streams/reduce_stream.test.ts +++ b/src/core/server/utils/streams/reduce_stream.test.ts @@ -33,7 +33,7 @@ import { Transform } from 'stream'; import { createReduceStream, createPromiseFromStreams, createListStream } from './index'; const promiseFromEvent = (name: string, emitter: Transform) => - new Promise((resolve) => emitter.on(name, () => resolve(name))); + new Promise((resolve) => emitter.on(name, () => resolve(name))); describe('reduceStream', () => { test('calls the reducer for each item provided', async () => { diff --git a/src/core/tsconfig.json b/src/core/tsconfig.json index a3531057767d..cda06b6d248a 100644 --- a/src/core/tsconfig.json +++ b/src/core/tsconfig.json @@ -15,8 +15,5 @@ "utils/**/*", "index.ts", "typings.ts" - ], - "references": [ - { "path": "../test_utils/" } ] } diff --git a/src/dev/build/lib/download.ts b/src/dev/build/lib/download.ts index 95fbd0a4f6e0..055aa4116319 100644 --- a/src/dev/build/lib/download.ts +++ b/src/dev/build/lib/download.ts @@ -82,7 +82,7 @@ export async function download(options: DownloadOptions): Promise { } const hash = createHash('sha256'); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { response.data.on('data', (chunk: Buffer) => { hash.update(chunk); writeSync(fileHandle, chunk); diff --git a/src/dev/build/lib/fs.ts b/src/dev/build/lib/fs.ts index 16b682b53f17..938e3a20e892 100644 --- a/src/dev/build/lib/fs.ts +++ b/src/dev/build/lib/fs.ts @@ -220,7 +220,7 @@ export async function getFileHash(path: string, algo: string) { const hash = createHash(algo); const readStream = fs.createReadStream(path); - await new Promise((res, rej) => { + await new Promise((res, rej) => { readStream .on('data', (chunk) => hash.update(chunk)) .on('error', rej) diff --git a/src/dev/build/tasks/copy_source_task.ts b/src/dev/build/tasks/copy_source_task.ts index cb48cf4067a4..5bd1efb0d29f 100644 --- a/src/dev/build/tasks/copy_source_task.ts +++ b/src/dev/build/tasks/copy_source_task.ts @@ -39,7 +39,6 @@ export const CopySource: Task = { '!src/**/*.{test,test.mocks,mock}.{js,ts,tsx}', '!src/**/mocks.ts', // special file who imports .mock files '!src/**/{target,__tests__,__snapshots__,__mocks__}/**', - '!src/test_utils/**', '!src/fixtures/**', '!src/cli/cluster/**', '!src/cli/repl/**', diff --git a/src/dev/index.js b/src/dev/index.js index ed202dd45fec..f190f005702c 100644 --- a/src/dev/index.js +++ b/src/dev/index.js @@ -30,6 +30,6 @@ * GitHub history for details. */ -export { createAutoJUnitReporter, setupJUnitReportGeneration } from './mocha'; +export { createAutoJUnitReporter, setupJUnitReportGeneration } from '@osd/test'; export { generateNoticeFromSource } from './notice'; diff --git a/src/dev/jest/config.integration.js b/src/dev/jest/config.integration.js index bbfdf2d6cdee..9fac0435d8ac 100644 --- a/src/dev/jest/config.integration.js +++ b/src/dev/jest/config.integration.js @@ -30,6 +30,7 @@ * GitHub history for details. */ +import preset from '@osd/test/jest-preset'; import config from './config'; export default { @@ -39,12 +40,15 @@ export default { '**/integration_tests/**/*.test.ts', '**/integration_tests/**/*.test.tsx', ], - testPathIgnorePatterns: config.testPathIgnorePatterns.filter( + testPathIgnorePatterns: preset.testPathIgnorePatterns.filter( (pattern) => !pattern.includes('integration_tests') ), reporters: [ 'default', - ['/src/dev/jest/junit_reporter.js', { reportName: 'Jest Integration Tests' }], + [ + '/packages/osd-test/target/jest/junit_reporter', + { reportName: 'Jest Integration Tests' }, + ], ], - setupFilesAfterEnv: ['/src/dev/jest/setup/after_env.integration.js'], + setupFilesAfterEnv: ['/packages/osd-test/target/jest/setup/after_env.integration.js'], }; diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 3f82435ba51c..06832535a764 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -30,9 +30,8 @@ * GitHub history for details. */ -import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants'; - export default { + preset: '@osd/test', rootDir: '../../..', roots: [ '/src/plugins', @@ -48,12 +47,13 @@ export default { '/src/legacy/utils', '/src/setup_node_env', '/packages', - '/src/test_utils', '/test/functional/services/remote', ], collectCoverageFrom: [ 'src/plugins/**/*.{ts,tsx}', + '!src/plugins/**/{__test__,__snapshots__,__examples__,mocks,tests}/**/*', '!src/plugins/**/*.d.ts', + '!src/plugins/**/test_helpers/**', 'packages/osd-ui-framework/src/components/**/*.js', '!packages/osd-ui-framework/src/components/index.js', '!packages/osd-ui-framework/src/components/**/*/index.js', @@ -61,60 +61,5 @@ export default { '!packages/osd-ui-framework/src/services/index.js', '!packages/osd-ui-framework/src/services/**/*/index.js', ], - moduleNameMapper: { - '@elastic/eui$': '/node_modules/@elastic/eui/test-env', - '@elastic/eui/lib/(.*)?': '/node_modules/@elastic/eui/test-env/$1', - '^src/plugins/(.*)': '/src/plugins/$1', - '^test_utils/(.*)': '/src/test_utils/public/$1', - '^fixtures/(.*)': '/src/fixtures/$1', - '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - '/src/dev/jest/mocks/file_mock.js', - '\\.(css|less|scss)$': '/src/dev/jest/mocks/style_mock.js', - '\\.ace\\.worker.js$': '/src/dev/jest/mocks/worker_module_mock.js', - '\\.editor\\.worker.js$': '/src/dev/jest/mocks/worker_module_mock.js', - '^(!!)?file-loader!': '/src/dev/jest/mocks/file_mock.js', - }, - setupFiles: [ - '/src/dev/jest/setup/babel_polyfill.js', - '/src/dev/jest/setup/polyfills.js', - '/src/dev/jest/setup/enzyme.js', - ], - setupFilesAfterEnv: [ - '/src/dev/jest/setup/mocks.js', - '/src/dev/jest/setup/react_testing_library.js', - ], - coverageDirectory: '/target/opensearch-dashboards-coverage/jest', - coverageReporters: ['html', 'text', 'text-summary'], - moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'], - modulePathIgnorePatterns: [ - '__fixtures__/', - 'target/', - '/src/plugins/maps_legacy', - '/src/plugins/region_map', - ], - testEnvironment: 'jest-environment-jsdom', - testMatch: ['**/*.test.{js,mjs,ts,tsx}'], - testPathIgnorePatterns: [ - '/packages/osd-ui-framework/(dist|doc_site)/', - '/packages/osd-pm/dist/', - `${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`, - ], - // angular is not compatible with the default circus runner - testRunner: 'jest-jasmine2', - transform: { - '^.+\\.(js|tsx?)$': '/src/dev/jest/babel_transform.js', - '^.+\\.txt?$': 'jest-raw-loader', - '^.+\\.html?$': 'jest-raw-loader', - }, - transformIgnorePatterns: [ - // ignore all node_modules except monaco-editor which requires babel transforms to handle dynamic import() - // since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842) - '[/\\\\]node_modules(?![\\/\\\\](monaco-editor|weak-lru-cache|ordered-binary))[/\\\\].+\\.js$', - 'packages/osd-pm/dist/index.js', - ], - snapshotSerializers: [ - '/src/plugins/opensearch_dashboards_react/public/util/test_helpers/react_mount_serializer.ts', - '/node_modules/enzyme-to-json/serializer', - ], - reporters: ['default', '/src/dev/jest/junit_reporter.js'], + testRunner: 'jasmine2', }; diff --git a/src/dev/jest/integration_tests/__fixtures__/package.json b/src/dev/jest/integration_tests/__fixtures__/package.json deleted file mode 100644 index 1a9a446d524b..000000000000 --- a/src/dev/jest/integration_tests/__fixtures__/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "fixture", - "jest": { - "testMatch": [ - "**/test.js" - ], - "transform": { - "^.+\\.js$": "/../../babel_transform.js" - }, - "reporters": [ - ["/../../junit_reporter.js", {"rootDirectory": "."}] - ] - } -} diff --git a/src/dev/jest/integration_tests/junit_reporter.test.js b/src/dev/jest/integration_tests/junit_reporter.test.js deleted file mode 100644 index 25abcfb2c3b6..000000000000 --- a/src/dev/jest/integration_tests/junit_reporter.test.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import { resolve } from 'path'; -import { promisify } from 'util'; -import { readFileSync } from 'fs'; - -import del from 'del'; -import execa from 'execa'; -import xml2js from 'xml2js'; -import { getUniqueJunitReportPath } from '@osd/test'; - -const MINUTE = 1000 * 60; -const ROOT_DIR = resolve(__dirname, '../../../../'); -const FIXTURE_DIR = resolve(__dirname, '__fixtures__'); -const TARGET_DIR = resolve(FIXTURE_DIR, 'target'); -const XML_PATH = getUniqueJunitReportPath(FIXTURE_DIR, 'Jest Tests'); - -afterAll(async () => { - await del(TARGET_DIR); -}); - -const parseXml = promisify(xml2js.parseString); - -it( - 'produces a valid junit report for failures', - async () => { - const result = await execa( - process.execPath, - ['-r', require.resolve('../../../setup_node_env'), require.resolve('jest/bin/jest')], - { - cwd: FIXTURE_DIR, - env: { - CI: 'true', - }, - reject: false, - } - ); - - expect(result.exitCode).toBe(1); - await expect(parseXml(readFileSync(XML_PATH, 'utf8'))).resolves.toEqual({ - testsuites: { - $: { - name: 'jest', - skipped: '0', - tests: '1', - time: expect.anything(), - timestamp: expect.anything(), - }, - testsuite: [ - { - $: { - failures: '1', - file: resolve(ROOT_DIR, 'src/dev/jest/integration_tests/__fixtures__/test.js'), - name: 'test.js', - skipped: '0', - tests: '1', - time: expect.anything(), - timestamp: expect.anything(), - }, - testcase: [ - { - $: { - classname: 'Jest Tests.·', - name: 'fails', - time: expect.anything(), - }, - failure: [expect.stringMatching(/Error: failure\s+at /m)], - }, - ], - }, - ], - }, - }); - }, - 3 * MINUTE -); diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index 167c6ef7e753..2387fcec7116 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -57,6 +57,7 @@ export const IGNORE_FILE_GLOBS = [ 'Dockerfile*', 'vars/*', '.ci/pipeline-library/**/*', + 'packages/osd-test/jest-preset.js', // filename must match language code which requires capital letters '**/translations/*.json', diff --git a/src/dev/typescript/projects.ts b/src/dev/typescript/projects.ts index 96d1ddf9ef6b..d0560e82b22c 100644 --- a/src/dev/typescript/projects.ts +++ b/src/dev/typescript/projects.ts @@ -38,7 +38,6 @@ import { Project } from './project'; export const PROJECTS = [ new Project(resolve(REPO_ROOT, 'tsconfig.json')), new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'opensearch-dashboards/test' }), - new Project(resolve(REPO_ROOT, 'src/test_utils/tsconfig.json')), new Project(resolve(REPO_ROOT, 'src/core/tsconfig.json')), // NOTE: using glob.sync rather than glob-all or globby diff --git a/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx index 5265b5c439bb..1bbaf43333c3 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_footer/page_footer.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { PageFooter } from './page_footer'; diff --git a/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx index be4aa59a681e..bf538615b5d9 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_subtitle/page_subtitle.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { PageSubtitle } from './page_subtitle'; diff --git a/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx b/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx index 69aa97a875c9..1a22846d1857 100644 --- a/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx +++ b/src/plugins/advanced_settings/public/component_registry/page_title/page_title.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { PageTitle } from './page_title'; diff --git a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx index dd43e8f7faa0..9f935691b7d7 100644 --- a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { Observable } from 'rxjs'; import { ReactWrapper } from 'enzyme'; -import { mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { mountWithI18nProvider } from '@osd/test/jest'; import dedent from 'dedent'; import { PublicUiSettingsParams, diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx index 0522b889e868..830da2666b89 100644 --- a/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { I18nProvider } from '@osd/i18n/react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@osd/test/jest'; import { mount, ReactWrapper } from 'enzyme'; import { FieldSetting } from '../../types'; import { UiSettingsType, StringValidation } from '../../../../../../core/public'; diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.tsx index f1e4280a6ebd..89cf2a8ae0c1 100644 --- a/src/plugins/advanced_settings/public/management_app/components/field/field.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/field/field.tsx @@ -680,9 +680,7 @@ export class Field extends PureComponent { const isInvalid = unsavedChanges?.isInvalid; const className = classNames('mgtAdvancedSettings__field', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'mgtAdvancedSettings__field--unsaved': unsavedChanges, - // eslint-disable-next-line @typescript-eslint/naming-convention 'mgtAdvancedSettings__field--invalid': isInvalid, }); const groupId = `${setting.name}-group`; diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx index 500a58ab7d4f..696c92762f23 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@osd/test/jest'; import { UiSettingsType } from '../../../../../../core/public'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx index e15a63961ddb..b194906a6ae3 100644 --- a/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/search/search.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/bfetch/common/buffer/tests/create_batched_function.test.ts b/src/plugins/bfetch/common/buffer/tests/create_batched_function.test.ts index 539dcfbee567..58ac0640fdb9 100644 --- a/src/plugins/bfetch/common/buffer/tests/create_batched_function.test.ts +++ b/src/plugins/bfetch/common/buffer/tests/create_batched_function.test.ts @@ -79,7 +79,7 @@ describe('createBatchedFunction', () => { expect(onCall).toHaveBeenCalledWith(123); expect(onBatch).toHaveBeenCalledTimes(0); - await new Promise((r) => setTimeout(r, 15)); + await new Promise((r) => setTimeout(r, 15)); expect(onCall).toHaveBeenCalledTimes(1); expect(onBatch).toHaveBeenCalledTimes(1); diff --git a/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts b/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts index 467d86f62341..82600ac6c471 100644 --- a/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts +++ b/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts @@ -106,7 +106,7 @@ describe('createStreamingBatchedFunction()', () => { fn({ baz: 'quix' }); expect(fetchStreaming).toHaveBeenCalledTimes(0); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(fetchStreaming).toHaveBeenCalledTimes(1); }); @@ -120,7 +120,7 @@ describe('createStreamingBatchedFunction()', () => { }); expect(fetchStreaming).toHaveBeenCalledTimes(0); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(fetchStreaming).toHaveBeenCalledTimes(0); }); @@ -134,7 +134,7 @@ describe('createStreamingBatchedFunction()', () => { }); fn({ foo: 'bar' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(fetchStreaming.mock.calls[0][0]).toMatchObject({ url: '/test', @@ -154,7 +154,7 @@ describe('createStreamingBatchedFunction()', () => { fn({ foo: 'bar' }); fn({ baz: 'quix' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); const { body } = fetchStreaming.mock.calls[0][0]; expect(JSON.parse(body)).toEqual({ batch: [{ foo: 'bar' }, { baz: 'quix' }], @@ -218,7 +218,7 @@ describe('createStreamingBatchedFunction()', () => { fn({ c: '3' }); expect(fetchStreaming).toHaveBeenCalledTimes(1); fn({ d: '4' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(fetchStreaming).toHaveBeenCalledTimes(2); }); }); @@ -235,7 +235,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = fn({ a: '1' }); const promise2 = fn({ b: '2' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(await isPending(promise1)).toBe(true); expect(await isPending(promise2)).toBe(true); @@ -253,7 +253,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = fn({ a: '1' }); const promise2 = fn({ b: '2' }); const promise3 = fn({ c: '3' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(await isPending(promise1)).toBe(true); expect(await isPending(promise2)).toBe(true); @@ -294,7 +294,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = fn({ a: '1' }); const promise2 = fn({ b: '2' }); const promise3 = fn({ c: '3' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.next( JSON.stringify({ @@ -328,7 +328,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = fn({ a: '1' }); const promise2 = fn({ b: '2' }); const promise3 = fn({ c: '3' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.next( JSON.stringify({ @@ -367,7 +367,7 @@ describe('createStreamingBatchedFunction()', () => { }); const promise = fn({ a: '1' }); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); expect(await isPending(promise)).toBe(true); @@ -398,7 +398,7 @@ describe('createStreamingBatchedFunction()', () => { const promise2 = of(fn({ a: '2' })); const promise3 = of(fn({ a: '3' })); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.next( JSON.stringify({ @@ -407,7 +407,7 @@ describe('createStreamingBatchedFunction()', () => { }) + '\n' ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); stream.next( JSON.stringify({ @@ -416,7 +416,7 @@ describe('createStreamingBatchedFunction()', () => { }) + '\n' ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); stream.next( JSON.stringify({ @@ -425,7 +425,7 @@ describe('createStreamingBatchedFunction()', () => { }) + '\n' ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const [result1] = await promise1; const [, error2] = await promise2; @@ -449,11 +449,11 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = of(fn({ a: '1' })); const promise2 = of(fn({ a: '2' })); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.complete(); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const [, error1] = await promise1; const [, error2] = await promise2; @@ -479,7 +479,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = of(fn({ a: '1' })); const promise2 = of(fn({ a: '2' })); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.next( JSON.stringify({ @@ -489,7 +489,7 @@ describe('createStreamingBatchedFunction()', () => { ); stream.complete(); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const [, error1] = await promise1; const [result1] = await promise2; @@ -516,13 +516,13 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = of(fn({ a: '1' })); const promise2 = of(fn({ a: '2' })); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.error({ message: 'something went wrong', }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const [, error1] = await promise1; const [, error2] = await promise2; @@ -548,7 +548,7 @@ describe('createStreamingBatchedFunction()', () => { const promise1 = of(fn({ a: '1' })); const promise2 = of(fn({ a: '2' })); - await new Promise((r) => setTimeout(r, 6)); + await new Promise((r) => setTimeout(r, 6)); stream.next( JSON.stringify({ @@ -558,7 +558,7 @@ describe('createStreamingBatchedFunction()', () => { ); stream.error('oops'); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const [, error1] = await promise1; const [result1] = await promise2; diff --git a/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts b/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts index 685564566afe..c3c542d2a54f 100644 --- a/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts +++ b/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts @@ -33,7 +33,7 @@ import { fetchStreaming } from './fetch_streaming'; import { mockXMLHttpRequest } from '../test_helpers/xhr'; -const tick = () => new Promise((resolve) => setTimeout(resolve, 1)); +const tick = () => new Promise((resolve) => setTimeout(resolve, 1)); const setup = () => { const { xhr, XMLHttpRequest } = mockXMLHttpRequest(); diff --git a/src/plugins/charts/public/services/theme/theme.ts b/src/plugins/charts/public/services/theme/theme.ts index 3107d60ec2e7..d1d19814b6a3 100644 --- a/src/plugins/charts/public/services/theme/theme.ts +++ b/src/plugins/charts/public/services/theme/theme.ts @@ -63,10 +63,8 @@ export class ThemeService { /** A React hook for consuming the dark mode value */ public useDarkMode = (): boolean => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(false); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.darkModeEnabled$.subscribe(update); return () => s.unsubscribe(); @@ -77,10 +75,8 @@ export class ThemeService { /** A React hook for consuming the charts theme */ public useChartsTheme = (): PartialTheme => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(this.chartsDefaultTheme); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.chartsTheme$.subscribe(update); return () => s.unsubscribe(); @@ -91,10 +87,8 @@ export class ThemeService { /** A React hook for consuming the charts theme */ public useChartsBaseTheme = (): Theme => { - // eslint-disable-next-line react-hooks/rules-of-hooks const [value, update] = useState(this.chartsDefaultBaseTheme); - // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { const s = this.chartsBaseTheme$.subscribe(update); return () => s.unsubscribe(); diff --git a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx index 4562eef33b95..53c183d3a562 100644 --- a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx +++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.tsx @@ -40,7 +40,7 @@ import * as sinon from 'sinon'; import { serviceContextMock } from '../../../../contexts/services_context.mock'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { ServicesContextProvider, EditorContextProvider, diff --git a/src/plugins/console/public/application/hooks/use_send_current_request_to_opensearch/send_request_to_opensearch.ts b/src/plugins/console/public/application/hooks/use_send_current_request_to_opensearch/send_request_to_opensearch.ts index 309b36d13634..6c172884d0d8 100644 --- a/src/plugins/console/public/application/hooks/use_send_current_request_to_opensearch/send_request_to_opensearch.ts +++ b/src/plugins/console/public/application/hooks/use_send_current_request_to_opensearch/send_request_to_opensearch.ts @@ -65,7 +65,7 @@ export function sendRequestToOpenSearch( args: OpenSearchRequestArgs ): Promise { const requests = args.requests.slice(); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const reqId = ++CURRENT_REQ_ID; const results: OpenSearchRequestResult[] = []; if (reqId !== CURRENT_REQ_ID) { diff --git a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts index 5b0b6ef7bb24..15d091aad32f 100644 --- a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts +++ b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts @@ -87,7 +87,7 @@ export class LegacyCoreEditor implements CoreEditor { // dirty check for tokenizer state, uses a lot less cycles // than listening for tokenizerUpdate waitForLatestTokens(): Promise { - return new Promise((resolve) => { + return new Promise((resolve) => { const session = this.editor.getSession(); const checkInterval = 25; @@ -252,7 +252,7 @@ export class LegacyCoreEditor implements CoreEditor { private forceRetokenize() { const session = this.editor.getSession(); - return new Promise((resolve) => { + return new Promise((resolve) => { // force update of tokens, but not on this thread to allow for ace rendering. setTimeout(function () { let i; diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx index 61f771e37ab3..e77092b7bea8 100644 --- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx +++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen'; import { findTestSubject } from '@elastic/eui/lib/test'; import { coreMock } from '../../../../core/public/mocks'; diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx index 0a6bb452ec69..77783b120de2 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { isErrorEmbeddable, ViewMode } from '../../embeddable_plugin'; import { DashboardContainer, DashboardContainerOptions } from './dashboard_container'; import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers'; diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx index ae92d1c71ab0..fc764a8a878f 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx @@ -34,7 +34,7 @@ import sizeMe from 'react-sizeme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { skip } from 'rxjs/operators'; import { DashboardGrid, DashboardGridProps } from './dashboard_grid'; import { DashboardContainer, DashboardContainerOptions } from '../dashboard_container'; diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx index 23247512be64..b31444f622d0 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx @@ -269,9 +269,7 @@ class DashboardGridUi extends React.Component { expandedPanelId !== undefined && expandedPanelId === panel.explicitInput.id; const hidePanel = expandedPanelId !== undefined && expandedPanelId !== panel.explicitInput.id; const classes = classNames({ - // eslint-disable-next-line @typescript-eslint/naming-convention 'dshDashboardGrid__item--expanded': expandPanel, - // eslint-disable-next-line @typescript-eslint/naming-convention 'dshDashboardGrid__item--hidden': hidePanel, }); return ( diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx index 7682c0d79454..09f45842fbb9 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx @@ -35,7 +35,7 @@ import React from 'react'; import { skip } from 'rxjs/operators'; import { mount } from 'enzyme'; import { I18nProvider } from '@osd/i18n/react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { DashboardViewport, DashboardViewportProps } from './dashboard_viewport'; import { DashboardContainer, DashboardContainerOptions } from '../dashboard_container'; import { getSampleDashboardInput } from '../../test_helpers'; diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx index d8206db5c3cc..20e7a0adaa32 100644 --- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx @@ -33,7 +33,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import React from 'react'; import { mount } from 'enzyme'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { I18nProvider } from '@osd/i18n/react'; import { ViewMode, CONTEXT_MENU_TRIGGER, EmbeddablePanel } from '../../embeddable_plugin'; import { DashboardContainer, DashboardContainerOptions } from '../embeddable/dashboard_container'; diff --git a/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js b/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js index 1db9309bf0b9..7b077999ae7a 100644 --- a/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js +++ b/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js @@ -32,7 +32,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DashboardCloneModal } from './clone_modal'; diff --git a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js b/src/plugins/dashboard/public/application/top_nav/save_modal.test.js index 967fca8aefd6..a1ebefaa33a9 100644 --- a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js +++ b/src/plugins/dashboard/public/application/top_nav/save_modal.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; jest.mock('../../../../saved_objects/public', () => ({ SavedObjectSaveModal: () => null, diff --git a/src/plugins/data/common/search/search_source/legacy/fetch_soon.ts b/src/plugins/data/common/search/search_source/legacy/fetch_soon.ts index 225374e86971..d39c5885d839 100644 --- a/src/plugins/data/common/search/search_source/legacy/fetch_soon.ts +++ b/src/plugins/data/common/search/search_source/legacy/fetch_soon.ts @@ -57,7 +57,7 @@ export async function fetchSoon( * @return Promise A promise that resolves with the result of executing the function */ function delay(fn: (...args: any) => T, ms: number): Promise { - return new Promise((resolve) => { + return new Promise((resolve) => { setTimeout(() => resolve(fn()), ms); }); } diff --git a/src/plugins/data/public/actions/apply_filter_action.ts b/src/plugins/data/public/actions/apply_filter_action.ts index 0644bb7b7ec1..62e2bb5ad8b9 100644 --- a/src/plugins/data/public/actions/apply_filter_action.ts +++ b/src/plugins/data/public/actions/apply_filter_action.ts @@ -83,7 +83,7 @@ export function createFilterAction( }) ); - const filterSelectionPromise: Promise = new Promise((resolve) => { + const filterSelectionPromise: Promise = new Promise((resolve) => { const overlay = getOverlays().openModal( toMountPoint( applyFiltersPopover( diff --git a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx index 14b5659a2b14..2f036dd4fd0b 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx +++ b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx @@ -80,5 +80,5 @@ export const onRedirectNoIndexPattern = ( } // return never-resolving promise to stop resolving and wait for the url change - return new Promise(() => {}); + return new Promise(() => {}); }; diff --git a/src/plugins/data/public/query/query_string/query_string_manager.test.ts b/src/plugins/data/public/query/query_string/query_string_manager.test.ts index f34afbc83ef1..3a6d7181b293 100644 --- a/src/plugins/data/public/query/query_string/query_string_manager.test.ts +++ b/src/plugins/data/public/query/query_string/query_string_manager.test.ts @@ -32,7 +32,7 @@ import { QueryStringManager } from './query_string_manager'; import { Storage } from '../../../../opensearch_dashboards_utils/public/storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { coreMock } from '../../../../../core/public/mocks'; import { Query } from '../../../common/query'; diff --git a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts index b4325f4c7643..09cb5560b6ef 100644 --- a/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts +++ b/src/plugins/data/public/query/state_sync/connect_to_query_state.test.ts @@ -41,7 +41,7 @@ import { Storage, } from '../../../../opensearch_dashboards_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from '../../../../../test_utils/public/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { connectToQueryState } from './connect_to_query_state'; import { TimefilterContract } from '../timefilter'; import { QueryState } from './types'; diff --git a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts index e1fc8dd958fd..c0ff56dd63e9 100644 --- a/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts +++ b/src/plugins/data/public/query/state_sync/sync_state_with_url.test.ts @@ -42,7 +42,7 @@ import { Storage, } from '../../../../opensearch_dashboards_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { TimefilterContract } from '../timefilter'; import { syncQueryStateWithUrl } from './sync_state_with_url'; import { QueryState } from './types'; diff --git a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx b/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx index 8145e35d7bca..9ae72ec5b0ea 100644 --- a/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/language_switcher.test.tsx @@ -34,7 +34,7 @@ import React from 'react'; import { QueryLanguageSwitcher } from './language_switcher'; import { OpenSearchDashboardsContextProvider } from 'src/plugins/opensearch_dashboards_react/public'; import { coreMock } from '../../../../../core/public/mocks'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { EuiButtonEmpty, EuiPopover } from '@elastic/eui'; const startMock = coreMock.createStart(); diff --git a/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx b/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx index 357f3cbd5efb..a59adb6920ef 100644 --- a/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx +++ b/src/plugins/data/public/ui/query_string_input/no_data_popover.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@osd/test/jest'; import { NoDataPopover } from './no_data_popover'; import { EuiTourStep } from '@elastic/eui'; import { act } from 'react-dom/test-utils'; diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index c8a63d819e4a..0f7b8d2d848c 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -297,7 +297,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { }); const wrapperClasses = classNames('osdQueryBar__datePickerWrapper', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'osdQueryBar__datePickerWrapper-isHidden': isQueryInputFocused, }); diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx index fe3eda697ff6..854129e9d88a 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -427,7 +427,6 @@ class SearchBarUI extends Component { let filterBar; if (this.shouldRenderFilterBar()) { const filterGroupClasses = classNames('globalFilterGroup__wrapper', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'globalFilterGroup__wrapper-isVisible': this.state.isFiltersVisible, }); filterBar = ( diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx index 9a73d8734529..03b7d48dc4be 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { ShardFailureDescription } from './shard_failure_description'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; import { ShardFailure } from './shard_failure_types'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx index 1fb302aa4a07..c0d801ecb37a 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_modal.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { ShardFailureModal } from './shard_failure_modal'; import { shardFailureRequest } from './__mocks__/shard_failure_request'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx index 68b4878bfc09..b87ac9ed6224 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_open_modal_button.test.tsx @@ -31,7 +31,7 @@ */ import { openModal } from './shard_failure_open_modal_button.test.mocks'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import ShardFailureOpenModalButton from './shard_failure_open_modal_button'; import { shardFailureRequest } from './__mocks__/shard_failure_request'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; diff --git a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx index d5a6cf5ea281..054135672d7a 100644 --- a/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx +++ b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_table.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { ShardFailureTable } from './shard_failure_table'; import { shardFailureResponse } from './__mocks__/shard_failure_response'; import { ShardFailure } from './shard_failure_types'; diff --git a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx index 50c3d1b7bfdf..221ecd9ae635 100644 --- a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx +++ b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ActionBar, ActionBarProps } from './action_bar'; import { findTestSubject } from '@elastic/eui/lib/test'; import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../query_parameters/constants'; diff --git a/src/plugins/discover/public/application/angular/directives/no_results.test.js b/src/plugins/discover/public/application/angular/directives/no_results.test.js index 1761b9ebd28a..5e86683ae87a 100644 --- a/src/plugins/discover/public/application/angular/directives/no_results.test.js +++ b/src/plugins/discover/public/application/angular/directives/no_results.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@osd/test/jest'; import { DiscoverNoResults } from './no_results'; diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx index 7595d4e56bac..aec4f27385fa 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@osd/test/jest'; import { ToolBarPagerButtons } from './tool_bar_pager_buttons'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx index e03552cb146b..57f5c633fc25 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@osd/test/jest'; import { ToolBarPagerText } from './tool_bar_pager_text'; test('it renders ToolBarPagerText without crashing', () => { diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx index 0d926598e591..71af745a17f2 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { TableHeader } from './table_header'; import { findTestSubject } from '@elastic/eui/lib/test'; import { SortOrder } from './helpers'; diff --git a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx index 04c4e31a0ad7..ff0d4290bb44 100644 --- a/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx +++ b/src/plugins/discover/public/application/components/context_error_message/context_error_message.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { ContextErrorMessage } from './context_error_message'; // @ts-ignore diff --git a/src/plugins/discover/public/application/components/doc/doc.test.tsx b/src/plugins/discover/public/application/components/doc/doc.test.tsx index b6423086bc25..d8412e852a28 100644 --- a/src/plugins/discover/public/application/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -32,7 +32,7 @@ import { throwError, of } from 'rxjs'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; import { Doc, DocProps } from './doc'; @@ -73,7 +73,7 @@ beforeEach(() => { const waitForPromises = async () => act(async () => { - await new Promise((resolve) => setTimeout(resolve)); + await new Promise((resolve) => setTimeout(resolve)); }); /** diff --git a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx index 8702a973a00b..ef4aacc2c002 100644 --- a/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx +++ b/src/plugins/discover/public/application/components/hits_counter/hits_counter.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { HitsCounter, HitsCounterProps } from './hits_counter'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx index 4271b0c6551a..8b7cdf23fbe9 100644 --- a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx +++ b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { LoadingSpinner } from './loading_spinner'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx index b0ba2873fae9..085027f964b1 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx @@ -34,7 +34,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; // @ts-ignore import stubbedLogstashFields from 'fixtures/logstash_fields'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { DiscoverField } from './discover_field'; import { coreMock } from '../../../../../../core/public/mocks'; import { IndexPatternField } from '../../../../../data/public'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_details.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_details.test.tsx index a1d0bc2cca39..4a902d8fdfcf 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field_details.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_details.test.tsx @@ -34,7 +34,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; // @ts-ignore import stubbedLogstashFields from 'fixtures/logstash_fields'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { DiscoverFieldDetails } from './discover_field_details'; import { coreMock } from '../../../../../../core/public/mocks'; import { IndexPatternField } from '../../../../../data/public'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx index e7a396e90bf8..b4fd4b855cbf 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx @@ -31,7 +31,7 @@ */ import React, { EventHandler, MouseEvent as ReactMouseEvent } from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DiscoverFieldSearch, Props } from './discover_field_search'; import { EuiButtonGroupProps, EuiPopover } from '@elastic/eui'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx index 3404857e2b8c..c0d2dc0ff4aa 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl as shallow } from '@osd/test/jest'; // @ts-ignore import { ShallowWrapper } from 'enzyme'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx index 7efbda66b7aa..665fbb194e32 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx @@ -37,7 +37,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import realHits from 'fixtures/real_hits.js'; // @ts-ignore import stubbedLogstashFields from 'fixtures/logstash_fields'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import React from 'react'; import { DiscoverSidebar, DiscoverSidebarProps } from './discover_sidebar'; import { coreMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx b/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx index 7e58ce588190..b5055572795c 100644 --- a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx +++ b/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { SkipBottomButton, SkipBottomButtonProps } from './skip_bottom_button'; diff --git a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx index 0a64c9c11b63..7e95ad5b4bb2 100644 --- a/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx +++ b/src/plugins/discover/public/application/components/timechart_header/timechart_header.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { TimechartHeader, TimechartHeaderProps } from './timechart_header'; import { EuiIconTip } from '@elastic/eui'; diff --git a/src/plugins/embeddable/public/lib/containers/container.ts b/src/plugins/embeddable/public/lib/containers/container.ts index d72437bc57ae..0a1c62b84c22 100644 --- a/src/plugins/embeddable/public/lib/containers/container.ts +++ b/src/plugins/embeddable/public/lib/containers/container.ts @@ -178,7 +178,7 @@ export abstract class Container< return this.children[id] as TEmbeddable; } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const subscription = merge(this.getOutput$(), this.getInput$()).subscribe(() => { if (this.output.embeddableLoaded[id]) { subscription.unsubscribe(); diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index 8a2d4b8546bf..89f36efc14db 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { EmbeddableChildPanel } from './embeddable_child_panel'; import { CONTACT_CARD_EMBEDDABLE } from '../test_samples/embeddables/contact_card/contact_card_embeddable_factory'; import { SlowContactCardEmbeddableFactory } from '../test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory'; diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index b529a0634516..a111a8274435 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { I18nProvider } from '@osd/i18n/react'; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx index f509f89799fc..8feddc716eb6 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx @@ -40,7 +40,7 @@ import { import { HelloWorldContainer } from '../../../../test_samples/embeddables/hello_world_container'; import { ContactCardEmbeddable } from '../../../../test_samples/embeddables/contact_card/contact_card_embeddable'; import { ContainerInput } from '../../../../containers'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@osd/test/jest'; import { ReactWrapper } from 'enzyme'; import { coreMock } from '../../../../../../../../core/public/mocks'; import { findTestSubject } from '@elastic/eui/lib/test'; @@ -93,7 +93,7 @@ test('createNewEmbeddable() add embeddable to container', async () => { expect(Object.values(container.getInput().panels).length).toBe(0); component.instance().createNewEmbeddable(CONTACT_CARD_EMBEDDABLE); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); const ids = Object.keys(container.getInput().panels); const embeddableId = ids[0]; diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx index 921ba0f45781..550950ef6fa0 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/tests/saved_object_finder_create_new.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { SavedObjectFinderCreateNew } from '../saved_object_finder_create_new'; import { shallow } from 'enzyme'; import { EuiButton, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; describe('SavedObjectFinderCreateNew', () => { test('renders correctly with no items', () => { diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts index 815c499f8434..fedd7c966516 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts @@ -31,7 +31,7 @@ */ import { Container, isErrorEmbeddable } from '../../../..'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@osd/test/jest'; import { CustomizePanelTitleAction } from './customize_panel_action'; import { ContactCardEmbeddable, diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx index d927e1ffa1ef..994827755e36 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx @@ -142,7 +142,6 @@ export function PanelHeader({ const showPanelBar = !isViewMode || badges.length > 0 || notifications.length > 0 || showTitle || description; const classes = classNames('embPanel__header', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'embPanel__header--floater': !showPanelBar, }); const placeholderTitle = i18n.translate('embeddableApi.panel.placeholderTitle', { diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx index b79bba67d222..5bf29547685e 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx @@ -63,7 +63,7 @@ export class ContactCardEmbeddableFactory } public getExplicitInput = (): Promise> => { - return new Promise((resolve) => { + return new Promise>((resolve) => { const modalSession = this.overlays.openModal( toMountPoint( process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); expect(updateCount).toEqual(0); }); diff --git a/src/plugins/embeddable/public/tests/container.test.ts b/src/plugins/embeddable/public/tests/container.test.ts index c60f4fab4df6..eb08d7818434 100644 --- a/src/plugins/embeddable/public/tests/container.test.ts +++ b/src/plugins/embeddable/public/tests/container.test.ts @@ -536,7 +536,7 @@ test('Panel removed from input state', async () => { }; container.updateInput(newInput); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(container.getChild(embeddable.id)).toBeUndefined(); expect(container.getOutput().embeddableLoaded[embeddable.id]).toBeUndefined(); @@ -567,7 +567,7 @@ test('Panel added to input state', async () => { ); container2.updateInput(container.getInput()); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(container.getChild(embeddable.id)).toBeDefined(); expect(container.getOutput().embeddableLoaded[embeddable.id]).toBe(true); diff --git a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx index 12b88f71a43b..d8480f7363a2 100644 --- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -48,7 +48,7 @@ import { testPlugin } from './test_plugin'; import { CustomizePanelModal } from '../lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal'; import { EmbeddableStart } from '../plugin'; import { createEmbeddablePanelMock } from '../mocks'; -import { mountWithIntl } from '../../../../test_utils/public/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; let api: EmbeddableStart; let container: Container; diff --git a/src/plugins/expressions/common/execution/execution.test.ts b/src/plugins/expressions/common/execution/execution.test.ts index fbdbad8b315e..d346fa915136 100644 --- a/src/plugins/expressions/common/execution/execution.test.ts +++ b/src/plugins/expressions/common/execution/execution.test.ts @@ -277,9 +277,9 @@ describe('Execution', () => { expect(execution.state.get().result).toBe(undefined); execution.start(null); expect(execution.state.get().result).toBe(undefined); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(execution.state.get().result).toBe(undefined); - await new Promise((r) => setTimeout(r, 11)); + await new Promise((r) => setTimeout(r, 11)); expect(execution.state.get().result).toBe(null); }); }); diff --git a/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts b/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts index e7223a343e28..fdf85b2d8020 100644 --- a/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts +++ b/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts @@ -43,7 +43,7 @@ export const sleep: ExpressionFunctionDefinition<'sleep', any, { time: number }, }, help: '', fn: async (input, args, context) => { - await new Promise((r) => setTimeout(r, args.time)); + await new Promise((r) => setTimeout(r, args.time)); return input; }, }; diff --git a/src/plugins/home/public/application/components/add_data/add_data.test.tsx b/src/plugins/home/public/application/components/add_data/add_data.test.tsx index 5e3a9e976050..bc4c44b5c22c 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.test.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; jest.mock('../app_navigation_handler', () => { return { diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx index 70a82e76109f..ecdabae45e7b 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; jest.mock('../app_navigation_handler', () => { return { diff --git a/src/plugins/home/public/application/components/recently_accessed.test.js b/src/plugins/home/public/application/components/recently_accessed.test.js index c6a7458f4114..f6c6cfae0976 100644 --- a/src/plugins/home/public/application/components/recently_accessed.test.js +++ b/src/plugins/home/public/application/components/recently_accessed.test.js @@ -34,7 +34,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { RecentlyAccessed, NUM_LONG_LINKS } from './recently_accessed'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; const createRecentlyAccessed = (length) => { const recentlyAccessed = []; diff --git a/src/plugins/home/public/application/components/tutorial/instruction_set.test.js b/src/plugins/home/public/application/components/tutorial/instruction_set.test.js index 01d5250d36a2..7c477f106a1d 100644 --- a/src/plugins/home/public/application/components/tutorial/instruction_set.test.js +++ b/src/plugins/home/public/application/components/tutorial/instruction_set.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { InstructionSet } from './instruction_set'; import * as StatusCheckStates from './status_check_states'; diff --git a/src/plugins/home/public/application/components/tutorial/introduction.test.js b/src/plugins/home/public/application/components/tutorial/introduction.test.js index b1b701b18b56..ff3e42b824b4 100644 --- a/src/plugins/home/public/application/components/tutorial/introduction.test.js +++ b/src/plugins/home/public/application/components/tutorial/introduction.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { Introduction } from './introduction'; diff --git a/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js b/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js index 09fe269bad4a..359961681528 100644 --- a/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js +++ b/src/plugins/home/public/application/components/tutorial/saved_objects_installer.test.js @@ -32,7 +32,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@osd/test/jest'; import { SavedObjectsInstaller } from './saved_objects_installer'; diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.test.js b/src/plugins/home/public/application/components/tutorial/tutorial.test.js index e03fd5fc077b..16ca2118e14b 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.test.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@osd/test/jest'; import { Tutorial } from './tutorial'; diff --git a/src/plugins/home/server/services/sample_data/lib/load_data.ts b/src/plugins/home/server/services/sample_data/lib/load_data.ts index f958f9748948..ecfbcf695e23 100644 --- a/src/plugins/home/server/services/sample_data/lib/load_data.ts +++ b/src/plugins/home/server/services/sample_data/lib/load_data.ts @@ -37,7 +37,7 @@ import { createUnzip } from 'zlib'; const BULK_INSERT_SIZE = 500; export function loadData(path: any, bulkInsert: (docs: any[]) => Promise) { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let count: number = 0; let docs: any[] = []; let isPaused: boolean = false; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx index 376ccfca6f56..d2824696a0df 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/header/header.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { Header } from '../header'; import { mount } from 'enzyme'; -import { wrapWithIntl } from 'test_utils/enzyme_helpers'; +import { wrapWithIntl } from '@osd/test/jest'; import { OpenSearchDashboardsContextProvider } from 'src/plugins/opensearch_dashboards_react/public'; import { mockManagementPlugin } from '../../../../mocks'; import { DocLinksStart } from 'opensearch-dashboards/public'; diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx index 0201e56f0d1c..80d753294941 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/components/header/header.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { Header } from '../header'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; describe('Header', () => { it('should render normally', () => { diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx index aea1959686cb..d8398df45a15 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.test.tsx @@ -101,7 +101,7 @@ describe('StepIndexPattern', () => { ); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected await component.update(); @@ -125,7 +125,7 @@ describe('StepIndexPattern', () => { instance.onQueryChanged({ target: { value: '?' } } as React.ChangeEvent); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); expect({ @@ -148,7 +148,7 @@ describe('StepIndexPattern', () => { instance.onQueryChanged({ target: { value: 'o' } } as React.ChangeEvent); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -202,7 +202,7 @@ describe('StepIndexPattern', () => { const instance = component.instance() as StepIndexPattern; instance.onQueryChanged({ target: { value: 'o' } } as React.ChangeEvent); instance.lastQuery = 'o'; - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Honesty, the state would match the result of the `k` query but // it's hard to mock this in tests but if remove our fix @@ -217,7 +217,7 @@ describe('StepIndexPattern', () => { target: { value: 'opensearch' }, } as React.ChangeEvent); instance.lastQuery = 'o'; - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); expect(component.state('exactMatchedIndices')).toEqual([]); }); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx index 6abea82606fe..12f6fb3ad92a 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/advanced_options/advanced_options.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { AdvancedOptions } from '../advanced_options'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; describe('AdvancedOptions', () => { it('should render normally', () => { diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx index 2f7163194a76..9b36c187ffa7 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { TimeField } from '../time_field'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; describe('TimeField', () => { it('should render normally', () => { diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts index d85b24392fdb..47a67eb55016 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/lib/ensure_minimum_time.ts @@ -66,7 +66,7 @@ export async function ensureMinimumTime( if (asyncActionDuration < bufferedMinimumTimeMs) { const additionalWaitingTime = bufferedMinimumTimeMs - (asyncActionCompletionTime - asyncActionStartTime); - await new Promise((resolve) => setTimeout(resolve, additionalWaitingTime)); + await new Promise((resolve) => setTimeout(resolve, additionalWaitingTime)); } return returnValue; diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx index e7fd10788e14..faf915b48115 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/indexed_fields_table/indexed_fields_table.test.tsx @@ -92,7 +92,7 @@ describe('IndexedFieldsTable', () => { /> ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); @@ -112,7 +112,7 @@ describe('IndexedFieldsTable', () => { /> ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.setProps({ fieldFilter: 'Elast' }); component.update(); @@ -133,7 +133,7 @@ describe('IndexedFieldsTable', () => { /> ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.setProps({ indexedFieldTypeFilter: 'date' }); component.update(); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx index 6cd734d25993..3664fb77c84c 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@osd/test/jest'; import { RouteComponentProps } from 'react-router-dom'; import { ScopedHistory } from 'opensearch-dashboards/public'; import { scopedHistoryMock } from '../../../../../../../../core/public/mocks'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx index d6a92ee4b23a..9e040762ae49 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/color/color.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { FieldFormat } from 'src/plugins/data/public'; import { ColorFormatEditor } from './color'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx index 9ff6f85045c6..0a490ff9351f 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '../../../../../../../../../test_utils/public/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { StaticLookupFormatEditorFormatParams } from './static_lookup'; import { FieldFormat } from '../../../../../../../../data/public'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx index 65e00beae65d..875898564d3d 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/label_template_flyout.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { LabelTemplateFlyout } from './label_template_flyout'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx index 3952801378f9..226f09ab344e 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/url/url_template_flyout.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { UrlTemplateFlyout } from './url_template_flyout'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx index eab748647719..1ee6471b9363 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/samples/samples.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { FormatEditorSamples } from './samples'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx index 326da8cd45d1..e90aeb1c652f 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { wrapWithIntl } from 'test_utils/enzyme_helpers'; +import { wrapWithIntl } from '@osd/test/jest'; import { OpenSearchDashboardsContextProvider } from 'src/plugins/opensearch_dashboards_react/public'; import { mockManagementPlugin } from '../../../../mocks'; import { ScriptingWarningCallOut } from './warning_call_out'; diff --git a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx index 7c29a7416868..fdcb9f042946 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx @@ -143,7 +143,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -172,7 +172,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -202,7 +202,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -219,7 +219,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); (component.instance() as FieldEditor).onFieldChange('name', 'foobar'); component.update(); expect(component).toMatchSnapshot(); @@ -244,7 +244,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); (component.instance() as FieldEditor).onFieldChange('name', 'foobar'); component.update(); expect(component).toMatchSnapshot(); diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx index b6d1cb3bdd43..6c7fd2ced903 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { EmptyIndexPatternPrompt } from '../empty_index_pattern_prompt'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; describe('EmptyIndexPatternPrompt', () => { it('should render normally', () => { diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx index 1be99ee025e6..30681d6c1807 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.test.tsx @@ -35,7 +35,7 @@ import { EmptyState } from '../empty_state'; import { shallow } from 'enzyme'; import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { docLinksServiceMock } from '../../../../../../core/public/mocks'; import { MlCardState } from '../../../types'; diff --git a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx index 8ddc41ab52f8..2f822246f6dc 100644 --- a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { getDepsMock, getIndexPatternMock } from '../../test_utils'; import { ControlsTab, ControlsTabUiProps } from './controls_tab'; diff --git a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx index c2a7e9110a2a..1c649cb65e31 100644 --- a/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx @@ -36,7 +36,7 @@ import { shallow } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@osd/test/jest'; import { getIndexPatternMock } from '../../test_utils/get_index_pattern_mock'; import { ListControlEditor } from './list_control_editor'; import { ControlParams } from '../../editor_utils'; diff --git a/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx index c62b0681a55e..15a2b1e0dd6d 100644 --- a/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/options_tab.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { Vis } from '../../../../visualizations/public'; import { OptionsTab, OptionsTabProps } from './options_tab'; diff --git a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx index 4ae727212308..1ecb467c73e6 100644 --- a/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx +++ b/src/plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { SinonSpy, spy, assert } from 'sinon'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx index 08138b3af0e8..e2a0c8f34d1b 100644 --- a/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/input_control_vis.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { InputControlVis } from './input_control_vis'; diff --git a/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx b/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx index 1a81e674221e..23eb5b94ea12 100644 --- a/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/list_control.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { ListControl } from './list_control'; diff --git a/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx b/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx index 65e838063d96..cec100562501 100644 --- a/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx +++ b/src/plugins/input_control_vis/public/components/vis/range_control.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { RangeControl, ceilWithPrecision, floorWithPrecision } from './range_control'; import { RangeControl as RangeControlClass } from '../../control/range_control_factory'; diff --git a/src/plugins/input_control_vis/public/test_utils/update_component.ts b/src/plugins/input_control_vis/public/test_utils/update_component.ts index b19ddb25f557..0c905712b1fd 100644 --- a/src/plugins/input_control_vis/public/test_utils/update_component.ts +++ b/src/plugins/input_control_vis/public/test_utils/update_component.ts @@ -38,7 +38,7 @@ export const updateComponent = async ( | ReactWrapper, React.Component<{}, {}, any>> ) => { // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); }; diff --git a/src/plugins/inspector/public/ui/inspector_panel.test.tsx b/src/plugins/inspector/public/ui/inspector_panel.test.tsx index bb385d42ced9..ab31d61db552 100644 --- a/src/plugins/inspector/public/ui/inspector_panel.test.tsx +++ b/src/plugins/inspector/public/ui/inspector_panel.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { InspectorPanel } from './inspector_panel'; import { InspectorViewDescription } from '../types'; import { Adapters } from '../../common'; diff --git a/src/plugins/inspector/public/views/data/components/data_view.test.tsx b/src/plugins/inspector/public/views/data/components/data_view.test.tsx index 496e34b726e7..6c3cb5012f22 100644 --- a/src/plugins/inspector/public/views/data/components/data_view.test.tsx +++ b/src/plugins/inspector/public/views/data/components/data_view.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { getDataViewDescription } from '../index'; import { DataAdapter } from '../../../../common/adapters/data'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { IUiSettingsClient } from '../../../../../../core/public'; jest.mock('../lib/export_csv', () => ({ diff --git a/src/plugins/maps_legacy/public/get_service_settings.ts b/src/plugins/maps_legacy/public/get_service_settings.ts index 84ffb339639f..8fa21c2c87a2 100644 --- a/src/plugins/maps_legacy/public/get_service_settings.ts +++ b/src/plugins/maps_legacy/public/get_service_settings.ts @@ -42,7 +42,7 @@ export async function getServiceSettings(): Promise { return loadPromise; } - loadPromise = new Promise(async (resolve) => { + loadPromise = new Promise(async (resolve) => { const modules = await lazyLoadMapsLegacyModules(); const config = getMapsLegacyConfig(); // @ts-expect-error diff --git a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts index c4da50a660d0..d2d9ccd75ad7 100644 --- a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts +++ b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts @@ -43,7 +43,7 @@ export async function lazyLoadMapsLegacyModules(): Promise { + loadModulesPromise = new Promise(async (resolve) => { const { OpenSearchDashboardsMap, L, ServiceSettings } = await import('./lazy'); resolve({ diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx index ebe57bfb0314..3a0fc7e66471 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx @@ -36,7 +36,7 @@ import { act } from 'react-dom/test-utils'; import { MountPoint } from 'opensearch-dashboards/public'; import { TopNavMenu } from './top_nav_menu'; import { TopNavMenuData } from './top_nav_menu_data'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@osd/test/jest'; const dataShim = { ui: { diff --git a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx index 1c6343d1b0fc..7a4236ca127f 100644 --- a/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx +++ b/src/plugins/navigation/public/top_nav_menu/top_nav_menu_item.test.tsx @@ -33,7 +33,7 @@ import React from 'react'; import { TopNavMenuItem } from './top_nav_menu_item'; import { TopNavMenuData } from './top_nav_menu_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; describe('TopNavMenu', () => { const ensureMenuItemDisabled = (data: TopNavMenuData) => { diff --git a/src/plugins/opensearch_dashboards_overview/public/components/add_data/add_data.test.tsx b/src/plugins/opensearch_dashboards_overview/public/components/add_data/add_data.test.tsx index 0c032ddb9af6..b2d53d7a6491 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/add_data/add_data.test.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/add_data/add_data.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/getting_started.test.tsx b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/getting_started.test.tsx index a37143900a04..bf05a9299ed9 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/getting_started.test.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/getting_started.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { GettingStarted } from './getting_started'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); diff --git a/src/plugins/opensearch_dashboards_overview/public/components/manage_data/manage_data.test.tsx b/src/plugins/opensearch_dashboards_overview/public/components/manage_data/manage_data.test.tsx index 42869e9ab215..b02efc31760d 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/manage_data/manage_data.test.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/manage_data/manage_data.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/opensearch_dashboards_overview/public/components/news_feed/news_feed.test.tsx b/src/plugins/opensearch_dashboards_overview/public/components/news_feed/news_feed.test.tsx index 0102cadec0d3..a53789801f67 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/news_feed/news_feed.test.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/news_feed/news_feed.test.tsx @@ -33,7 +33,7 @@ import moment from 'moment'; import React from 'react'; import { NewsFeed } from './news_feed'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; const mockNewsFetchResult = { error: null, diff --git a/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.test.tsx b/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.test.tsx index 5b212508a26f..2849ea48d9b0 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.test.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.test.tsx @@ -33,7 +33,7 @@ import moment from 'moment'; import React from 'react'; import { Overview } from './overview'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; jest.mock('../../../../../../src/plugins/opensearch_dashboards_react/public', () => ({ diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx index 9867d19f3884..c754174f33f9 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { OverviewPageFooter } from './overview_page_footer'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; jest.mock('../../app_links', () => ({ RedirectAppLinks: jest.fn((element: JSX.Element) => element), diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx index 82bda6ca0ed1..b38fccf567e4 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { OverviewPageHeader } from './overview_page_header'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; jest.mock('../../app_links', () => ({ RedirectAppLinks: jest.fn((element: JSX.Element) => element), diff --git a/src/plugins/opensearch_dashboards_react/public/use_url_tracker/use_url_tracker.test.tsx b/src/plugins/opensearch_dashboards_react/public/use_url_tracker/use_url_tracker.test.tsx index 58d5cae11185..260b82f5e8f0 100644 --- a/src/plugins/opensearch_dashboards_react/public/use_url_tracker/use_url_tracker.test.tsx +++ b/src/plugins/opensearch_dashboards_react/public/use_url_tracker/use_url_tracker.test.tsx @@ -32,7 +32,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { useUrlTracker } from './use_url_tracker'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { createMemoryHistory } from 'history'; describe('useUrlTracker', () => { diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts index 39d20a13a24c..59bb757d949a 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts @@ -75,7 +75,6 @@ export const stackManagementSchema: MakeSchemaFrom = { 'notifications:lifetime:error': { type: 'long' }, 'doc_table:highlight': { type: 'boolean' }, 'discover:searchOnPageLoad': { type: 'boolean' }, - // eslint-disable-next-line @typescript-eslint/naming-convention 'doc_table:hideTimeColumn': { type: 'boolean' }, 'discover:sampleSize': { type: 'long' }, defaultColumns: { type: 'keyword' }, // it's an array diff --git a/src/plugins/opensearch_dashboards_utils/common/defer.test.ts b/src/plugins/opensearch_dashboards_utils/common/defer.test.ts index 7193a6c41b67..d45ad3a6e905 100644 --- a/src/plugins/opensearch_dashboards_utils/common/defer.test.ts +++ b/src/plugins/opensearch_dashboards_utils/common/defer.test.ts @@ -32,7 +32,7 @@ import { Defer } from './defer'; -const tick = () => new Promise((resolve) => setTimeout(resolve, 1)); +const tick = () => new Promise((resolve) => setTimeout(resolve, 1)); describe('new Defer()', () => { test('has .promise Promise object', () => { diff --git a/src/plugins/opensearch_dashboards_utils/common/of.test.ts b/src/plugins/opensearch_dashboards_utils/common/of.test.ts index 7bd42d3872b9..9454841750f1 100644 --- a/src/plugins/opensearch_dashboards_utils/common/of.test.ts +++ b/src/plugins/opensearch_dashboards_utils/common/of.test.ts @@ -34,7 +34,7 @@ import { of } from './of'; describe('of()', () => { describe('when promise resolves', () => { - const promise = new Promise((resolve) => resolve()).then(() => 123); + const promise = new Promise((resolve) => resolve()).then(() => 123); test('first member of 3-tuple is the promise value', async () => { const [result] = await of(promise); @@ -53,7 +53,7 @@ describe('of()', () => { }); describe('when promise rejects', () => { - const promise = new Promise((resolve) => resolve()).then(() => { + const promise = new Promise((resolve) => resolve()).then(() => { // eslint-disable-next-line no-throw-literal throw 123; }); diff --git a/src/plugins/opensearch_dashboards_utils/common/state_containers/create_state_container_react_helpers.test.tsx b/src/plugins/opensearch_dashboards_utils/common/state_containers/create_state_container_react_helpers.test.tsx index 092f29c88704..cba36f112973 100644 --- a/src/plugins/opensearch_dashboards_utils/common/state_containers/create_state_container_react_helpers.test.tsx +++ b/src/plugins/opensearch_dashboards_utils/common/state_containers/create_state_container_react_helpers.test.tsx @@ -110,11 +110,9 @@ test('context receives stateContainer', () => { const { Provider, context } = createStateContainerReactHelpers(); ReactDOM.render( - /* eslint-disable no-shadow */ - {(stateContainer) => stateContainer.get().foo} + {(s: typeof stateContainer) => s.get().foo} , - /* eslint-enable no-shadow */ container ); @@ -129,7 +127,7 @@ describe('hooks', () => { const stateContainer = createStateContainer({ foo: 'bar' }); const { Provider, useContainer } = createStateContainerReactHelpers(); const Demo: React.FC<{}> = () => { - // eslint-disable-next-line no-shadow + // eslint-disable-next-line @typescript-eslint/no-shadow const stateContainer = useContainer(); return <>{stateContainer.get().foo}; }; @@ -318,21 +316,21 @@ describe('hooks', () => { container ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); act(() => { stateContainer.set({ a: 'c', foo: 'bar' }); }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); act(() => { stateContainer.set({ a: 'd', foo: 'bar 2' }); }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(2); }); @@ -354,21 +352,21 @@ describe('hooks', () => { container ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); act(() => { stateContainer.set({ foo: { bar: 'baz' } }); }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); act(() => { stateContainer.set({ foo: { bar: 'qux' } }); }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(2); }); @@ -396,14 +394,14 @@ describe('hooks', () => { container ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); act(() => { stateContainer.set({ foo: { bar: 'baz' } }); }); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(cnt).toBe(1); }); diff --git a/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts b/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts index 91149c4cad03..3d2c94e1a4c7 100644 --- a/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts +++ b/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts @@ -38,7 +38,7 @@ import { INullableBaseStateContainer, } from '../../public/state_sync'; -const tick = () => new Promise((resolve) => setTimeout(resolve)); +const tick = () => new Promise((resolve) => setTimeout(resolve)); const stateContainer = createStateContainer(defaultState, pureTransitions); const { start, stop } = syncState({ @@ -69,9 +69,9 @@ export const result = Promise.resolve() }); function withDefaultState( - // eslint-disable-next-line no-shadow + // eslint-disable-next-line @typescript-eslint/no-shadow stateContainer: BaseStateContainer, - // eslint-disable-next-line no-shadow + // eslint-disable-next-line @typescript-eslint/no-shadow defaultState: State ): INullableBaseStateContainer { return { diff --git a/src/plugins/opensearch_dashboards_utils/public/core/create_start_service_getter.test.ts b/src/plugins/opensearch_dashboards_utils/public/core/create_start_service_getter.test.ts index b01316463d34..d0bcd7a0b13d 100644 --- a/src/plugins/opensearch_dashboards_utils/public/core/create_start_service_getter.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/core/create_start_service_getter.test.ts @@ -40,7 +40,7 @@ describe('createStartServicesGetter', () => { const accessor: StartServicesAccessor = async () => await future.promise; const start = createStartServicesGetter(accessor); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(() => start()).toThrowErrorMatchingInlineSnapshot( `"Trying to access start services before start."` @@ -55,14 +55,14 @@ describe('createStartServicesGetter', () => { const accessor: StartServicesAccessor = async () => await future.promise; const start = createStartServicesGetter(accessor); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); expect(() => start()).toThrow(); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); future.resolve([core, plugins, self]); await future.promise; - await new Promise((r) => process.nextTick(r)); // Allow the current event loop to finish + await new Promise((r) => process.nextTick(r)); // Allow the current event loop to finish expect(start()).toEqual({ core, @@ -79,10 +79,10 @@ describe('createStartServicesGetter', () => { const accessor: StartServicesAccessor = async () => await future.promise; const start = createStartServicesGetter(accessor); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); future.resolve([core, plugins, self]); await future.promise; - await new Promise((r) => process.nextTick(r)); // Allow the current event loop to finish + await new Promise((r) => process.nextTick(r)); // Allow the current event loop to finish expect(start()).toEqual({ core, diff --git a/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.test.ts b/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.test.ts index bd56587ebc6f..c0bb6153356b 100644 --- a/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/state_management/url/osd_url_tracker.test.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { createMemoryHistory, History } from 'history'; import { createOsdUrlTracker, OsdUrlTracker } from './osd_url_tracker'; import { BehaviorSubject, Subject } from 'rxjs'; diff --git a/src/plugins/opensearch_dashboards_utils/public/state_management/url/url_tracker.test.ts b/src/plugins/opensearch_dashboards_utils/public/state_management/url/url_tracker.test.ts index 57a339c0ca12..ce7599d75df9 100644 --- a/src/plugins/opensearch_dashboards_utils/public/state_management/url/url_tracker.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/state_management/url/url_tracker.test.ts @@ -31,7 +31,7 @@ */ import { createUrlTracker, IUrlTracker } from './url_tracker'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { createMemoryHistory, History } from 'history'; describe('urlTracker', () => { diff --git a/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync.test.ts b/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync.test.ts index 56e8d5b8f8e9..dc247dfd2427 100644 --- a/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync.test.ts @@ -46,7 +46,7 @@ import { IOsdUrlStateStorage, ISessionStorageStateStorage, } from './state_sync_state_storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { createBrowserHistory, History } from 'history'; import { INullableBaseStateContainer } from './types'; @@ -197,7 +197,7 @@ describe('state_sync', () => { let history: History; let urlSyncStrategy: IOsdUrlStateStorage; const getCurrentUrl = () => history.createHref(history.location); - const tick = () => new Promise((resolve) => setTimeout(resolve)); + const tick = () => new Promise((resolve) => setTimeout(resolve)); beforeEach(() => { container.set(defaultState); @@ -367,7 +367,7 @@ describe('state_sync', () => { function withDefaultState( stateContainer: BaseStateContainer, - // eslint-disable-next-line no-shadow + // eslint-disable-next-line @typescript-eslint/no-shadow defaultState: State ): INullableBaseStateContainer { return { diff --git a/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts b/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts index 125b8b0cbc22..49c20e541de1 100644 --- a/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts @@ -34,7 +34,7 @@ import { createSessionStorageStateStorage, ISessionStorageStateStorage, } from './create_session_storage_state_storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; describe('SessionStorageStateStorage', () => { let browserStorage: StubBrowserStorage; diff --git a/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/hashed_item_store.test.ts b/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/hashed_item_store.test.ts index 607a6fc3c13c..3b28a02979a3 100644 --- a/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/hashed_item_store.test.ts +++ b/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/hashed_item_store.test.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { HashedItemStore } from './hashed_item_store'; describe('hashedItemStore', () => { diff --git a/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/mock.ts b/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/mock.ts index 58c5c6212226..8fc2b93d23b3 100644 --- a/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/mock.ts +++ b/src/plugins/opensearch_dashboards_utils/public/storage/hashed_item_store/mock.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@osd/test/jest'; import { HashedItemStore } from './hashed_item_store'; /** diff --git a/src/plugins/opensearch_dashboards_utils/tsconfig.json b/src/plugins/opensearch_dashboards_utils/tsconfig.json index bd65e06c7860..ae5e9b90af80 100644 --- a/src/plugins/opensearch_dashboards_utils/tsconfig.json +++ b/src/plugins/opensearch_dashboards_utils/tsconfig.json @@ -16,7 +16,6 @@ "../../../typings/**/*" ], "references": [ - { "path": "../../test_utils/tsconfig.json" }, { "path": "../../core/tsconfig.json" } ] } diff --git a/src/plugins/opensearch_ui_shared/public/request/use_request.test.helpers.tsx b/src/plugins/opensearch_ui_shared/public/request/use_request.test.helpers.tsx index f8837e72afb0..5c3127c82f0f 100644 --- a/src/plugins/opensearch_ui_shared/public/request/use_request.test.helpers.tsx +++ b/src/plugins/opensearch_ui_shared/public/request/use_request.test.helpers.tsx @@ -104,7 +104,7 @@ export const createUseRequestHelpers = (): UseRequestHelpers => { const httpClient = { post: (path: string, options: HttpFetchOptions) => { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { // Increase the time it takes to resolve a request so we have time to inspect the hook // as it goes through various states. setTimeout(() => { diff --git a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts index 18aca457d341..fe5e0749f873 100644 --- a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts +++ b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts @@ -131,6 +131,7 @@ export const useField = ( }; const formatInputValue = useCallback( + // eslint-disable-next-line @typescript-eslint/no-shadow (inputValue: unknown): T => { const isEmptyString = typeof inputValue === 'string' && inputValue.trim() === ''; diff --git a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts index db06f3a0524d..ac0a56445e86 100644 --- a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts +++ b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts @@ -193,7 +193,7 @@ export function useForm( return; } - return new Promise((resolve) => { + return new Promise((resolve) => { setTimeout(() => { areSomeFieldValidating = fieldsToArray().some((field) => field.isValidating); if (areSomeFieldValidating) { diff --git a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/shared_imports.ts b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/shared_imports.ts index 69481aafda58..b1442b7d636e 100644 --- a/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/shared_imports.ts +++ b/src/plugins/opensearch_ui_shared/static/forms/hook_form_lib/shared_imports.ts @@ -30,6 +30,6 @@ * GitHub history for details. */ -export { registerTestBed, TestBed } from '../../../../../test_utils/public/testbed'; +export { registerTestBed, TestBed } from '@osd/test/jest'; -export { getRandomString } from '../../../../../test_utils/public/helpers'; +export { getRandomString } from '@osd/test/jest'; diff --git a/src/plugins/saved_objects/public/finder/saved_object_finder.test.tsx b/src/plugins/saved_objects/public/finder/saved_object_finder.test.tsx index 2918583d77fc..c87312427d87 100644 --- a/src/plugins/saved_objects/public/finder/saved_object_finder.test.tsx +++ b/src/plugins/saved_objects/public/finder/saved_object_finder.test.tsx @@ -34,7 +34,7 @@ jest.mock('lodash', () => ({ debounce: (fn: any) => fn, })); -const nextTick = () => new Promise((res) => process.nextTick(res)); +const nextTick = () => new Promise((res) => process.nextTick(res)); import { EuiEmptyPrompt, diff --git a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx index 85e543d9aae9..d8b803973105 100644 --- a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx +++ b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal.test.tsx @@ -33,7 +33,7 @@ import { shallow } from 'enzyme'; import React from 'react'; import { SavedObjectSaveModal } from './saved_object_save_modal'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; describe('SavedObjectSaveModal', () => { it('should render matching snapshot', () => { diff --git a/src/plugins/saved_objects_management/public/lib/import_legacy_file.ts b/src/plugins/saved_objects_management/public/lib/import_legacy_file.ts index 7a111a43876e..5994233e6c45 100644 --- a/src/plugins/saved_objects_management/public/lib/import_legacy_file.ts +++ b/src/plugins/saved_objects_management/public/lib/import_legacy_file.ts @@ -31,7 +31,7 @@ */ export async function importLegacyFile(file: File) { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const fr = new FileReader(); fr.onload = (event) => { const result = event.target!.result as string; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx index 7775689f172d..ecf83e4625f2 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.test.tsx @@ -41,7 +41,7 @@ import { } from './flyout.test.mocks'; import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { coreMock } from '../../../../../../core/public/mocks'; import { serviceRegistryMock } from '../../../services/service_registry.mock'; import { Flyout, FlyoutProps, FlyoutState } from './flyout'; @@ -94,7 +94,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -105,7 +105,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -133,7 +133,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -187,7 +187,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -225,7 +225,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -245,7 +245,7 @@ describe('Flyout', () => { .find('EuiButton[data-test-subj="importSavedObjectsConfirmBtn"]') .simulate('click'); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); expect(resolveImportErrorsMock).toMatchSnapshot(); }); }); @@ -351,7 +351,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -406,7 +406,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -426,7 +426,7 @@ describe('Flyout', () => { .find('EuiButton[data-test-subj="importSavedObjectsConfirmBtn"]') .simulate('click'); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); expect(resolveIndexPatternConflictsMock).toHaveBeenCalledWith( component.instance().resolutions, mockConflictedIndexPatterns, @@ -452,7 +452,7 @@ describe('Flyout', () => { const component = shallowRender(defaultProps); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -471,7 +471,7 @@ describe('Flyout', () => { .find('EuiButton[data-test-subj="importSavedObjectsConfirmBtn"]') .simulate('click'); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); expect(component.state('error')).toMatchInlineSnapshot( `"The file could not be processed due to error: \\"foobar\\""` diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx index a4e7dadb10b7..efcdd122c208 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { shallowWithI18nProvider, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithIntl } from '@osd/test/jest'; import { ImportModeControl, ImportModeControlProps } from './import_mode_control'; describe('ImportModeControl', () => { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx index cbe1bbcded23..ccfdb0532243 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { ImportSummary, ImportSummaryProps } from './import_summary'; import { FailedImport } from '../../../lib'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx index 1b2b9863bca7..edd7c1afc838 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithIntl } from '@osd/test/jest'; import { OverwriteModalProps, OverwriteModal } from './overwrite_modal'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index 9e0ebbc8d01e..0ce24a91c1de 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { httpServiceMock } from '../../../../../../core/public/mocks'; import { Relationships, RelationshipsProps } from './relationships'; @@ -103,7 +103,7 @@ describe('Relationships', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -170,7 +170,7 @@ describe('Relationships', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -237,7 +237,7 @@ describe('Relationships', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -304,7 +304,7 @@ describe('Relationships', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -341,7 +341,7 @@ describe('Relationships', () => { const component = shallowWithI18nProvider(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -410,7 +410,7 @@ describe('Relationships from legacy app', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -477,7 +477,7 @@ describe('Relationships from legacy app', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -544,7 +544,7 @@ describe('Relationships from legacy app', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -611,7 +611,7 @@ describe('Relationships from legacy app', () => { expect(component.find('EuiLoadingSpinner').length).toBe(1); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -648,7 +648,7 @@ describe('Relationships from legacy app', () => { const component = shallowWithI18nProvider(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index d2a0d2997ec3..ea8ccd326939 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@osd/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { keys } from '@elastic/eui'; import { httpServiceMock } from '../../../../../../core/public/mocks'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 6cca250b82fb..80382e56dd2a 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -43,7 +43,7 @@ import { import React from 'react'; import { Query } from '@elastic/eui'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@osd/test/jest'; import { httpServiceMock, overlayServiceMock, @@ -224,7 +224,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender({ perPageConfig: 15 }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -238,7 +238,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender({ perPageConfig: 15 }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -268,7 +268,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender({ savedObjectsClient: mockSavedObjectsClient }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -311,7 +311,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender({ savedObjectsClient: mockSavedObjectsClient }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -333,7 +333,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -347,7 +347,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -377,7 +377,7 @@ describe('SavedObjectsTable', () => { }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -405,7 +405,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -419,7 +419,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -435,7 +435,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -448,7 +448,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -487,7 +487,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender(); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -511,7 +511,7 @@ describe('SavedObjectsTable', () => { ] as SavedObjectWithMetadata[]; // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); @@ -546,7 +546,7 @@ describe('SavedObjectsTable', () => { const component = shallowRender({ savedObjectsClient: mockSavedObjectsClient }); // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); // Ensure the state changes are reflected component.update(); diff --git a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx index f0664d8765b7..27e4fdb42d6f 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { OptInBanner } from './opt_in_banner'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry/public/components/opt_in_message.test.tsx b/src/plugins/telemetry/public/components/opt_in_message.test.tsx index 88d98952401c..edd7d43c7eea 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { OptInMessage } from './opt_in_message'; describe('OptInMessage', () => { diff --git a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx index 3bfbb8d3d993..da3910e481d8 100644 --- a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { OptedInNoticeBanner } from './opted_in_notice_banner'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx index 26b442b61171..d5c2bb992bfc 100644 --- a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { OptInExampleFlyout } from './opt_in_example_flyout'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx index c8713d5645dd..420245687383 100644 --- a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout'; describe('security flyout renders as expected', () => { diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx index bd12028737b9..af28350ee85a 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx @@ -30,7 +30,7 @@ * GitHub history for details. */ import React from 'react'; -import { mountWithIntl, shallowWithIntl, wrapWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl, wrapWithIntl } from '@osd/test/jest'; import TelemetryManagementSection from './telemetry_management_section'; import { TelemetryService } from '../../../telemetry/public/services'; import { coreMock } from '../../../../core/public/mocks'; diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx index 6f0a19ddc365..cd68c41069d7 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx @@ -260,7 +260,7 @@ export class TelemetryManagementSection extends Component { const { telemetryService, toasts } = this.props; const newOptInValue = !this.state.enabled; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.setState( { processing: true, diff --git a/src/plugins/timeline/public/directives/saved_object_finder.js b/src/plugins/timeline/public/directives/saved_object_finder.js index f1acc1ca9682..88d0dba00800 100644 --- a/src/plugins/timeline/public/directives/saved_object_finder.js +++ b/src/plugins/timeline/public/directives/saved_object_finder.js @@ -33,7 +33,6 @@ import _ from 'lodash'; import rison from 'rison-node'; import savedObjectFinderTemplate from './saved_object_finder.html'; -import { keyMap } from './key_map'; import { PaginateControlsDirectiveProvider, PaginateDirectiveProvider, @@ -178,8 +177,8 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings //key handler for the filter text box self.filterKeyDown = function ($event) { - switch (keyMap[$event.keyCode]) { - case 'enter': + switch ($event.keyCode) { + case 13: // enter if (self.hitCount !== 1) return; const hit = self.hits[0]; @@ -193,8 +192,8 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings //key handler for the list items self.hitKeyDown = function ($event, page, paginate) { - switch (keyMap[$event.keyCode]) { - case 'tab': + switch ($event.keyCode) { + case 9: // tab if (!self.selector.enabled) break; self.selector.index = -1; @@ -210,7 +209,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings $event.preventDefault(); break; - case 'down': + case 40: // down if (!self.selector.enabled) break; if (self.selector.index + 1 < page.length) { @@ -218,7 +217,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings } $event.preventDefault(); break; - case 'up': + case 38: // up if (!self.selector.enabled) break; if (self.selector.index > 0) { @@ -226,7 +225,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings } $event.preventDefault(); break; - case 'right': + case 39: // right if (!self.selector.enabled) break; if (page.number < page.count) { @@ -236,7 +235,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings } $event.preventDefault(); break; - case 'left': + case 37: // left if (!self.selector.enabled) break; if (page.number > 1) { @@ -246,13 +245,13 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings } $event.preventDefault(); break; - case 'escape': + case 27: // escape if (!self.selector.enabled) break; $input.focus(); $event.preventDefault(); break; - case 'enter': + case 13: // enter if (!self.selector.enabled) break; const hitIndex = (page.number - 1) * paginate.perPage + self.selector.index; @@ -262,7 +261,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings self.onChoose(hit, $event); $event.preventDefault(); break; - case 'shift': + case 16: // shift break; default: $input.focus(); diff --git a/src/plugins/usage_collection/server/collector/collector_set.test.ts b/src/plugins/usage_collection/server/collector/collector_set.test.ts index 97a496d210a6..de298e0e89dd 100644 --- a/src/plugins/usage_collection/server/collector/collector_set.test.ts +++ b/src/plugins/usage_collection/server/collector/collector_set.test.ts @@ -117,7 +117,7 @@ describe('CollectorSet', () => { collectors.registerCollector( new Collector(logger, { type: 'MY_TEST_COLLECTOR', - fetch: () => new Promise((_resolve, reject) => reject()), + fetch: () => new Promise((_resolve, reject) => reject()), isReady: () => true, }) ); diff --git a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx index 9c50bc7a07c3..6df29af0592f 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx @@ -32,7 +32,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { NumberList, NumberListProps } from './number_list'; import { NumberRow } from './number_row'; diff --git a/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx index 9d898f6cd9e7..c8bced2857d3 100644 --- a/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { DateRangesParamEditor } from './date_ranges'; import { OpenSearchDashboardsContextProvider } from '../../../../opensearch_dashboards_react/public'; import { docLinksServiceMock } from '../../../../../core/public/mocks'; diff --git a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx index 034170b9d095..5f3c6d976ab9 100644 --- a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx @@ -51,7 +51,6 @@ function HasExtendedBoundsParamEditor(props: AggParamEditorProps) { setValue(value && agg.params.min_doc_count); } - /* eslint-disable-next-line react-hooks/exhaustive-deps */ }, [agg.params.min_doc_count, setValue, value]); return ( diff --git a/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx index dfc50fd4a10b..241ca2c49a2e 100644 --- a/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx @@ -34,7 +34,7 @@ import React from 'react'; import { AggParamEditorProps } from '../agg_param_props'; import { IAggConfig } from 'src/plugins/data/public'; import { mount } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { PercentilesEditor } from './percentiles'; import { EditorVisState } from '../sidebar/state/reducers'; diff --git a/src/plugins/vis_default_editor/public/components/controls/size.test.tsx b/src/plugins/vis_default_editor/public/components/controls/size.test.tsx index ba3c55dee36e..c9f97f3f5a26 100644 --- a/src/plugins/vis_default_editor/public/components/controls/size.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/size.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@osd/test/jest'; import { EuiIconTip } from '@elastic/eui'; import { SizeParamEditor, SizeParamEditorProps } from './size'; import { aggParamCommonPropsMock } from './test_utils'; diff --git a/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx index 72b2667e908a..cd43816b99e9 100644 --- a/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@osd/test/jest'; import { AggregateValueProp, TopAggregateParamEditor, diff --git a/src/plugins/vis_type_metric/public/components/metric_vis_value.tsx b/src/plugins/vis_type_metric/public/components/metric_vis_value.tsx index ebdb1e7a83c0..63a7b010e1c5 100644 --- a/src/plugins/vis_type_metric/public/components/metric_vis_value.tsx +++ b/src/plugins/vis_type_metric/public/components/metric_vis_value.tsx @@ -67,9 +67,7 @@ export class MetricVisValue extends Component { }; const containerClassName = classNames('mtrVis__container', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'mtrVis__container--light': metric.lightText, - // eslint-disable-next-line @typescript-eslint/naming-convention 'mtrVis__container-isfilterable': hasFilter, }); diff --git a/src/plugins/vis_type_table/public/vis_controller.ts b/src/plugins/vis_type_table/public/vis_controller.ts index 5d39fae81c72..60e22a2e4b3c 100644 --- a/src/plugins/vis_type_table/public/vis_controller.ts +++ b/src/plugins/vis_type_table/public/vis_controller.ts @@ -81,7 +81,7 @@ export function getTableVisualizationControllerClass( getOpenSearchDashboardsLegacy().loadFontAwesome(); await this.initLocalAngular(); - return new Promise(async (resolve, reject) => { + return new Promise(async (resolve, reject) => { if (!this.$rootScope) { const $injector = this.getInjector(); this.$rootScope = $injector.get('$rootScope'); diff --git a/src/plugins/vis_type_tagcloud/public/components/tag_cloud.test.js b/src/plugins/vis_type_tagcloud/public/components/tag_cloud.test.js index 142dc18f7837..8c649e12caab 100644 --- a/src/plugins/vis_type_tagcloud/public/components/tag_cloud.test.js +++ b/src/plugins/vis_type_tagcloud/public/components/tag_cloud.test.js @@ -36,7 +36,7 @@ import 'jest-canvas-mock'; import { fromNode, delay } from 'bluebird'; import { TagCloud } from './tag_cloud'; -import { setHTMLElementOffset, setSVGElementGetBBox } from '../../../../test_utils/public'; +import { setHTMLElementOffset, setSVGElementGetBBox } from '@osd/test/jest'; describe('tag cloud tests', () => { let SVGElementGetBBoxSpyInstance; diff --git a/src/plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.test.js b/src/plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.test.js index 0a0d025f1d4c..05449a4257ac 100644 --- a/src/plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.test.js +++ b/src/plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.test.js @@ -35,7 +35,7 @@ import 'jest-canvas-mock'; import { TagCloudVisualization } from './tag_cloud_visualization'; import { setFormatService } from '../services'; import { dataPluginMock } from '../../../data/public/mocks'; -import { setHTMLElementOffset, setSVGElementGetBBox } from '../../../../test_utils/public'; +import { setHTMLElementOffset, setSVGElementGetBBox } from '@osd/test/jest'; const seedColors = ['#00a69b', '#57c17b', '#6f87d8', '#663db8', '#bc52bc', '#9e3533', '#daa05d']; diff --git a/src/plugins/vis_type_timeseries/public/application/components/add_delete_buttons.test.tsx b/src/plugins/vis_type_timeseries/public/application/components/add_delete_buttons.test.tsx index 5f2d9d6b59f9..e61f6f0efa79 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/add_delete_buttons.test.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/add_delete_buttons.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { AddDeleteButtons } from './add_delete_buttons'; describe('AddDeleteButtons', () => { diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/agg_select.test.tsx b/src/plugins/vis_type_timeseries/public/application/components/aggs/agg_select.test.tsx index fe046be506f1..43b92e825704 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/aggs/agg_select.test.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/agg_select.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { AggSelect } from './agg_select'; import { METRIC, SERIES } from '../../../test_utils'; import { EuiComboBox } from '@elastic/eui'; diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/filter_ratio.test.js b/src/plugins/vis_type_timeseries/public/application/components/aggs/filter_ratio.test.js index 4fa7938604a1..b634e4045029 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/aggs/filter_ratio.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/filter_ratio.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { FilterRatioAgg } from './filter_ratio'; import { FIELDS, METRIC, SERIES, PANEL } from '../../../test_utils'; import { EuiComboBox } from '@elastic/eui'; diff --git a/src/plugins/vis_type_timeseries/public/application/components/aggs/histogram_support.test.js b/src/plugins/vis_type_timeseries/public/application/components/aggs/histogram_support.test.js index 4caf82d95e87..976a5ef91676 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/aggs/histogram_support.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/aggs/histogram_support.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { Agg } from './agg'; import { FieldSelect } from './field_select'; import { FIELDS, METRIC, SERIES, PANEL } from '../../../test_utils'; diff --git a/src/plugins/vis_type_timeseries/public/application/components/color_rules.test.js b/src/plugins/vis_type_timeseries/public/application/components/color_rules.test.js index 2005f023aed4..feeacc0177e4 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/color_rules.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/color_rules.test.js @@ -35,7 +35,7 @@ import { collectionActions } from './lib/collection_actions'; import { ColorRules } from './color_rules'; import { keys } from '@elastic/eui'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; describe('src/legacy/core_plugins/metrics/public/components/color_rules.test.js', () => { let defaultProps; diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.test.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.test.js index b7390b7c2c40..3f473c428a09 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; jest.mock('../lib/get_default_query_language', () => ({ getDefaultQueryLanguage: () => 'kuery', diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/gauge/series.test.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/gauge/series.test.js index f6151c01de49..fe2c350c1902 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/gauge/series.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/gauge/series.test.js @@ -31,7 +31,7 @@ */ import React from 'react'; import { GaugeSeries } from './series'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; const defaultProps = { disableAdd: true, diff --git a/src/plugins/vis_type_timeseries/public/application/components/vis_types/metric/series.test.js b/src/plugins/vis_type_timeseries/public/application/components/vis_types/metric/series.test.js index 13c48e9d3233..9214754c4a47 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/vis_types/metric/series.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/vis_types/metric/series.test.js @@ -32,7 +32,7 @@ import React from 'react'; import { MetricSeries } from './series'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; const defaultProps = { disableAdd: false, diff --git a/src/plugins/vis_type_timeseries/public/application/components/yes_no.test.js b/src/plugins/vis_type_timeseries/public/application/components/yes_no.test.js index bcd4b157031e..9e06ff13e792 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/yes_no.test.js +++ b/src/plugins/vis_type_timeseries/public/application/components/yes_no.test.js @@ -32,7 +32,7 @@ import React from 'react'; import { expect } from 'chai'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import sinon from 'sinon'; import { YesNo } from './yes_no'; diff --git a/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx index cc9a671528d2..f2ab849db530 100644 --- a/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx @@ -35,7 +35,7 @@ import { shallow } from 'enzyme'; import { ValueAxesPanel, ValueAxesPanelProps } from './value_axes_panel'; import { ValueAxis, SeriesParam } from '../../../types'; import { Positions } from '../../../utils/collections'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { valueAxis, seriesParam, vis } from './mocks'; describe('ValueAxesPanel component', () => { diff --git a/src/plugins/vis_type_vislib/public/vis_controller.tsx b/src/plugins/vis_type_vislib/public/vis_controller.tsx index 4774ec0a92d6..a8a1b4094009 100644 --- a/src/plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/plugins/vis_type_vislib/public/vis_controller.tsx @@ -86,7 +86,7 @@ export const createVislibVisController = (deps: VisTypeVislibDependencies) => { getOpenSearchDashboardsLegacy().loadFontAwesome(); - return new Promise(async (resolve) => { + return new Promise(async (resolve) => { if (this.el.clientWidth === 0 || this.el.clientHeight === 0) { return resolve(); } diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx index 8804e29a1305..57b30c866c50 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx +++ b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx @@ -135,7 +135,7 @@ export class VisLegend extends PureComponent { }; setFilterableLabels = (items: LegendItem[]): Promise => - new Promise(async (resolve) => { + new Promise(async (resolve) => { const filterableLabels = new Set(); items.forEach(async (item) => { const canFilter = await this.canFilter(item); @@ -267,7 +267,6 @@ export class VisLegend extends PureComponent { type="button" onClick={this.toggleLegend} className={classNames('visLegend__toggle osd-resetFocusState', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'visLegend__toggle--isOpen': open, })} aria-label={i18n.translate('visTypeVislib.vislib.legend.toggleLegendButtonAriaLabel', { diff --git a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx index 97e13c146558..6a03a9954e10 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx +++ b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx @@ -195,7 +195,6 @@ const VisLegendItemComponent = ({ onClick={setColor(item.label, color)} onKeyPress={setColor(item.label, color)} className={classNames('visLegend__valueColorPickerDot', { - // eslint-disable-next-line @typescript-eslint/naming-convention 'visLegend__valueColorPickerDot-isSelected': color === getColor(item.label), })} style={{ color }} diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js index 1123e32edeb6..edf418e73a69 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.test.js @@ -36,7 +36,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@osd/test/jest'; import { ChartTitle } from './chart_title'; import { VisConfig } from './vis_config'; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js index b56345d25138..9924fb100f5e 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.test.js @@ -36,7 +36,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import data from '../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js index 8d3faa1f2d01..130b5c4f2baa 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/handler.test.js @@ -35,7 +35,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import series from '../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js index dbee2389c3c4..60757b279bdd 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.test.js @@ -36,7 +36,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import series from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/vis.test.js b/src/plugins/vis_type_vislib/public/vislib/vis.test.js index 352d62b52268..17ab0215fa83 100644 --- a/src/plugins/vis_type_vislib/public/vislib/vis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/vis.test.js @@ -36,7 +36,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../test_utils/public'; +} from '@osd/test/jest'; import series from '../fixtures/mock_data/date_histogram/_series'; import columns from '../fixtures/mock_data/date_histogram/_columns'; import rows from '../fixtures/mock_data/date_histogram/_rows'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js index 50c08401eb43..75c2a95de170 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/chart.test.js @@ -31,7 +31,7 @@ */ import d3 from 'd3'; -import { setHTMLElementClientSizes, setSVGElementGetBBox } from '../../../../../test_utils/public'; +import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@osd/test/jest'; import { Chart } from './_chart'; import { getMockUiState } from '../../fixtures/mocks'; import { getVis } from './_vis_fixture'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js index eb7b5cd1cd04..e8be6e875522 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.test.js @@ -32,7 +32,7 @@ import $ from 'jquery'; import _ from 'lodash'; -import { setHTMLElementClientSizes, setSVGElementGetBBox } from '../../../../../test_utils/public'; +import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@osd/test/jest'; import data from '../../fixtures/mock_data/terms/_series_multiple'; import { getMockUiState } from '../../fixtures/mocks'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js index 9623ef5c4619..60ea62d09e70 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.test.js @@ -37,7 +37,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@osd/test/jest'; import { getMockUiState } from '../../fixtures/mocks'; import { getVis } from './_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js index 0ed3a158e175..d56fa188a0ff 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.test.js @@ -37,7 +37,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@osd/test/jest'; import { getMockUiState } from '../../../fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js index dc8030aa557e..16f0f3c05bc3 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.test.js @@ -37,7 +37,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import series from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js index 0fd04312d257..c852ca37a9ab 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js @@ -37,7 +37,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import series from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js index b01699306ae5..d680e12a9c07 100644 --- a/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js @@ -37,7 +37,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@osd/test/jest'; // Data import seriesPos from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/visualizations/public/vis.test.ts b/src/plugins/visualizations/public/vis.test.ts index 6d0f64a4fa83..e7f51a93bd43 100644 --- a/src/plugins/visualizations/public/vis.test.ts +++ b/src/plugins/visualizations/public/vis.test.ts @@ -37,7 +37,7 @@ jest.mock('./services', () => { constructor() {} render(): Promise { - return new Promise((resolve) => { + return new Promise((resolve) => { resolve(); }); } diff --git a/src/plugins/visualizations/public/vis.ts b/src/plugins/visualizations/public/vis.ts index f542094d74e9..d00c974b466c 100644 --- a/src/plugins/visualizations/public/vis.ts +++ b/src/plugins/visualizations/public/vis.ts @@ -116,6 +116,7 @@ export class Vis { this.id = visState.id; } + // eslint-disable-next-line @typescript-eslint/no-shadow private getType(visType: string) { const type = getTypes().get(visType); if (!type) { diff --git a/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx b/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx index cdb7176c1154..04e3f493ee6b 100644 --- a/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx +++ b/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx @@ -42,7 +42,7 @@ export class ReactVisController implements VisualizationController { public render(visData: any, visParams: any): Promise { const I18nContext = getI18n().Context; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { if (!this.vis.type || !this.vis.type.visConfig || !this.vis.type.visConfig.component) { reject('Missing component for ReactVisType'); } diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx index 405e1a1db051..7b71b49c6963 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@osd/test/jest'; import { TypesStart, VisType } from '../vis_types'; import { NewVisModal } from './new_vis_modal'; import { ApplicationStart, SavedObjectsStart } from '../../../../core/public'; diff --git a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx index 0a0308d36c05..a3b140ed38c6 100644 --- a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx +++ b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx @@ -31,7 +31,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@osd/test/jest'; import { NewVisHelp } from './new_vis_help'; describe('NewVisHelp', () => { diff --git a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts index 2cefb205c8c9..82698b03a042 100644 --- a/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts +++ b/src/plugins/visualize/public/application/utils/use/use_visualize_app_state.test.ts @@ -212,7 +212,7 @@ describe('useVisualizeAppState', () => { renderHook(() => useVisualizeAppState(mockServices, eventEmitter, savedVisInstance)); - await new Promise((res) => { + await new Promise((res) => { setTimeout(() => res()); }); diff --git a/src/test_utils/__tests__/get_url.js b/src/test_utils/__tests__/get_url.js deleted file mode 100644 index d763270617cc..000000000000 --- a/src/test_utils/__tests__/get_url.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import expect from '@osd/expect'; -import getUrl from '../get_url'; - -describe('getUrl', function () { - it('should convert to a url', function () { - const url = getUrl( - { - protocol: 'http', - hostname: 'localhost', - }, - { - pathname: 'foo', - } - ); - - expect(url).to.be('http://localhost/foo'); - }); - - it('should convert to a url with port', function () { - const url = getUrl( - { - protocol: 'http', - hostname: 'localhost', - port: 9220, - }, - { - pathname: 'foo', - } - ); - - expect(url).to.be('http://localhost:9220/foo'); - }); - - it('should convert to a secure hashed url', function () { - expect( - getUrl( - { - protocol: 'https', - hostname: 'localhost', - }, - { - pathname: 'foo', - hash: 'bar', - } - ) - ).to.be('https://localhost/foo#bar'); - }); -}); diff --git a/src/test_utils/get_url.js b/src/test_utils/get_url.js deleted file mode 100644 index b741f8197953..000000000000 --- a/src/test_utils/get_url.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -import _ from 'lodash'; -import url from 'url'; - -/** - * Converts a config and a pathname to a url - * @param {object} config A url config - * example: - * { - * protocol: 'http', - * hostname: 'localhost', - * port: 9220, - * auth: opensearchDashboardsTestUser.username + ':' + opensearchDashboardsTestUser.password - * } - * @param {object} app The params to append - * example: - * { - * pathname: 'app/opensearch-dashboards', - * hash: '/discover' - * } - * @return {string} - */ - -export default function getUrl(config, app) { - return url.format(_.assign({}, config, app)); -} - -getUrl.noAuth = function getUrlNoAuth(config, app) { - config = _.pickBy(config, function (val, param) { - return param !== 'auth'; - }); - return getUrl(config, app); -}; - -getUrl.baseUrl = function getBaseUrl(config) { - return url.format(_.pick(config, 'protocol', 'hostname', 'port')); -}; diff --git a/src/test_utils/public/index.ts b/src/test_utils/public/index.ts deleted file mode 100644 index 31f451a33851..000000000000 --- a/src/test_utils/public/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export { - setSVGElementGetBBox, - setHTMLElementOffset, - setHTMLElementClientSizes, - setSVGElementGetComputedTextLength, -} from './helpers'; diff --git a/src/test_utils/public/key_map.ts b/src/test_utils/public/key_map.ts deleted file mode 100644 index e3828d966e73..000000000000 --- a/src/test_utils/public/key_map.ts +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -export const keyMap: { [key: number]: string } = { - 8: 'backspace', - 9: 'tab', - 13: 'enter', - 16: 'shift', - 17: 'ctrl', - 18: 'alt', - 19: 'pause', - 20: 'capsLock', - 27: 'escape', - 32: 'space', - 33: 'pageUp', - 34: 'pageDown', - 35: 'end', - 36: 'home', - 37: 'left', - 38: 'up', - 39: 'right', - 40: 'down', - 45: 'insert', - 46: 'delete', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 65: 'a', - 66: 'b', - 67: 'c', - 68: 'd', - 69: 'e', - 70: 'f', - 71: 'g', - 72: 'h', - 73: 'i', - 74: 'j', - 75: 'k', - 76: 'l', - 77: 'm', - 78: 'n', - 79: 'o', - 80: 'p', - 81: 'q', - 82: 'r', - 83: 's', - 84: 't', - 85: 'u', - 86: 'v', - 87: 'w', - 88: 'x', - 89: 'y', - 90: 'z', - 91: 'leftWindowKey', - 92: 'rightWindowKey', - 93: 'selectKey', - 96: '0', - 97: '1', - 98: '2', - 99: '3', - 100: '4', - 101: '5', - 102: '6', - 103: '7', - 104: '8', - 105: '9', - 106: 'multiply', - 107: 'add', - 109: 'subtract', - 110: 'period', - 111: 'divide', - 112: 'f1', - 113: 'f2', - 114: 'f3', - 115: 'f4', - 116: 'f5', - 117: 'f6', - 118: 'f7', - 119: 'f8', - 120: 'f9', - 121: 'f10', - 122: 'f11', - 123: 'f12', - 144: 'numLock', - 145: 'scrollLock', - 186: 'semiColon', - 187: 'equalSign', - 188: 'comma', - 189: 'dash', - 190: 'period', - 191: 'forwardSlash', - 192: 'graveAccent', - 219: 'openBracket', - 220: 'backSlash', - 221: 'closeBracket', - 222: 'singleQuote', - 224: 'meta', -}; diff --git a/src/test_utils/tsconfig.json b/src/test_utils/tsconfig.json deleted file mode 100644 index 2fa89e298989..000000000000 --- a/src/test_utils/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target", - "composite": true, - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true - }, - "include": [ - "public/**/*" - ], - "exclude": [ - "target" - ] -} diff --git a/test/common/services/deployment.ts b/test/common/services/deployment.ts index fac7aca2eb03..d78be060b2e6 100644 --- a/test/common/services/deployment.ts +++ b/test/common/services/deployment.ts @@ -33,8 +33,7 @@ import { get } from 'lodash'; // @ts-ignore import fetch from 'node-fetch'; -// @ts-ignore not TS yet -import getUrl from '../../../src/test_utils/get_url'; +import getUrl from '@osd/test/jest'; import { FtrProviderContext } from '../ftr_provider_context'; diff --git a/test/common/services/retry/retry_for_success.ts b/test/common/services/retry/retry_for_success.ts index 64e98fb5166a..a8ab41590af7 100644 --- a/test/common/services/retry/retry_for_success.ts +++ b/test/common/services/retry/retry_for_success.ts @@ -33,7 +33,7 @@ import { ToolingLog } from '@osd/dev-utils'; import { inspect } from 'util'; -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const returnTrue = () => true; diff --git a/test/examples/bfetch_explorer/batched_function.ts b/test/examples/bfetch_explorer/batched_function.ts index 1404b6dcd391..6f50566bfc8d 100644 --- a/test/examples/bfetch_explorer/batched_function.ts +++ b/test/examples/bfetch_explorer/batched_function.ts @@ -47,7 +47,7 @@ export default function ({ getService }: FtrProviderContext) { const form = await testSubjects.find('DoubleIntegers'); const btn = await form.findByCssSelector('button'); await btn.click(); - await new Promise((r) => setTimeout(r, 4000)); + await new Promise((r) => setTimeout(r, 4000)); const pre = await form.findByCssSelector('pre'); const text = await pre.getVisibleText(); const json = JSON.parse(text); @@ -85,7 +85,7 @@ export default function ({ getService }: FtrProviderContext) { const btn = await form.findByCssSelector('button'); await btn.click(); - await new Promise((r) => setTimeout(r, 500)); + await new Promise((r) => setTimeout(r, 500)); const pre = await form.findByCssSelector('pre'); const text1 = await pre.getVisibleText(); @@ -94,7 +94,7 @@ export default function ({ getService }: FtrProviderContext) { expect(json1.length > 0).to.be(true); expect(json1.length < 4).to.be(true); - await new Promise((r) => setTimeout(r, 3500)); + await new Promise((r) => setTimeout(r, 3500)); const text2 = await pre.getVisibleText(); const json2 = JSON.parse(text2); diff --git a/test/functional/apps/saved_objects_management/edit_saved_object.ts b/test/functional/apps/saved_objects_management/edit_saved_object.ts index 6756865d9fc9..eb0a634373c3 100644 --- a/test/functional/apps/saved_objects_management/edit_saved_object.ts +++ b/test/functional/apps/saved_objects_management/edit_saved_object.ts @@ -33,7 +33,7 @@ import expect from '@osd/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); export default function ({ getPageObjects, getService }: FtrProviderContext) { const opensearchArchiver = getService('opensearchArchiver'); diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 57ff47e81cf7..b1a7a2542b5e 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -34,9 +34,8 @@ import { delay } from 'bluebird'; import expect from '@osd/expect'; // @ts-ignore import fetch from 'node-fetch'; +import getUrl from '@osd/test/jest'; import { FtrProviderContext } from '../ftr_provider_context'; -// @ts-ignore not TS yet -import getUrl from '../../../src/test_utils/get_url'; export function CommonPageProvider({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); diff --git a/test/functional/page_objects/context_page.ts b/test/functional/page_objects/context_page.ts index 6cd4dcd66fd8..f4fa1dda21c7 100644 --- a/test/functional/page_objects/context_page.ts +++ b/test/functional/page_objects/context_page.ts @@ -31,9 +31,8 @@ */ import rison from 'rison-node'; +import getUrl from '@osd/test/jest'; import { FtrProviderContext } from '../ftr_provider_context'; -// @ts-ignore not TS yet -import getUrl from '../../../src/test_utils/get_url'; const DEFAULT_INITIAL_STATE = { columns: ['@message'], diff --git a/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts b/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts index 1eb35c6fc367..c9f633212d32 100644 --- a/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts +++ b/test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts @@ -33,7 +33,6 @@ import { delay } from 'bluebird'; import { WebElement, WebDriver, By, Key } from 'selenium-webdriver'; import { PNG } from 'pngjs'; -// @ts-ignore not supported yet import cheerio from 'cheerio'; import testSubjSelector from '@osd/test-subj-selector'; import { ToolingLog } from '@osd/dev-utils'; diff --git a/test/functional/services/remote/prevent_parallel_calls.ts b/test/functional/services/remote/prevent_parallel_calls.ts index c75cad2be426..d00c939c472c 100644 --- a/test/functional/services/remote/prevent_parallel_calls.ts +++ b/test/functional/services/remote/prevent_parallel_calls.ts @@ -42,7 +42,7 @@ export function preventParallelCalls( private reject!: (error: Error) => void; constructor(private readonly context: C, private readonly arg: A) { - this.promise = new Promise((resolve, reject) => { + this.promise = new Promise((resolve, reject) => { this.resolve = resolve; this.reject = reject; }); diff --git a/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json b/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json index 7b188acd4ea1..964d2350622d 100644 --- a/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json +++ b/test/interpreter_functional/plugins/osd_tp_run_pipeline/package.json @@ -16,6 +16,6 @@ "@osd/plugin-helpers": "1.0.0", "react": "^16.14.0", "react-dom": "^16.12.0", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/app_link_test/package.json b/test/plugin_functional/plugins/app_link_test/package.json index 8b28e62e31b7..fc2487e8c849 100644 --- a/test/plugin_functional/plugins/app_link_test/package.json +++ b/test/plugin_functional/plugins/app_link_test/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_app_status/package.json b/test/plugin_functional/plugins/core_app_status/package.json index 0304da467b46..0e5b0c4bbde1 100644 --- a/test/plugin_functional/plugins/core_app_status/package.json +++ b/test/plugin_functional/plugins/core_app_status/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_a/package.json b/test/plugin_functional/plugins/core_plugin_a/package.json index 53ea6306f2a1..5708fdd6a530 100644 --- a/test/plugin_functional/plugins/core_plugin_a/package.json +++ b/test/plugin_functional/plugins/core_plugin_a/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_appleave/package.json b/test/plugin_functional/plugins/core_plugin_appleave/package.json index 69e7caea397e..88bc15c62bd0 100644 --- a/test/plugin_functional/plugins/core_plugin_appleave/package.json +++ b/test/plugin_functional/plugins/core_plugin_appleave/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_b/package.json b/test/plugin_functional/plugins/core_plugin_b/package.json index 56ec66f867f8..5bb17d798f7d 100644 --- a/test/plugin_functional/plugins/core_plugin_b/package.json +++ b/test/plugin_functional/plugins/core_plugin_b/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_chromeless/package.json b/test/plugin_functional/plugins/core_plugin_chromeless/package.json index 33a247924d08..12c6405bd5a1 100644 --- a/test/plugin_functional/plugins/core_plugin_chromeless/package.json +++ b/test/plugin_functional/plugins/core_plugin_chromeless/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json b/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json index 974d9398dd65..a7886330604d 100644 --- a/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json +++ b/test/plugin_functional/plugins/core_plugin_route_timeouts/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_plugin_route_timeouts/server/plugin.ts b/test/plugin_functional/plugins/core_plugin_route_timeouts/server/plugin.ts index b600b483479e..adc03f80449c 100644 --- a/test/plugin_functional/plugins/core_plugin_route_timeouts/server/plugin.ts +++ b/test/plugin_functional/plugins/core_plugin_route_timeouts/server/plugin.ts @@ -100,7 +100,7 @@ export class CorePluginRouteTimeoutsPlugin implements Plugin { }, async (context, req, res) => { if (req.body?.responseDelay) { - await new Promise((resolve) => setTimeout(resolve, req.body!.responseDelay)); + await new Promise((resolve) => setTimeout(resolve, req.body!.responseDelay)); } return res.ok({}); } @@ -125,7 +125,7 @@ export class CorePluginRouteTimeoutsPlugin implements Plugin { }, async (context, req, res) => { if (req.body?.responseDelay) { - await new Promise((resolve) => setTimeout(resolve, req.body!.responseDelay)); + await new Promise((resolve) => setTimeout(resolve, req.body!.responseDelay)); } return res.ok({}); } diff --git a/test/plugin_functional/plugins/core_plugin_static_assets/package.json b/test/plugin_functional/plugins/core_plugin_static_assets/package.json index 5b50b579549b..4b83b676db85 100644 --- a/test/plugin_functional/plugins/core_plugin_static_assets/package.json +++ b/test/plugin_functional/plugins/core_plugin_static_assets/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_provider_plugin/package.json b/test/plugin_functional/plugins/core_provider_plugin/package.json index 068d9b0e638d..c3fab03d6fc7 100644 --- a/test/plugin_functional/plugins/core_provider_plugin/package.json +++ b/test/plugin_functional/plugins/core_provider_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/core_provider_plugin/public/index.ts b/test/plugin_functional/plugins/core_provider_plugin/public/index.ts index 11873644a857..4771b92f8931 100644 --- a/test/plugin_functional/plugins/core_provider_plugin/public/index.ts +++ b/test/plugin_functional/plugins/core_provider_plugin/public/index.ts @@ -51,7 +51,7 @@ class CoreProviderPlugin implements Plugin { plugins, }, testUtils: { - delay: (ms: number) => new Promise((res) => setTimeout(res, ms)), + delay: (ms: number) => new Promise((res) => setTimeout(res, ms)), }, }; } diff --git a/test/plugin_functional/plugins/data_search/package.json b/test/plugin_functional/plugins/data_search/package.json index fcd6ba5260f4..cf724253b0be 100644 --- a/test/plugin_functional/plugins/data_search/package.json +++ b/test/plugin_functional/plugins/data_search/package.json @@ -10,6 +10,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/doc_views_plugin/package.json b/test/plugin_functional/plugins/doc_views_plugin/package.json index 4f0aa8b8ae45..008bd01f0f3e 100644 --- a/test/plugin_functional/plugins/doc_views_plugin/package.json +++ b/test/plugin_functional/plugins/doc_views_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/index_patterns/package.json b/test/plugin_functional/plugins/index_patterns/package.json index 114131058ece..9eb0601f6170 100644 --- a/test/plugin_functional/plugins/index_patterns/package.json +++ b/test/plugin_functional/plugins/index_patterns/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/management_test_plugin/package.json b/test/plugin_functional/plugins/management_test_plugin/package.json index cd0b7eb62b8d..b38467972ebb 100644 --- a/test/plugin_functional/plugins/management_test_plugin/package.json +++ b/test/plugin_functional/plugins/management_test_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/opensearch_client_plugin/package.json b/test/plugin_functional/plugins/opensearch_client_plugin/package.json index fc7aab14306b..5ba7725f8d1a 100644 --- a/test/plugin_functional/plugins/opensearch_client_plugin/package.json +++ b/test/plugin_functional/plugins/opensearch_client_plugin/package.json @@ -10,6 +10,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/osd_sample_panel_action/package.json b/test/plugin_functional/plugins/osd_sample_panel_action/package.json index f2089084bd47..ff7d904923bf 100644 --- a/test/plugin_functional/plugins/osd_sample_panel_action/package.json +++ b/test/plugin_functional/plugins/osd_sample_panel_action/package.json @@ -14,6 +14,6 @@ "devDependencies": { "@elastic/eui": "29.3.2", "react": "^16.14.0", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/osd_top_nav/package.json b/test/plugin_functional/plugins/osd_top_nav/package.json index 49076bfe6261..86223d014d78 100644 --- a/test/plugin_functional/plugins/osd_top_nav/package.json +++ b/test/plugin_functional/plugins/osd_top_nav/package.json @@ -12,7 +12,7 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json b/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json index e8dc15cfd4ad..7d8be488322a 100644 --- a/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json +++ b/test/plugin_functional/plugins/osd_tp_custom_visualizations/package.json @@ -15,6 +15,6 @@ "@elastic/eui": "29.3.2", "@osd/plugin-helpers": "1.0.0", "react": "^16.14.0", - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/rendering_plugin/package.json b/test/plugin_functional/plugins/rendering_plugin/package.json index bb651872f1aa..ffba3679de9d 100644 --- a/test/plugin_functional/plugins/rendering_plugin/package.json +++ b/test/plugin_functional/plugins/rendering_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/plugin_functional/plugins/ui_settings_plugin/package.json b/test/plugin_functional/plugins/ui_settings_plugin/package.json index f167bfc69946..7e48f8873604 100644 --- a/test/plugin_functional/plugins/ui_settings_plugin/package.json +++ b/test/plugin_functional/plugins/ui_settings_plugin/package.json @@ -12,6 +12,6 @@ "build": "rm -rf './target' && tsc" }, "devDependencies": { - "typescript": "4.0.2" + "typescript": "4.1.6" } } diff --git a/test/server_integration/http/platform/headers.ts b/test/server_integration/http/platform/headers.ts index 04b342c7cc47..88a2bce48956 100644 --- a/test/server_integration/http/platform/headers.ts +++ b/test/server_integration/http/platform/headers.ts @@ -31,12 +31,10 @@ */ import Http from 'http'; import Url from 'url'; +import getUrl from '@osd/test/jest'; import { FtrProviderContext } from '../../services/types'; -// @ts-ignore -import getUrl from '../../../../src/test_utils/get_url'; - -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const oneSec = 1_000; // eslint-disable-next-line import/no-default-export @@ -53,7 +51,7 @@ export default function ({ getService }: FtrProviderContext) { ); function performRequest() { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const req = Http.request( { protocol, diff --git a/tsconfig.base.json b/tsconfig.base.json index bda8cd8363e7..7bcc5fe5b705 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -7,9 +7,6 @@ "opensearch-dashboards/public": ["src/core/public"], "opensearch-dashboards/server": ["src/core/server"], "plugins/*": ["src/legacy/core_plugins/*/public/"], - "test_utils/*": [ - "src/test_utils/public/*" - ], "fixtures/*": ["src/fixtures/*"] }, // Support .tsx files and transform JSX into calls to React.createElement diff --git a/tsconfig.json b/tsconfig.json index 8992e17067f4..4ae094893d9d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,9 @@ "opensearch_dashboards.d.ts", "src/**/*", "typings/**/*", - "test_utils/**/*" ], "exclude": [ "src/**/__fixtures__/**/*", - "src/test_utils/**/*", "src/core/**/*", "src/plugins/opensearch_dashboards_utils/**/*", "src/plugins/opensearch_dashboards_react/**/*" @@ -22,7 +20,6 @@ // "src/**/public/**/*" ], "references": [ - { "path": "./src/test_utils/tsconfig.json" }, { "path": "./src/core/tsconfig.json" }, { "path": "./src/plugins/opensearch_dashboards_utils/tsconfig.json" }, { "path": "./src/plugins/opensearch_dashboards_react/tsconfig.json" } diff --git a/tsconfig.refs.json b/tsconfig.refs.json index 8eaa1fcbc552..e181ab3adace 100644 --- a/tsconfig.refs.json +++ b/tsconfig.refs.json @@ -1,7 +1,6 @@ { "include": [], "references": [ - { "path": "./src/test_utils/tsconfig.json" }, { "path": "./src/core/tsconfig.json" }, { "path": "./src/plugins/opensearch_dashboards_utils/tsconfig.json" }, { "path": "./src/plugins/opensearch_dashboards_react/tsconfig.json" }, diff --git a/yarn.lock b/yarn.lock index b4f74aca8a58..d719be08fd03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1557,19 +1557,20 @@ "@hapi/hoek" "9.x.x" "@istanbuljs/load-nyc-config@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" - integrity sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg== + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== dependencies: camelcase "^5.3.1" find-up "^4.1.0" + get-package-type "^0.1.0" js-yaml "^3.13.1" resolve-from "^5.0.0" "@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" - integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== "@jest/console@^27.5.1": version "27.5.1" @@ -2631,10 +2632,12 @@ resolved "https://registry.yarnpkg.com/@types/chance/-/chance-1.0.1.tgz#c10703020369602c40dd9428cc6e1437027116df" integrity sha512-jtV6Bv/j+xk4gcXeLlESwNc/m/I/dIZA0xrt29g0uKcjyPob8iisj/5z0ARE+Ldfx4MxjNFNECG0z++J7zJgqg== -"@types/cheerio@*", "@types/cheerio@^0.22.10": - version "0.22.10" - resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.10.tgz#780d552467824be4a241b29510a7873a7432c4a6" - integrity sha512-fOM/Jhv51iyugY7KOBZz2ThfT1gwvsGCfWxpLpZDgkGjpEO4Le9cld07OdskikLjDUQJ43dzDaVRSFwQlpdqVg== +"@types/cheerio@*", "@types/cheerio@^0.22.22", "@types/cheerio@^0.22.30": + version "0.22.31" + resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.31.tgz#b8538100653d6bb1b08a1e46dec75b4f2a5d5eb6" + integrity sha512-Kt7Cdjjdi2XWSfrZ53v4Of0wG3ZcmaegFXjMmz9tfNrZSkzzo36G0AL1YqSdcIA78Etjt6E609pt5h1xnQkPUw== + dependencies: + "@types/node" "*" "@types/chroma-js@^2.0.0": version "2.0.0" @@ -2752,19 +2755,14 @@ resolved "https://registry.yarnpkg.com/@types/elasticsearch/-/elasticsearch-5.0.33.tgz#b0fd37dc674f498223b6d68c313bdfd71f4d812b" integrity sha512-n/g9pqJEpE4fyUE8VvHNGtl7E2Wv8TCroNwfgAeJKRV4ghDENahtrAo1KMsFNIejBD2gDAlEUa4CM4oEEd8p9Q== -"@types/enzyme@^3.10.5": - version "3.10.5" - resolved "https://registry.yarnpkg.com/@types/enzyme/-/enzyme-3.10.5.tgz#fe7eeba3550369eed20e7fb565bfb74eec44f1f0" - integrity sha512-R+phe509UuUYy9Tk0YlSbipRpfVtIzb/9BHn5pTEtjJTF5LXvUjrIQcZvNyANNEyFrd2YGs196PniNT1fgvOQA== +"@types/enzyme@^3.10.11": + version "3.10.11" + resolved "https://registry.yarnpkg.com/@types/enzyme/-/enzyme-3.10.11.tgz#8924bd92cc63ac1843e215225dfa8f71555fe814" + integrity sha512-LEtC7zXsQlbGXWGcnnmOI7rTyP+i1QzQv4Va91RKXDEukLDaNyxu0rXlfMiGEhJwfgTPCTb0R+Pnlj//oM9e/w== dependencies: "@types/cheerio" "*" "@types/react" "*" -"@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== - "@types/eslint@^6.1.3": version "6.8.1" resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-6.8.1.tgz#e26f365a5dda12445d1d5a17eb70efd7c844a3d8" @@ -2978,31 +2976,31 @@ resolved "https://registry.yarnpkg.com/@types/intl-relativeformat/-/intl-relativeformat-2.1.0.tgz#3a2b0043380388f39c666665ec517e11412f1358" integrity sha512-AfsEUBFuVaTKL+t82wmU0yEvNjaZEIuGRCLUmgKQkn4nA5M84EbTrDobd8x/D3WohY34MBO5h9al5cGeLQ4Y1g== -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" - integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== "@types/istanbul-lib-report@*": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" - integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821" - integrity sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA== + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz#9153fe98bba2bd565a63add9436d6f0d7f8468ff" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== dependencies: "@types/istanbul-lib-report" "*" "@types/jest@*", "@types/jest@^27.4.0": - version "27.4.0" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.0.tgz#037ab8b872067cae842a320841693080f9cb84ed" - integrity sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ== + version "27.4.1" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.1.tgz#185cbe2926eaaf9662d340cc02e548ce9e11ab6d" + integrity sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw== dependencies: - jest-diff "^27.0.0" + jest-matcher-utils "^27.0.0" pretty-format "^27.0.0" "@types/joi@^13.4.2": @@ -3027,7 +3025,7 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.1.tgz#5c6f4a1eabca84792fbd916f0cb40847f123c656" integrity sha512-SGGAhXLHDx+PK4YLNcNGa6goPf9XRWQNAUUbffkwVGGXIxmDKWyGGL4inzq2sPmExu431Ekb9aEMn9BkPqEYFA== -"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.9": version "7.0.9" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== @@ -3673,110 +3671,84 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== -"@typescript-eslint/eslint-plugin@^3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.0.tgz#40fd53e81639c0d1a515b44e5fdf4c03dfd3cd39" - integrity sha512-Bbeg9JAnSzZ85Y0gpInZscSpifA6SbEgRryaKdP5ZlUjhTKsvZS4GUIE6xAZCjhNTrf4zXXsySo83ZdHL7it0w== +"@typescript-eslint/eslint-plugin@^5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz#c28ef7f2e688066db0b6a9d95fb74185c114fb9a" + integrity sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA== dependencies: - "@typescript-eslint/experimental-utils" "3.10.0" - debug "^4.1.1" + "@typescript-eslint/scope-manager" "5.15.0" + "@typescript-eslint/type-utils" "5.15.0" + "@typescript-eslint/utils" "5.15.0" + debug "^4.3.2" functional-red-black-tree "^1.0.1" - regexpp "^3.0.0" - semver "^7.3.2" - tsutils "^3.17.1" + ignore "^5.1.8" + regexpp "^3.2.0" + semver "^7.3.5" + tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.0.tgz#f97a669a84a78319ab324cd51169d0c52853a360" - integrity sha512-e5ZLSTuXgqC/Gq3QzK2orjlhTZVXzwxDujQmTBOM1NIVBZgW3wiIZjaXuVutk9R4UltFlwC9UD2+bdxsA7yyNg== +"@typescript-eslint/parser@^5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.15.0.tgz#95f603f8fe6eca7952a99bfeef9b85992972e728" + integrity sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ== dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.10.0" - "@typescript-eslint/typescript-estree" "3.10.0" - eslint-scope "^5.0.0" - eslint-utils "^2.0.0" + "@typescript-eslint/scope-manager" "5.15.0" + "@typescript-eslint/types" "5.15.0" + "@typescript-eslint/typescript-estree" "5.15.0" + debug "^4.3.2" -"@typescript-eslint/parser@^3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.0.tgz#820322d990a82265a78f4c1fc9aae03ce95b76ac" - integrity sha512-iJyf3f2HVwscvJR7ySGMXw2DJgIAPKEz8TeU17XVKzgJRV4/VgCeDFcqLzueRe7iFI2gv+Tln4AV88ZOnsCNXg== +"@typescript-eslint/scope-manager@5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz#d97afab5e0abf4018d1289bd711be21676cdd0ee" + integrity sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.10.0" - "@typescript-eslint/types" "3.10.0" - "@typescript-eslint/typescript-estree" "3.10.0" - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/types" "5.15.0" + "@typescript-eslint/visitor-keys" "5.15.0" -"@typescript-eslint/scope-manager@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz#59619e6e5e2b1ce6cb3948b56014d3a24da83f5e" - integrity sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ== +"@typescript-eslint/type-utils@5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz#d2c02eb2bdf54d0a645ba3a173ceda78346cf248" + integrity sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA== dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" - -"@typescript-eslint/types@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.0.tgz#b81906674eca94a884345ba0bc1aaf6cd4da912a" - integrity sha512-ktUWSa75heQNwH85GRM7qP/UUrXqx9d6yIdw0iLO9/uE1LILW+i+3+B64dUodUS2WFWLzKTlwfi9giqrODibWg== + "@typescript-eslint/utils" "5.15.0" + debug "^4.3.2" + tsutils "^3.21.0" -"@typescript-eslint/types@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8" - integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ== +"@typescript-eslint/types@5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.15.0.tgz#c7bdd103843b1abae97b5518219d3e2a0d79a501" + integrity sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA== -"@typescript-eslint/typescript-estree@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.0.tgz#65df13579a5e53c12afb4f1c5309589e3855a5de" - integrity sha512-yjuY6rmVHRhcUKgXaSPNVloRueGWpFNhxR5EQLzxXfiFSl1U/+FBqHhbaGwtPPEgCSt61QNhZgiFjWT27bgAyw== +"@typescript-eslint/typescript-estree@5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz#81513a742a9c657587ad1ddbca88e76c6efb0aac" + integrity sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA== dependencies: - "@typescript-eslint/types" "3.10.0" - "@typescript-eslint/visitor-keys" "3.10.0" - debug "^4.1.1" - glob "^7.1.6" - is-glob "^4.0.1" - lodash "^4.17.15" - semver "^7.3.2" - tsutils "^3.17.1" - -"@typescript-eslint/typescript-estree@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz#cabf545fd592722f0e2b4104711e63bf89525cd2" - integrity sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ== - dependencies: - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/visitor-keys" "5.12.0" + "@typescript-eslint/types" "5.15.0" + "@typescript-eslint/visitor-keys" "5.15.0" debug "^4.3.2" globby "^11.0.4" is-glob "^4.0.3" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@^5.10.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.12.0.tgz#92fd3193191621ab863add2f553a7b38b65646af" - integrity sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw== +"@typescript-eslint/utils@5.15.0", "@typescript-eslint/utils@^5.10.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.15.0.tgz#468510a0974d3ced8342f37e6c662778c277f136" + integrity sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.12.0" - "@typescript-eslint/types" "5.12.0" - "@typescript-eslint/typescript-estree" "5.12.0" + "@typescript-eslint/scope-manager" "5.15.0" + "@typescript-eslint/types" "5.15.0" + "@typescript-eslint/typescript-estree" "5.15.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@3.10.0": - version "3.10.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.0.tgz#6c0cac867e705a42e2c71b359bf6a10a88a28985" - integrity sha512-g4qftk8lWb/rHZe9uEp8oZSvsJhUvR2cfp7F7qE6DyUD2SsovEs8JDQTRP1xHzsD+pERsEpYNqkDgQXW6+ob5A== - dependencies: - eslint-visitor-keys "^1.1.0" - -"@typescript-eslint/visitor-keys@5.12.0": - version "5.12.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz#1ac9352ed140b07ba144ebf371b743fdf537ec16" - integrity sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg== +"@typescript-eslint/visitor-keys@5.15.0": + version "5.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz#5669739fbf516df060f978be6a6dce75855a8027" + integrity sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ== dependencies: - "@typescript-eslint/types" "5.12.0" + "@typescript-eslint/types" "5.15.0" eslint-visitor-keys "^3.0.0" "@webassemblyjs/ast@1.9.0": @@ -4097,21 +4069,20 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -airbnb-prop-types@^2.15.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz#5287820043af1eb469f5b0af0d6f70da6c52aaef" - integrity sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA== +airbnb-prop-types@^2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz#b96274cefa1abb14f623f804173ee97c13971dc2" + integrity sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg== dependencies: - array.prototype.find "^2.1.0" - function.prototype.name "^1.1.1" - has "^1.0.3" - is-regex "^1.0.4" - object-is "^1.0.1" + array.prototype.find "^2.1.1" + function.prototype.name "^1.1.2" + is-regex "^1.1.0" + object-is "^1.1.2" object.assign "^4.1.0" - object.entries "^1.1.0" + object.entries "^1.1.2" prop-types "^15.7.2" prop-types-exact "^1.2.0" - react-is "^16.9.0" + react-is "^16.13.1" ajv-errors@^1.0.0: version "1.0.0" @@ -4530,13 +4501,14 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -array.prototype.find@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.0.tgz#630f2eaf70a39e608ac3573e45cf8ccd0ede9ad7" - integrity sha512-Wn41+K1yuO5p7wRZDl7890c3xvv5UBrfVXTVIe28rSQb6LS0fZMDrQB6PAcxQFRFy6vJTLDc3A2+3CjQdzVKRg== +array.prototype.find@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.2.tgz#6abbd0c2573925d8094f7d23112306af8c16d534" + integrity sha512-00S1O4ewO95OmmJW7EesWfQlrCrLEL8kZ40w3+GkLX2yTt0m2ggcePPa2uHPJ9KUmJvwRq+lCV9bD8Yim23x/Q== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.13.0" + es-abstract "^1.19.0" array.prototype.flat@^1.2.3, array.prototype.flat@^1.2.5: version "1.2.5" @@ -5072,7 +5044,7 @@ bonjour@^3.5.0: multicast-dns "^6.0.1" multicast-dns-service-types "^1.1.0" -boolbase@~1.0.0: +boolbase@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= @@ -5620,39 +5592,29 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -cheerio@0.22.0: - version "0.22.0" - resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-0.22.0.tgz#a9baa860a3f9b595a6b81b1a86873121ed3a269e" - integrity sha1-qbqoYKP5tZWmuBsahocxIe06Jp4= - dependencies: - css-select "~1.2.0" - dom-serializer "~0.1.0" - entities "~1.1.1" - htmlparser2 "^3.9.1" - lodash.assignin "^4.0.9" - lodash.bind "^4.1.4" - lodash.defaults "^4.0.1" - lodash.filter "^4.4.0" - lodash.flatten "^4.2.0" - lodash.foreach "^4.3.0" - lodash.map "^4.4.0" - lodash.merge "^4.4.0" - lodash.pick "^4.2.1" - lodash.reduce "^4.4.0" - lodash.reject "^4.4.0" - lodash.some "^4.4.0" - -cheerio@^1.0.0-rc.3: - version "1.0.0-rc.3" - resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6" - integrity sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA== - dependencies: - css-select "~1.2.0" - dom-serializer "~0.1.1" - entities "~1.1.1" - htmlparser2 "^3.9.1" - lodash "^4.15.0" - parse5 "^3.0.1" +cheerio-select@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-1.5.0.tgz#faf3daeb31b17c5e1a9dabcee288aaf8aafa5823" + integrity sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg== + dependencies: + css-select "^4.1.3" + css-what "^5.0.1" + domelementtype "^2.2.0" + domhandler "^4.2.0" + domutils "^2.7.0" + +cheerio@^1.0.0-rc.10, cheerio@^1.0.0-rc.3: + version "1.0.0-rc.10" + resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.10.tgz#2ba3dcdfcc26e7956fc1f440e61d51c643379f3e" + integrity sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw== + dependencies: + cheerio-select "^1.5.0" + dom-serializer "^1.3.2" + domhandler "^4.2.0" + htmlparser2 "^6.1.0" + parse5 "^6.0.1" + parse5-htmlparser2-tree-adapter "^6.0.1" + tslib "^2.2.0" chokidar@3.3.0: version "3.3.0" @@ -6498,15 +6460,16 @@ css-loader@^5.2.7: schema-utils "^3.0.0" semver "^7.3.5" -css-select@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" - integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= +css-select@^4.1.3: + version "4.2.1" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.2.1.tgz#9e665d6ae4c7f9d65dbe69d0316e3221fb274cdd" + integrity sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ== dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" + boolbase "^1.0.0" + css-what "^5.1.0" + domhandler "^4.3.0" + domutils "^2.8.0" + nth-check "^2.0.1" css-to-react-native@^3.0.0: version "3.0.0" @@ -6525,10 +6488,10 @@ css-tree@^1.0.0-alpha.28: mdn-data "2.0.4" source-map "^0.6.1" -css-what@2.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" - integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== +css-what@^5.0.1, css-what@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.1.0.tgz#3f7b707aadf633baf62c2ceb8579b545bb40f7fe" + integrity sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw== css.escape@^1.5.1: version "1.5.1" @@ -7367,7 +7330,7 @@ dom-accessibility-api@^0.5.6, dom-accessibility-api@^0.5.9: resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.11.tgz#79d5846c4f90eba3e617d9031e921de9324f84ed" integrity sha512-7X6GvzjYf4yTdRKuCVScV+aA9Fvh5r8WzWrXBH9w82ZWB/eYDMGCnazoC/YAqAzUJWHzLOnZqr46K3iEyUhUvw== -dom-serializer@0, dom-serializer@~0.1.0, dom-serializer@~0.1.1: +dom-serializer@0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA== @@ -7375,6 +7338,15 @@ dom-serializer@0, dom-serializer@~0.1.0, dom-serializer@~0.1.1: domelementtype "^1.3.0" entities "^1.1.1" +dom-serializer@^1.0.1, dom-serializer@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.3.2.tgz#6206437d32ceefaec7161803230c7a20bc1b4d91" + integrity sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.2.0" + entities "^2.0.0" + dom-walk@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" @@ -7390,6 +7362,11 @@ domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== +domelementtype@^2.0.1, domelementtype@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" + integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== + domexception@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" @@ -7404,13 +7381,12 @@ domhandler@^2.3.0, domhandler@^2.4.2: dependencies: domelementtype "1" -domutils@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= +domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.0.tgz#16c658c626cf966967e306f966b431f77d4a5626" + integrity sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g== dependencies: - dom-serializer "0" - domelementtype "1" + domelementtype "^2.2.0" domutils@^1.5.1: version "1.7.0" @@ -7420,6 +7396,15 @@ domutils@^1.5.1: dom-serializer "0" domelementtype "1" +domutils@^2.5.2, domutils@^2.7.0, domutils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" + integrity sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A== + dependencies: + dom-serializer "^1.0.1" + domelementtype "^2.2.0" + domhandler "^4.2.0" + dot-prop@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb" @@ -7638,11 +7623,16 @@ enhanced-resolve@~0.9.0: memory-fs "^0.2.0" tapable "^0.1.8" -entities@^1.1.1, entities@~1.1.1: +entities@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== +entities@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" + integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== + entities@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" @@ -7658,47 +7648,49 @@ envinfo@^7.7.3: resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== -enzyme-adapter-react-16@^1.15.2: - version "1.15.2" - resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.2.tgz#b16db2f0ea424d58a808f9df86ab6212895a4501" - integrity sha512-SkvDrb8xU3lSxID8Qic9rB8pvevDbLybxPK6D/vW7PrT0s2Cl/zJYuXvsd1EBTz0q4o3iqG3FJhpYz3nUNpM2Q== +enzyme-adapter-react-16@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.6.tgz#fd677a658d62661ac5afd7f7f541f141f8085901" + integrity sha512-yFlVJCXh8T+mcQo8M6my9sPgeGzj85HSHi6Apgf1Cvq/7EL/J9+1JoJmJsRxZgyTvPMAqOEpRSu/Ii/ZpyOk0g== dependencies: - enzyme-adapter-utils "^1.13.0" - enzyme-shallow-equal "^1.0.1" + enzyme-adapter-utils "^1.14.0" + enzyme-shallow-equal "^1.0.4" has "^1.0.3" - object.assign "^4.1.0" - object.values "^1.1.1" + object.assign "^4.1.2" + object.values "^1.1.2" prop-types "^15.7.2" - react-is "^16.12.0" + react-is "^16.13.1" react-test-renderer "^16.0.0-0" semver "^5.7.0" -enzyme-adapter-utils@^1.13.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.0.tgz#01c885dde2114b4690bf741f8dc94cee3060eb78" - integrity sha512-YuEtfQp76Lj5TG1NvtP2eGJnFKogk/zT70fyYHXK2j3v6CtuHqc8YmgH/vaiBfL8K1SgVVbQXtTcgQZFwzTVyQ== +enzyme-adapter-utils@^1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.14.0.tgz#afbb0485e8033aa50c744efb5f5711e64fbf1ad0" + integrity sha512-F/z/7SeLt+reKFcb7597IThpDp0bmzcH1E9Oabqv+o01cID2/YInlqHbFl7HzWBl4h3OdZYedtwNDOmSKkk0bg== dependencies: - airbnb-prop-types "^2.15.0" - function.prototype.name "^1.1.2" - object.assign "^4.1.0" - object.fromentries "^2.0.2" + airbnb-prop-types "^2.16.0" + function.prototype.name "^1.1.3" + has "^1.0.3" + object.assign "^4.1.2" + object.fromentries "^2.0.3" prop-types "^15.7.2" semver "^5.7.1" -enzyme-shallow-equal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.1.tgz#7afe03db3801c9b76de8440694096412a8d9d49e" - integrity sha512-hGA3i1so8OrYOZSM9whlkNmVHOicJpsjgTzC+wn2JMJXhq1oO4kA4bJ5MsfzSIcC71aLDKzJ6gZpIxrqt3QTAQ== +enzyme-shallow-equal@^1.0.1, enzyme-shallow-equal@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz#b9256cb25a5f430f9bfe073a84808c1d74fced2e" + integrity sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q== dependencies: has "^1.0.3" - object-is "^1.0.2" + object-is "^1.1.2" -enzyme-to-json@^3.4.4: - version "3.4.4" - resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.4.4.tgz#b30726c59091d273521b6568c859e8831e94d00e" - integrity sha512-50LELP/SCPJJGic5rAARvU7pgE3m1YaNj7JLM+Qkhl5t7PAs6fiyc8xzc50RnkKPFQCv0EeFVjEWdIFRGPWMsA== +enzyme-to-json@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.6.2.tgz#94f85c413bcae8ab67be53b0a94b69a560e27823" + integrity sha512-Ynm6Z6R6iwQ0g2g1YToz6DWhxVnt8Dy1ijR2zynRKxTyBGA8rCDXU3rs2Qc4OKvUvc2Qoe1bcFK6bnPs20TrTg== dependencies: - lodash "^4.17.15" + "@types/cheerio" "^0.22.22" + lodash "^4.17.21" react-is "^16.12.0" enzyme@^3.11.0: @@ -7770,7 +7762,7 @@ error@^7.0.0: string-template "~0.2.1" xtend "~4.0.0" -es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.4, es-abstract@^1.17.5, es-abstract@^1.19.0, es-abstract@^1.19.1: +es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.4, es-abstract@^1.17.5, es-abstract@^1.19.0, es-abstract@^1.19.1: version "1.19.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== @@ -8136,10 +8128,10 @@ eslint-plugin-prettier@^3.1.4: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-react-hooks@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.4.tgz#aed33b4254a41b045818cacb047b81e6df27fa58" - integrity sha512-equAdEIsUETLFNCmmCkiCGq6rkSK5MoJhXFPFYeUebcjKgBmWWcgVOqZyQC8Bv1BwVCnTq9tBxgJFgAJTWoJtA== +eslint-plugin-react-hooks@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172" + integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA== eslint-plugin-react-perf@^3.2.3: version "3.2.3" @@ -9220,7 +9212,7 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.1.1, function.prototype.name@^1.1.2: +function.prototype.name@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.2.tgz#5cdf79d7c05db401591dfde83e3b70c5123e9a45" integrity sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg== @@ -9229,6 +9221,16 @@ function.prototype.name@^1.1.1, function.prototype.name@^1.1.2: es-abstract "^1.17.0-next.1" functions-have-names "^1.2.0" +function.prototype.name@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" @@ -9239,6 +9241,11 @@ functions-have-names@^1.2.0: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.0.tgz#83da7583e4ea0c9ac5ff530f73394b033e0bf77d" integrity sha512-zKXyzksTeaCSw5wIX79iCA40YAa6CJMJgNg9wdkU/ERBrIdPSimPICYiLp65lRbSBqtiHql/HZfS2DyI/AH6tQ== +functions-have-names@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.2.tgz#98d93991c39da9361f8e50b337c4f6e41f120e21" + integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA== + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -10269,7 +10276,7 @@ html@1.0.0: dependencies: concat-stream "^1.4.7" -htmlparser2@^3.10.0, htmlparser2@^3.9.1: +htmlparser2@^3.10.0: version "3.10.1" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== @@ -10281,6 +10288,16 @@ htmlparser2@^3.10.0, htmlparser2@^3.9.1: inherits "^2.0.1" readable-stream "^3.1.1" +htmlparser2@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" + integrity sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.0.0" + domutils "^2.5.2" + entities "^2.0.0" + http-cache-semantics@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" @@ -10463,7 +10480,7 @@ ignore@^5.0.5, ignore@^5.1.1: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -ignore@^5.2.0: +ignore@^5.1.8, ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== @@ -11173,7 +11190,7 @@ is-redirect@^1.0.0: resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= -is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.4: +is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== @@ -11437,9 +11454,9 @@ istanbul-lib-report@^3.0.0: supports-color "^7.1.0" istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== dependencies: debug "^4.1.1" istanbul-lib-coverage "^3.0.0" @@ -11553,7 +11570,7 @@ jest-config@^27.5.1: slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^27.0.0, jest-diff@^27.5.1: +jest-diff@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== @@ -11662,7 +11679,7 @@ jest-leak-detector@^27.5.1: jest-get-type "^27.5.1" pretty-format "^27.5.1" -jest-matcher-utils@^27.5.1: +jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== @@ -12576,16 +12593,6 @@ lodash-es@^4.17.11: resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== -lodash.assignin@^4.0.9: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.assignin/-/lodash.assignin-4.2.0.tgz#ba8df5fb841eb0a3e8044232b0e263a8dc6a28a2" - integrity sha1-uo31+4QesKPoBEIysOJjqNxqKKI= - -lodash.bind@^4.1.4: - version "4.2.1" - resolved "https://registry.yarnpkg.com/lodash.bind/-/lodash.bind-4.2.1.tgz#7ae3017e939622ac31b7d7d7dcb1b34db1690d35" - integrity sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU= - lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -12601,7 +12608,7 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= -lodash.defaults@^4.0.1, lodash.defaults@^4.2.0: +lodash.defaults@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw= @@ -12616,17 +12623,12 @@ lodash.escape@^4.0.1: resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-4.0.1.tgz#c9044690c21e04294beaa517712fded1fa88de98" integrity sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg= -lodash.filter@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace" - integrity sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4= - lodash.find@4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" integrity sha1-ywcE1Hq3F4n/oN6Ll92Sb7iLE7E= -lodash.flatten@^4.2.0, lodash.flatten@^4.4.0: +lodash.flatten@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= @@ -12636,11 +12638,6 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= -lodash.foreach@^4.3.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53" - integrity sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM= - lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" @@ -12686,17 +12683,12 @@ lodash.kebabcase@^4.0.0: resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= -lodash.map@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3" - integrity sha1-dx7Hg540c9nEzeKLGTlMNWL09tM= - lodash.max@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/lodash.max/-/lodash.max-4.0.1.tgz#8735566c618b35a9f760520b487ae79658af136a" integrity sha1-hzVWbGGLNan3YFILSHrnllivE2o= -lodash.merge@4.6.2, lodash.merge@^4.4.0: +lodash.merge@4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== @@ -12711,21 +12703,6 @@ lodash.padstart@4.6.1: resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b" integrity sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= -lodash.pick@^4.2.1: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" - integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= - -lodash.reduce@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b" - integrity sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs= - -lodash.reject@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.reject/-/lodash.reject-4.6.0.tgz#80d6492dc1470864bbf583533b651f42a9f52415" - integrity sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU= - lodash.repeat@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/lodash.repeat/-/lodash.repeat-4.1.0.tgz#fc7de8131d8c8ac07e4b49f74ffe829d1f2bec44" @@ -12736,11 +12713,6 @@ lodash.set@^4.3.2: resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= -lodash.some@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d" - integrity sha1-G7nzFO9ri63tE7VJFpsqlF62jk0= - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" @@ -12761,7 +12733,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.21, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.7.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.19, lodash@~4.17.21: +lodash@4.17.21, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.7.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.19, lodash@~4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -13990,12 +13962,12 @@ npmlog@^4.0.0, npmlog@^4.1.2: gauge "~2.7.3" set-blocking "~2.0.0" -nth-check@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" - integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== +nth-check@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.1.tgz#2efe162f5c3da06a28959fbd3db75dbeea9f0fc2" + integrity sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w== dependencies: - boolbase "~1.0.0" + boolbase "^1.0.0" number-is-nan@^1.0.0: version "1.0.1" @@ -14155,6 +14127,15 @@ object.fromentries@^2.0.2: function-bind "^1.1.1" has "^1.0.3" +object.fromentries@^2.0.3: + version "2.0.5" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.5.tgz#7b37b205109c21e741e605727fe8b0ad5fa08251" + integrity sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + object.getownpropertydescriptors@^2.0.3: version "2.1.0" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649" @@ -14178,7 +14159,7 @@ object.pick@^1.2.0, object.pick@^1.3.0: dependencies: isobject "^3.0.1" -object.values@^1.1.1, object.values@^1.1.5: +object.values@^1.1.1, object.values@^1.1.2, object.values@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== @@ -14601,18 +14582,18 @@ parse-passwd@^1.0.0: resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= -parse5@6.0.1: +parse5-htmlparser2-tree-adapter@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + +parse5@6.0.1, parse5@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== -parse5@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" - integrity sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA== - dependencies: - "@types/node" "*" - parse5@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" @@ -15966,6 +15947,11 @@ regexpp@^3.0.0: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + regexpu-core@^4.7.1: version "4.8.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.8.0.tgz#e5605ba361b67b1718478501327502f4479a98f0" @@ -18365,7 +18351,7 @@ tslib@^1.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.3.0: +tslib@^2.0.0, tslib@^2.2.0, tslib@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== @@ -18375,7 +18361,7 @@ tslib@~2.0.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c" integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ== -tsutils@^3.17.1, tsutils@^3.21.0: +tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== @@ -18481,10 +18467,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@4.0.2, typescript@~4.5.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2" - integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== +typescript@4.1.6, typescript@~4.5.2: + version "4.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.6.tgz#1becd85d77567c3c741172339e93ce2e69932138" + integrity sha512-pxnwLxeb/Z5SP80JDRzVjh58KsM6jZHRAOtTpS7sXLS4ogXNKC9ANxHHZqLLeVHZN35jCtI4JdmLLbLiC1kBow== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.5"