From 8e33145e7de32b2edeec2cdfe49ce97403f91a02 Mon Sep 17 00:00:00 2001 From: Tommy Markley Date: Tue, 15 Mar 2022 17:38:17 +0000 Subject: [PATCH] Upgrades TypeScript to 4.1, simplifies jest config * Addressing the `nth-check` CVE required bumping `css-select`, which is a dependency of `cheerio`. Bumping `cheerio` requires upgrading from TypeScript 4.0 to 4.1. * TypeScript 4.1 introduces a set of [breaking changes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#breaking-changes). The main changes that impact Dashboards is that `resolve`'s parameters are no longer optional in `Promise`s, and that potentially undefined indexes must use the `!` non-null assertion operator. * The upgrades to TypeScript and `cheerio` triggered some jest errors which prompted the upgrade to the `enzyme` dependencies. * Merges files under `/src/test_utils` and `/src/dev/jest` into the `@osd/test` package to simplify. * Fixes the naming of the `@osd/eslint-config-opensearch-dashboards` package. * Fixes inconsistent plugin installation tests. Resolves #1081 Signed-off-by: Tommy Markley Signed-off-by: Miki --- .eslintrc.js | 2 +- examples/bfetch_explorer/server/plugin.ts | 2 +- .../public/book/edit_book_action.tsx | 2 +- .../public/todo/todo.tsx | 2 +- .../with_data_services/components/app.tsx | 1 + package.json | 21 +- .../README.md | 8 +- .../package.json | 10 +- .../typescript.js | 177 +++++------ packages/osd-ace/package.json | 2 +- packages/osd-analytics/package.json | 2 +- packages/osd-apm-config-loader/package.json | 2 +- packages/osd-config-schema/package.json | 2 +- packages/osd-config/package.json | 2 +- packages/osd-dev-utils/package.json | 4 +- .../ci_stats_reporter/ci_stats_reporter.ts | 2 +- .../src/osd_client/osd_client_requester.ts | 2 +- .../osd-dev-utils/src/proc_runner/proc.ts | 2 +- .../src/proc_runner/proc_runner.ts | 2 +- .../src/proc_runner/with_proc_runner.test.ts | 4 +- .../src/run/run_with_commands.test.ts | 2 +- .../lib/get_webpack_config.js | 1 - packages/osd-i18n/GUIDELINE.md | 2 +- packages/osd-i18n/package.json | 2 +- packages/osd-i18n/src/react/index.tsx | 4 +- packages/osd-logging/package.json | 2 +- packages/osd-monaco/package.json | 2 +- packages/osd-opensearch-archiver/package.json | 1 + packages/osd-opensearch-archiver/src/cli.ts | 2 +- .../src/lib/archives/__tests__/parse.ts | 2 +- .../src/lib/indices/delete_index.ts | 2 +- .../src/common/event_stream_helpers.test.ts | 2 +- packages/osd-optimizer/src/node/cache.ts | 4 +- .../src/worker/bundle_refs_plugin.ts | 2 +- .../template/.eslintrc.js.ejs | 2 +- packages/osd-plugin-helpers/package.json | 2 +- packages/osd-pm/package.json | 2 +- packages/osd-pm/src/utils/parallelize.test.ts | 4 +- packages/osd-std/package.json | 2 +- packages/osd-std/src/promise.test.ts | 4 +- packages/osd-std/src/promise.ts | 4 +- packages/osd-telemetry-tools/package.json | 2 +- .../extract_collectors.test.ts.snap | 32 +- .../tools/check_collector__integrity.test.ts | 1 - packages/osd-test/jest-preset.js | 99 +++++++ packages/osd-test/jest/package.json | 4 + packages/osd-test/package.json | 12 +- packages/osd-test/scripts/build.js | 77 +++++ .../src/failed_tests_reporter/github_api.ts | 2 +- .../lib/mocha/reporter/reporter.js | 3 +- .../lib/mocha/run_tests.ts | 2 +- packages/osd-test/src/index.ts | 9 +- .../osd-test/src}/jest/babel_transform.js | 0 packages/osd-test/src/jest/index.ts | 6 + .../__fixtures__/jest.config.js | 23 ++ .../integration_tests/__fixtures__/test.js | 0 .../osd-test/src/jest/junit_reporter.ts | 38 ++- .../src}/jest/mocks/css_module_mock.js | 0 .../osd-test/src}/jest/mocks/file_mock.js | 0 .../osd-test/src}/jest/mocks/style_mock.js | 0 .../src}/jest/mocks/worker_module_mock.js | 0 .../src}/jest/setup/after_env.integration.js | 0 .../src}/jest/setup/babel_polyfill.js | 0 .../osd-test/src}/jest/setup/enzyme.js | 0 .../osd-test/src}/jest/setup/mocks.js | 0 .../osd-test/src}/jest/setup/polyfills.js | 0 .../src/jest/setup/react_mount_serializer.ts | 23 +- .../src}/jest/setup/react_testing_library.js | 0 .../osd-test/src/jest/setup/setup_test.js | 6 + .../src/jest/utils}/enzyme_helpers.tsx | 0 .../src/jest/utils}/find_test_subject.ts | 0 .../osd-test/src/jest/utils/get_url.test.ts | 52 ++++ packages/osd-test/src/jest/utils/get_url.ts | 61 ++++ packages/osd-test/src/jest/utils/index.ts | 26 ++ .../src/jest/utils}/jsdom_svg_mocks.ts | 0 .../osd-test/src/jest/utils/random.ts | 2 - .../src/jest/utils}/redux_helpers.tsx | 0 .../src/jest/utils}/router_helpers.tsx | 7 +- .../jest/utils}/stub_browser_storage.test.ts | 0 .../src/jest/utils}/stub_browser_storage.ts | 0 .../src/jest/utils/stub_web_worker.ts | 22 ++ .../osd-test/src/jest/utils}/testbed/index.ts | 0 .../jest/utils}/testbed/mount_component.tsx | 3 +- .../src/jest/utils}/testbed/testbed.ts | 38 ++- .../osd-test/src/jest/utils}/testbed/types.ts | 3 +- .../mocha/__tests__/fixtures/project/test.js | 0 .../__tests__/junit_report_generation.js | 2 +- .../src}/mocha/auto_junit_reporter.js | 0 .../osd-test/src/mocha/index.ts | 3 + .../src}/mocha/junit_report_generation.js | 6 +- .../osd-test/src}/mocha/log_cache.js | 0 .../osd-test/src}/mocha/run_mocha_cli.js | 2 +- .../src}/mocha/server_junit_reporter.js | 2 +- .../osd-test/src/mocha}/xml.ts | 0 .../{junit_report_path.ts => report_path.ts} | 0 packages/osd-test/tsconfig.json | 16 +- packages/osd-ui-framework/package.json | 4 +- packages/osd-utils/package.json | 2 +- scripts/mocha.js | 2 +- src/cli/cluster/worker.ts | 6 +- .../reload_logging_config.test.ts | 6 +- src/cli_plugin/install/settings.test.js | 6 +- .../application/application_service.test.ts | 4 +- .../application_service.test.tsx | 10 +- .../application/integration_tests/utils.tsx | 2 +- .../application/ui/app_container.test.tsx | 4 +- ...opensearch_dashboards_custom_logo.test.tsx | 2 +- .../chrome/ui/header/collapsible_nav.test.tsx | 2 +- .../public/chrome/ui/header/header.test.tsx | 4 +- .../ui/header/header_action_menu.test.tsx | 4 +- .../status/components/server_status.test.tsx | 2 +- .../fatal_errors/fatal_errors_screen.test.tsx | 2 +- .../moment/moment_service.test.ts | 2 +- .../styles/styles_service.test.ts | 2 +- .../notifications/toasts/error_toast.test.tsx | 2 +- .../public/overlays/modal/modal_service.tsx | 2 +- src/core/public/plugins/plugin.test.ts | 2 +- .../public/plugins/plugins_service.test.ts | 4 +- .../saved_objects/saved_objects_client.ts | 2 +- .../public/ui_settings/ui_settings_api.ts | 2 +- src/core/public/utils/crypto/sha256.ts | 2 +- .../http/cookie_session_storage.test.ts | 2 +- src/core/server/http/http_tools.test.ts | 2 +- .../http/integration_tests/request.test.ts | 2 +- .../http/integration_tests/router.test.ts | 6 +- .../appenders/file/file_appender.test.ts | 2 +- .../logging/appenders/file/file_appender.ts | 2 +- src/core/server/metrics/collectors/process.ts | 2 +- .../server_collector.test.ts | 4 +- .../server/metrics/metrics_service.test.ts | 4 +- .../opensearch/client/cluster_client.test.ts | 4 +- .../opensearch/legacy/cluster_client.ts | 2 +- .../opensearch/opensearch_service.test.ts | 2 +- .../integration_tests/plugins_service.test.ts | 2 +- src/core/server/plugins/plugin.test.ts | 2 +- .../server/plugins/plugins_system.test.ts | 4 +- .../server/rendering/views/template.test.tsx | 2 +- .../migrations/core/migrate_raw_docs.ts | 2 +- .../migrations/core/migration_coordinator.ts | 2 +- .../migrations/core/opensearch_index.ts | 4 +- src/core/server/status/plugins_status.test.ts | 2 +- src/core/server/status/status_service.test.ts | 2 +- .../server/utils/streams/list_stream.test.ts | 4 +- .../streams/promise_from_streams.test.ts | 6 +- .../utils/streams/promise_from_streams.ts | 2 +- .../utils/streams/reduce_stream.test.ts | 2 +- src/core/tsconfig.json | 3 - src/dev/build/lib/download.ts | 2 +- src/dev/build/lib/fs.ts | 2 +- src/dev/build/tasks/copy_source_task.ts | 1 - src/dev/index.js | 2 +- src/dev/jest/config.integration.js | 10 +- src/dev/jest/config.js | 63 +--- .../__fixtures__/package.json | 14 - .../integration_tests/junit_reporter.test.js | 104 ------- src/dev/precommit_hook/casing_check_config.js | 1 + src/dev/typescript/projects.ts | 1 - .../page_footer/page_footer.test.tsx | 2 +- .../page_subtitle/page_subtitle.test.tsx | 2 +- .../page_title/page_title.test.tsx | 2 +- .../management_app/advanced_settings.test.tsx | 2 +- .../components/field/field.test.tsx | 2 +- .../management_app/components/field/field.tsx | 2 - .../components/form/form.test.tsx | 2 +- .../components/search/search.test.tsx | 2 +- .../tests/create_batched_function.test.ts | 2 +- .../create_streaming_batched_function.test.ts | 44 +-- .../public/streaming/fetch_streaming.test.ts | 2 +- .../charts/public/services/theme/theme.ts | 6 - .../legacy/console_editor/editor.test.tsx | 2 +- .../send_request_to_opensearch.ts | 2 +- .../legacy_core_editor/legacy_core_editor.ts | 4 +- .../dashboard_empty_screen.test.tsx | 2 +- .../embeddable/dashboard_container.test.tsx | 2 +- .../embeddable/grid/dashboard_grid.test.tsx | 2 +- .../embeddable/grid/dashboard_grid.tsx | 2 - .../viewport/dashboard_viewport.test.tsx | 6 +- .../tests/dashboard_container.test.tsx | 2 +- .../application/top_nav/clone_modal.test.js | 2 +- .../application/top_nav/save_modal.test.js | 2 +- .../search/search_source/legacy/fetch_soon.ts | 2 +- .../public/actions/apply_filter_action.ts | 2 +- .../redirect_no_index_pattern.tsx | 2 +- .../query_string/query_string_manager.test.ts | 2 +- .../state_sync/connect_to_query_state.test.ts | 2 +- .../state_sync/sync_state_with_url.test.ts | 2 +- .../language_switcher.test.tsx | 2 +- .../no_data_popover.test.tsx | 2 +- .../query_string_input/query_bar_top_row.tsx | 1 - .../data/public/ui/search_bar/search_bar.tsx | 1 - .../shard_failure_description.test.tsx | 2 +- .../shard_failure_modal.test.tsx | 2 +- .../shard_failure_open_modal_button.test.tsx | 2 +- .../shard_failure_table.test.tsx | 2 +- .../components/action_bar/action_bar.test.tsx | 2 +- .../angular/directives/no_results.test.js | 2 +- .../pager/tool_bar_pager_buttons.test.tsx | 2 +- .../pager/tool_bar_pager_text.test.tsx | 2 +- .../table_header/table_header.test.tsx | 2 +- .../context_error_message.test.tsx | 2 +- .../application/components/doc/doc.test.tsx | 4 +- .../hits_counter/hits_counter.test.tsx | 2 +- .../loading_spinner/loading_spinner.test.tsx | 2 +- .../sidebar/discover_field.test.tsx | 2 +- .../sidebar/discover_field_details.test.tsx | 2 +- .../sidebar/discover_field_search.test.tsx | 2 +- .../sidebar/discover_index_pattern.test.tsx | 2 +- .../sidebar/discover_sidebar.test.tsx | 2 +- .../skip_bottom_button.test.tsx | 2 +- .../timechart_header.test.tsx | 2 +- .../public/lib/containers/container.ts | 2 +- .../embeddable_child_panel.test.tsx | 2 +- .../lib/panel/embeddable_panel.test.tsx | 2 +- .../add_panel/add_panel_flyout.test.tsx | 4 +- .../saved_object_finder_create_new.test.tsx | 2 +- .../customize_panel_action.test.ts | 2 +- .../lib/panel/panel_header/panel_header.tsx | 1 - .../contact_card_embeddable_factory.tsx | 2 +- src/plugins/embeddable/public/plugin.test.ts | 2 +- .../embeddable/public/tests/container.test.ts | 4 +- .../tests/customize_panel_modal.test.tsx | 2 +- .../common/execution/execution.test.ts | 4 +- .../expression_functions/sleep.ts | 2 +- .../components/add_data/add_data.test.tsx | 2 +- .../manage_data/manage_data.test.tsx | 2 +- .../components/recently_accessed.test.js | 2 +- .../tutorial/instruction_set.test.js | 2 +- .../components/tutorial/introduction.test.js | 2 +- .../tutorial/saved_objects_installer.test.js | 2 +- .../components/tutorial/tutorial.test.js | 2 +- .../services/sample_data/lib/load_data.ts | 2 +- .../components/header/header.test.tsx | 2 +- .../components/header/header.test.tsx | 2 +- .../step_index_pattern.test.tsx | 10 +- .../advanced_options.test.tsx | 2 +- .../components/time_field/time_field.test.tsx | 2 +- .../lib/ensure_minimum_time.ts | 2 +- .../indexed_fields_table.test.tsx | 6 +- .../components/header/header.test.tsx | 2 +- .../editors/color/color.test.tsx | 2 +- .../static_lookup/static_lookup.test.tsx | 2 +- .../url/label_template_flyout.test.tsx | 2 +- .../editors/url/url_template_flyout.test.tsx | 2 +- .../samples/samples.test.tsx | 2 +- .../warning_call_out.test.tsx | 2 +- .../field_editor/field_editor.test.tsx | 10 +- .../empty_index_pattern_prompt.test.tsx | 2 +- .../empty_state/empty_state.test.tsx | 2 +- .../components/editor/controls_tab.test.tsx | 2 +- .../editor/list_control_editor.test.tsx | 2 +- .../components/editor/options_tab.test.tsx | 2 +- .../editor/range_control_editor.test.tsx | 2 +- .../components/vis/input_control_vis.test.tsx | 2 +- .../components/vis/list_control.test.tsx | 2 +- .../components/vis/range_control.test.tsx | 2 +- .../public/test_utils/update_component.ts | 2 +- .../public/ui/inspector_panel.test.tsx | 2 +- .../views/data/components/data_view.test.tsx | 2 +- .../public/get_service_settings.ts | 2 +- .../public/lazy_load_bundle/index.ts | 2 +- .../public/top_nav_menu/top_nav_menu.test.tsx | 2 +- .../top_nav_menu/top_nav_menu_item.test.tsx | 2 +- .../components/add_data/add_data.test.tsx | 2 +- .../getting_started/getting_started.test.tsx | 2 +- .../manage_data/manage_data.test.tsx | 2 +- .../components/news_feed/news_feed.test.tsx | 2 +- .../components/overview/overview.test.tsx | 2 +- .../overview_page_footer.test.tsx | 2 +- .../overview_page_header.test.tsx | 2 +- .../use_url_tracker/use_url_tracker.test.tsx | 2 +- .../server/collectors/management/schema.ts | 1 - .../common/defer.test.ts | 2 +- .../common/of.test.ts | 4 +- ...ate_state_container_react_helpers.test.tsx | 22 +- .../demos/state_sync/url.ts | 6 +- .../core/create_start_service_getter.test.ts | 12 +- .../url/osd_url_tracker.test.ts | 2 +- .../state_management/url/url_tracker.test.ts | 2 +- .../public/state_sync/state_sync.test.ts | 6 +- ...eate_session_storage_state_storage.test.ts | 2 +- .../hashed_item_store.test.ts | 2 +- .../public/storage/hashed_item_store/mock.ts | 2 +- .../opensearch_dashboards_utils/tsconfig.json | 1 - .../request/use_request.test.helpers.tsx | 2 +- .../forms/hook_form_lib/hooks/use_field.ts | 1 + .../forms/hook_form_lib/hooks/use_form.ts | 2 +- .../forms/hook_form_lib/shared_imports.ts | 4 +- .../finder/saved_object_finder.test.tsx | 2 +- .../saved_object_save_modal.test.tsx | 2 +- .../public/lib/import_legacy_file.ts | 2 +- .../objects_table/components/flyout.test.tsx | 24 +- .../components/import_mode_control.test.tsx | 2 +- .../components/import_summary.test.tsx | 2 +- .../components/overwrite_modal.test.tsx | 2 +- .../components/relationships.test.tsx | 22 +- .../objects_table/components/table.test.tsx | 2 +- .../saved_objects_table.test.tsx | 30 +- .../public/components/opt_in_banner.test.tsx | 2 +- .../public/components/opt_in_message.test.tsx | 2 +- .../opted_in_notice_banner.test.tsx | 2 +- .../components/opt_in_example_flyout.test.tsx | 2 +- .../opt_in_security_example_flyout.test.tsx | 2 +- .../telemetry_management_section.test.tsx | 2 +- .../telemetry_management_section.tsx | 2 +- .../public/directives/saved_object_finder.js | 23 +- .../server/collector/collector_set.test.ts | 2 +- .../number_list/number_list.test.tsx | 2 +- .../components/controls/date_ranges.test.tsx | 2 +- .../components/controls/percentiles.test.tsx | 2 +- .../public/components/controls/size.test.tsx | 2 +- .../controls/top_aggregate.test.tsx | 2 +- .../public/components/metric_vis_value.tsx | 2 - .../vis_type_table/public/vis_controller.ts | 2 +- .../public/components/tag_cloud.test.js | 2 +- .../tag_cloud_visualization.test.js | 2 +- .../components/add_delete_buttons.test.tsx | 2 +- .../components/aggs/agg_select.test.tsx | 2 +- .../components/aggs/filter_ratio.test.js | 2 +- .../components/aggs/histogram_support.test.js | 2 +- .../components/color_rules.test.js | 2 +- .../components/panel_config/gauge.test.js | 2 +- .../components/vis_types/gauge/series.test.js | 2 +- .../vis_types/metric/series.test.js | 2 +- .../application/components/yes_no.test.js | 2 +- .../metrics_axes/value_axes_panel.test.tsx | 2 +- .../vis_type_vislib/public/vis_controller.tsx | 2 +- .../vislib/components/legend/legend.tsx | 3 +- .../vislib/components/legend/legend_item.tsx | 1 - .../public/vislib/lib/chart_title.test.js | 2 +- .../public/vislib/lib/dispatch.test.js | 2 +- .../public/vislib/lib/handler.test.js | 2 +- .../public/vislib/lib/layout/layout.test.js | 2 +- .../vis_type_vislib/public/vislib/vis.test.js | 2 +- .../vislib/visualizations/chart.test.js | 2 +- .../vislib/visualizations/gauge_chart.test.js | 2 +- .../vislib/visualizations/pie_chart.test.js | 2 +- .../point_series/area_chart.test.js | 2 +- .../point_series/column_chart.test.js | 2 +- .../point_series/heatmap_chart.test.js | 2 +- .../point_series/line_chart.test.js | 2 +- src/plugins/visualizations/public/vis.test.ts | 2 +- src/plugins/visualizations/public/vis.ts | 1 + .../public/vis_types/react_vis_controller.tsx | 2 +- .../public/wizard/new_vis_modal.test.tsx | 2 +- .../type_selection/new_vis_help.test.tsx | 2 +- .../utils/use/use_visualize_app_state.test.ts | 2 +- src/test_utils/__tests__/get_url.js | 78 ----- src/test_utils/get_url.js | 66 ----- src/test_utils/public/index.ts | 36 --- src/test_utils/public/key_map.ts | 132 --------- src/test_utils/tsconfig.json | 16 - test/common/services/deployment.ts | 3 +- .../services/retry/retry_for_success.ts | 2 +- .../bfetch_explorer/batched_function.ts | 6 +- .../edit_saved_object.ts | 2 +- test/functional/page_objects/common_page.ts | 3 +- test/functional/page_objects/context_page.ts | 3 +- .../web_element_wrapper.ts | 1 - .../services/remote/prevent_parallel_calls.ts | 2 +- .../plugins/osd_tp_run_pipeline/package.json | 2 +- .../plugins/app_link_test/package.json | 2 +- .../plugins/core_app_status/package.json | 2 +- .../plugins/core_plugin_a/package.json | 2 +- .../plugins/core_plugin_appleave/package.json | 2 +- .../plugins/core_plugin_b/package.json | 2 +- .../core_plugin_chromeless/package.json | 2 +- .../core_plugin_route_timeouts/package.json | 2 +- .../server/plugin.ts | 4 +- .../core_plugin_static_assets/package.json | 2 +- .../plugins/core_provider_plugin/package.json | 2 +- .../core_provider_plugin/public/index.ts | 2 +- .../plugins/data_search/package.json | 2 +- .../plugins/doc_views_plugin/package.json | 2 +- .../plugins/index_patterns/package.json | 2 +- .../management_test_plugin/package.json | 2 +- .../opensearch_client_plugin/package.json | 2 +- .../osd_sample_panel_action/package.json | 2 +- .../plugins/osd_top_nav/package.json | 2 +- .../osd_tp_custom_visualizations/package.json | 2 +- .../plugins/rendering_plugin/package.json | 2 +- .../plugins/ui_settings_plugin/package.json | 2 +- .../http/platform/headers.ts | 8 +- tsconfig.base.json | 3 - tsconfig.json | 3 - tsconfig.refs.json | 1 - yarn.lock | 275 +++--------------- 386 files changed, 1105 insertions(+), 1405 deletions(-) create mode 100644 packages/osd-test/jest-preset.js create mode 100644 packages/osd-test/jest/package.json create mode 100644 packages/osd-test/scripts/build.js rename {src/dev => packages/osd-test/src}/jest/babel_transform.js (100%) create mode 100644 packages/osd-test/src/jest/index.ts create mode 100644 packages/osd-test/src/jest/integration_tests/__fixtures__/jest.config.js rename {src/dev => packages/osd-test/src}/jest/integration_tests/__fixtures__/test.js (100%) rename src/dev/jest/junit_reporter.js => packages/osd-test/src/jest/junit_reporter.ts (75%) rename {src/dev => packages/osd-test/src}/jest/mocks/css_module_mock.js (100%) rename {src/dev => packages/osd-test/src}/jest/mocks/file_mock.js (100%) rename {src/dev => packages/osd-test/src}/jest/mocks/style_mock.js (100%) rename {src/dev => packages/osd-test/src}/jest/mocks/worker_module_mock.js (100%) rename {src/dev => packages/osd-test/src}/jest/setup/after_env.integration.js (100%) rename {src/dev => packages/osd-test/src}/jest/setup/babel_polyfill.js (100%) rename {src/dev => packages/osd-test/src}/jest/setup/enzyme.js (100%) rename {src/dev => packages/osd-test/src}/jest/setup/mocks.js (100%) rename {src/dev => packages/osd-test/src}/jest/setup/polyfills.js (100%) rename src/test_utils/public/helpers/index.ts => packages/osd-test/src/jest/setup/react_mount_serializer.ts (74%) rename {src/dev => packages/osd-test/src}/jest/setup/react_testing_library.js (100%) create mode 100644 packages/osd-test/src/jest/setup/setup_test.js rename {src/test_utils/public => packages/osd-test/src/jest/utils}/enzyme_helpers.tsx (100%) rename {src/test_utils/public/helpers => packages/osd-test/src/jest/utils}/find_test_subject.ts (100%) create mode 100644 packages/osd-test/src/jest/utils/get_url.test.ts create mode 100644 packages/osd-test/src/jest/utils/get_url.ts create mode 100644 packages/osd-test/src/jest/utils/index.ts rename {src/test_utils/public/helpers => packages/osd-test/src/jest/utils}/jsdom_svg_mocks.ts (100%) rename src/test_utils/public/helpers/utils.ts => packages/osd-test/src/jest/utils/random.ts (94%) rename {src/test_utils/public/helpers => packages/osd-test/src/jest/utils}/redux_helpers.tsx (100%) rename {src/test_utils/public/helpers => packages/osd-test/src/jest/utils}/router_helpers.tsx (94%) rename {src/test_utils/public => packages/osd-test/src/jest/utils}/stub_browser_storage.test.ts (100%) rename {src/test_utils/public => packages/osd-test/src/jest/utils}/stub_browser_storage.ts (100%) create mode 100644 packages/osd-test/src/jest/utils/stub_web_worker.ts rename {src/test_utils/public => packages/osd-test/src/jest/utils}/testbed/index.ts (100%) rename {src/test_utils/public => packages/osd-test/src/jest/utils}/testbed/mount_component.tsx (96%) rename {src/test_utils/public => packages/osd-test/src/jest/utils}/testbed/testbed.ts (90%) rename {src/test_utils/public => packages/osd-test/src/jest/utils}/testbed/types.ts (98%) rename {src/dev => packages/osd-test/src}/mocha/__tests__/fixtures/project/test.js (100%) rename {src/dev => packages/osd-test/src}/mocha/__tests__/junit_report_generation.js (98%) rename {src/dev => packages/osd-test/src}/mocha/auto_junit_reporter.js (100%) rename src/dev/mocha/index.js => packages/osd-test/src/mocha/index.ts (91%) rename {src/dev => packages/osd-test/src}/mocha/junit_report_generation.js (96%) rename {src/dev => packages/osd-test/src}/mocha/log_cache.js (100%) rename {src/dev => packages/osd-test/src}/mocha/run_mocha_cli.js (97%) rename {src/dev => packages/osd-test/src}/mocha/server_junit_reporter.js (96%) rename {src/dev => packages/osd-test/src/mocha}/xml.ts (100%) rename packages/osd-test/src/{junit_report_path.ts => report_path.ts} (100%) delete mode 100644 src/dev/jest/integration_tests/__fixtures__/package.json delete mode 100644 src/dev/jest/integration_tests/junit_reporter.test.js delete mode 100644 src/test_utils/__tests__/get_url.js delete mode 100644 src/test_utils/get_url.js delete mode 100644 src/test_utils/public/index.ts delete mode 100644 src/test_utils/public/key_map.ts delete mode 100644 src/test_utils/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 0640b9b9105..090caea6f09 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -115,7 +115,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 7129f3c699b..4bc8d7cfd73 100644 --- a/examples/bfetch_explorer/server/plugin.ts +++ b/examples/bfetch_explorer/server/plugin.ts @@ -65,7 +65,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 943918017a9..3b310743307 100644 --- a/examples/embeddable_examples/public/book/edit_book_action.tsx +++ b/examples/embeddable_examples/public/book/edit_book_action.tsx @@ -80,7 +80,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 263c2b92722..3acf3d087f6 100644 --- a/examples/state_containers_examples/public/todo/todo.tsx +++ b/examples/state_containers_examples/public/todo/todo.tsx @@ -324,7 +324,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 d706790762e..8455b2a2272 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 @@ -191,6 +191,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 4f8543f2d24..8b15e1e2411 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "**/node-jose": "^2.1.0", "**/qs": "^6.10.3", "**/trim": "^0.0.3", - "**/typescript": "4.0.2", + "**/typescript": "4.1.6", "**/@types/react": "^16.14.23" }, "workspaces": { @@ -216,7 +216,6 @@ "@elastic/apm-rum": "^5.6.1", "@elastic/charts": "31.1.0", "@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", @@ -225,6 +224,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", @@ -257,7 +257,7 @@ "@types/deep-freeze-strict": "^1.1.0", "@types/delete-empty": "^2.0.0", "@types/elasticsearch": "^5.0.33", - "@types/enzyme": "^3.10.7", + "@types/enzyme": "^3.10.11", "@types/eslint": "^6.1.3", "@types/fetch-mock": "^7.3.1", "@types/flot": "^0.0.31", @@ -272,6 +272,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", @@ -322,8 +323,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", @@ -336,7 +337,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.3.1", "compare-versions": "3.5.1", @@ -345,8 +346,8 @@ "dedent": "^0.7.0", "delete-empty": "^2.0.0", "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.5", - "enzyme-to-json": "^3.5.0", + "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", @@ -362,7 +363,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", @@ -439,7 +440,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 4fb3f13c8f2..ea23347cb39 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 1cafb013a60..e4edae620f4 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 367b5db2b5b..22b2865dc42 100644 --- a/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js +++ b/packages/opensearch-eslint-config-opensearch-dashboards/typescript.js @@ -36,8 +36,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. @@ -50,7 +49,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': { @@ -72,10 +77,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 @@ -84,7 +88,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 @@ -94,45 +98,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', { @@ -140,8 +138,8 @@ module.exports = { format: ['camelCase'], filter: { regex: allowedNameRegexp, - match: false, - }, + match: false + } }, { selector: 'variable', @@ -152,40 +150,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', @@ -197,51 +198,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', @@ -253,7 +268,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', @@ -263,33 +277,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 5a2f3141ddd..2a9a3554512 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 d460ab335a2..a4106d97152 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 261b7495046..4080cd8c879 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 5e727f3423c..042247e46ea 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 a9c0d2875c2..9ef6b3ac6ad 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 3177d8b9fb5..c98b55bc4d5 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 d7a82b7c802..3dd3f506681 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 @@ -172,7 +172,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 effa5da6dd7..8f29a8db6ef 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 @@ -77,7 +77,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 1de472df40b..b3e45d55bec 100644 --- a/packages/osd-dev-utils/src/proc_runner/proc.ts +++ b/packages/osd-dev-utils/src/proc_runner/proc.ts @@ -63,7 +63,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 b75a9797ae8..4230f280a34 100644 --- a/packages/osd-dev-utils/src/proc_runner/proc_runner.ts +++ b/packages/osd-dev-utils/src/proc_runner/proc_runner.ts @@ -148,7 +148,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 00b1009033e..510d8c2d992 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 @@ -65,7 +65,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'); }); @@ -79,7 +79,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 21857716c06..e6f242c3ce3 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 @@ -58,7 +58,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 aad40da879a..062582b672b 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 @@ -40,7 +40,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 ae5b2b5ca29..80bf4f84101 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 e3acaba5860..a8b9e1c9986 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 ca6a93f0cd2..9180715f2f3 100644 --- a/packages/osd-i18n/src/react/index.tsx +++ b/packages/osd-i18n/src/react/index.tsx @@ -29,9 +29,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 1d8374ced5e..8e381f6ca34 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 8754663f891..3442c69d31c 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 e1c28cc4748..576602eb4bb 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 39dbbb264cd..6e4605871ca 100644 --- a/packages/osd-opensearch-archiver/src/cli.ts +++ b/packages/osd-opensearch-archiver/src/cli.ts @@ -239,7 +239,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 bdcd9d0cd90..ee6e173f098 100644 --- a/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts +++ b/packages/osd-opensearch-archiver/src/lib/archives/__tests__/parse.ts @@ -80,7 +80,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 ee8fe10d8d0..c48f4c1094f 100644 --- a/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts +++ b/packages/osd-opensearch-archiver/src/lib/indices/delete_index.ts @@ -120,7 +120,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 7fc757e4363..99a9ee072db 100644 --- a/packages/osd-optimizer/src/common/event_stream_helpers.test.ts +++ b/packages/osd-optimizer/src/common/event_stream_helpers.test.ts @@ -245,6 +245,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 225a0de79ee..32a402a1387 100644 --- a/packages/osd-optimizer/src/node/cache.ts +++ b/packages/osd-optimizer/src/node/cache.ts @@ -214,7 +214,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 1eb2cd55eeb..6265aeef9af 100644 --- a/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts +++ b/packages/osd-optimizer/src/worker/bundle_refs_plugin.ts @@ -30,7 +30,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 45a5c8e230a..0ff5ed9b352 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 44719973018..3853bcbb47e 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 3af720ce169..4dd86de897d 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 b194ca2d6e4..7ba73c9d41c 100644 --- a/packages/osd-pm/src/utils/parallelize.test.ts +++ b/packages/osd-pm/src/utils/parallelize.test.ts @@ -33,7 +33,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); }); @@ -136,7 +136,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 731eee02a44..f4c4b05140c 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 e4c65c17e45..fdff978d006 100644 --- a/packages/osd-std/src/promise.test.ts +++ b/packages/osd-std/src/promise.test.ts @@ -31,7 +31,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 () => { @@ -55,7 +55,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 e36cb9f93d5..b6d522bdab5 100644 --- a/packages/osd-std/src/promise.ts +++ b/packages/osd-std/src/promise.ts @@ -39,6 +39,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 b697f7012df..13fd4d9640a 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 4725be77533..54018d260fe 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 67bd6167ba6..d301712f236 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 @@ -100,7 +100,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 00000000000..c17650573c3 --- /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 00000000000..c1c4ec87243 --- /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 4016e4dcc05..da8c3da4e57 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 00000000000..504d5fe3c23 --- /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 c384d56eb10..73525e2cac2 100644 --- a/packages/osd-test/src/failed_tests_reporter/github_api.ts +++ b/packages/osd-test/src/failed_tests_reporter/github_api.ts @@ -244,7 +244,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 7e99bf2c6ad..ef9abd4b8f4 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 @@ -34,12 +34,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 71ae48585d4..9686219c406 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 @@ -50,7 +50,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 2827b74f956..275651b0003 100644 --- a/packages/osd-test/src/index.ts +++ b/packages/osd-test/src/index.ts @@ -59,9 +59,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 00000000000..079132ce99d --- /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 00000000000..ac4abfb49c0 --- /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 35b8a5a3960..e47a02a0310 100644 --- a/src/dev/jest/junit_reporter.js +++ b/packages/osd-test/src/jest/junit_reporter.ts @@ -33,21 +33,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; } /** @@ -56,7 +67,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; } @@ -67,18 +78,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 c006844f8a4..9b1a13fda92 100644 --- a/src/test_utils/public/helpers/index.ts +++ b/packages/osd-test/src/jest/setup/react_mount_serializer.ts @@ -28,17 +28,14 @@ * under the License. */ -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 00000000000..94f9888b77f --- /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 00000000000..6041714f761 --- /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 00000000000..3d4019984ed --- /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 00000000000..c7f7399b346 --- /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 f2841a2bbeb..e3e5272bab0 100644 --- a/src/test_utils/public/helpers/utils.ts +++ b/packages/osd-test/src/jest/utils/random.ts @@ -33,8 +33,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 09b972771ce..c40baec2427 100644 --- a/src/test_utils/public/helpers/router_helpers.tsx +++ b/packages/osd-test/src/jest/utils/router_helpers.tsx @@ -40,9 +40,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 00000000000..55decd23309 --- /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 e941584292d..f45092ec076 100644 --- a/src/test_utils/public/testbed/mount_component.tsx +++ b/packages/osd-test/src/jest/utils/testbed/mount_component.tsx @@ -34,7 +34,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 90% rename from src/test_utils/public/testbed/testbed.ts rename to packages/osd-test/src/jest/utils/testbed/testbed.ts index 02a27b8aaa9..9e10efe8582 100644 --- a/src/test_utils/public/testbed/testbed.ts +++ b/packages/osd-test/src/jest/utils/testbed/testbed.ts @@ -30,7 +30,8 @@ import { ComponentType, ReactWrapper } from 'enzyme'; -import { findTestSubject, reactRouterMock } from '../helpers'; +import { findTestSubject } from '../find_test_subject'; +import { reactRouterMock } from '../router_helpers'; import { mountComponentSync, mountComponentAsync, @@ -54,12 +55,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(); @@ -162,33 +161,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(() => { @@ -200,6 +189,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 @@ -270,8 +266,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(); }; @@ -335,6 +330,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 9df36d3f97e..7061c35c7e8 100644 --- a/src/test_utils/public/testbed/types.ts +++ b/packages/osd-test/src/jest/utils/testbed/types.ts @@ -85,6 +85,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. @@ -186,7 +187,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 e1e5e81e3ad..7e915f3cddc 100644 --- a/src/dev/mocha/__tests__/junit_report_generation.js +++ b/packages/osd-test/src/mocha/__tests__/junit_report_generation.js @@ -36,7 +36,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 d47c3eed579..377018c7d55 100644 --- a/src/dev/mocha/index.js +++ b/packages/osd-test/src/mocha/index.ts @@ -34,3 +34,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 50b6ba9f6fe..4313462d7fb 100644 --- a/src/dev/mocha/junit_report_generation.js +++ b/packages/osd-test/src/mocha/junit_report_generation.js @@ -33,17 +33,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 94f00a66167..164e4cb6529 100644 --- a/src/dev/mocha/run_mocha_cli.js +++ b/packages/osd-test/src/mocha/run_mocha_cli.js @@ -52,7 +52,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 923e50b97e2..166730e26f1 100644 --- a/src/dev/mocha/server_junit_reporter.js +++ b/packages/osd-test/src/mocha/server_junit_reporter.js @@ -29,7 +29,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 5c765855fab..3219e6cf3d6 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 0927d0cc871..568a29ea99f 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": "34.6.0", diff --git a/packages/osd-utils/package.json b/packages/osd-utils/package.json index 802b03a0adb..ff5013e16c9 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 07eede602c6..584de645442 100644 --- a/scripts/mocha.js +++ b/scripts/mocha.js @@ -29,4 +29,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 d69708793b2..16163bc3fc1 100644 --- a/src/cli/cluster/worker.ts +++ b/src/cli/cluster/worker.ts @@ -149,7 +149,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)); } } @@ -201,7 +201,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; } @@ -227,6 +227,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 fb3c63ffc71..b74acc5652c 100644 --- a/src/cli/serve/integration_tests/reload_logging_config.test.ts +++ b/src/cli/serve/integration_tests/reload_logging_config.test.ts @@ -104,7 +104,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; } @@ -133,7 +133,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)) ); @@ -204,7 +204,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 012fa8a49ef..be4ded888ee 100644 --- a/src/cli_plugin/install/settings.test.js +++ b/src/cli_plugin/install/settings.test.js @@ -36,8 +36,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()); @@ -63,7 +63,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 c03afbba276..fb7828ece0c 100644 --- a/src/core/public/application/application_service.test.ts +++ b/src/core/public/application/application_service.test.ts @@ -704,11 +704,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 1b659c0dec5..e1e6a8559fc 100644 --- a/src/core/public/application/integration_tests/application_service.test.tsx +++ b/src/core/public/application/integration_tests/application_service.test.tsx @@ -42,7 +42,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'>; @@ -77,7 +77,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -111,7 +111,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -453,7 +453,7 @@ describe('ApplicationService', () => { const { register } = service.setup(setupDeps); let resolveMount: () => void; - const promise = new Promise((resolve) => { + const promise = new Promise((resolve) => { resolveMount = resolve; }); @@ -491,7 +491,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 e25fddd96d9..49e93d9b8cb 100644 --- a/src/core/public/application/integration_tests/utils.tsx +++ b/src/core/public/application/integration_tests/utils.tsx @@ -43,7 +43,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 e9e2caed02e..7bad1505b6c 100644 --- a/src/core/public/application/ui/app_container.test.tsx +++ b/src/core/public/application/ui/app_container.test.tsx @@ -31,7 +31,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'; @@ -50,7 +50,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 f04679aea6c..94e8b325ada 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 @@ -4,7 +4,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 dc44fe5053f..a1bae2b90cd 100644 --- a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx +++ b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx @@ -32,7 +32,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 41b9282848b..68097eee430 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -31,11 +31,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 cf7c1f0f89d..ea57290ddfa 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 @@ -28,7 +28,7 @@ * under the License. */ -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'; @@ -48,7 +48,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 f9866c4b7c8..f5b18cd56db 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 @@ -31,7 +31,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 22d06365686..d05799daed9 100644 --- a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx +++ b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx @@ -32,7 +32,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 4cc9e4473a9..e419af26442 100644 --- a/src/core/public/integrations/moment/moment_service.test.ts +++ b/src/core/public/integrations/moment/moment_service.test.ts @@ -43,7 +43,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 c82118a7f19..a7b8ed02638 100644 --- a/src/core/public/integrations/styles/styles_service.test.ts +++ b/src/core/public/integrations/styles/styles_service.test.ts @@ -36,7 +36,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 b621a327f60..d3d24938c1a 100644 --- a/src/core/public/notifications/toasts/error_toast.test.tsx +++ b/src/core/public/notifications/toasts/error_toast.test.tsx @@ -30,7 +30,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 a1f7a7e59cd..b5c9e382c8b 100644 --- a/src/core/public/overlays/modal/modal_service.tsx +++ b/src/core/public/overlays/modal/modal_service.tsx @@ -167,7 +167,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 fd9446f1565..c3736159cf4 100644 --- a/src/core/public/plugins/plugin.test.ts +++ b/src/core/public/plugins/plugin.test.ts @@ -114,7 +114,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 5ca7c491f72..17e6c3be389 100644 --- a/src/core/public/plugins/plugins_service.test.ts +++ b/src/core/public/plugins/plugins_service.test.ts @@ -265,7 +265,7 @@ describe('PluginsService', () => { }); describe('timeout', () => { - const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); + const flushPromises = () => new Promise((resolve) => setImmediate(resolve)); beforeAll(() => { jest.useFakeTimers('legacy'); setImmediate(() => {}); @@ -278,7 +278,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 d43b75b2171..86a4727a9e7 100644 --- a/src/core/public/saved_objects/saved_objects_client.ts +++ b/src/core/public/saved_objects/saved_objects_client.ts @@ -385,7 +385,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 d8a68ac035a..db208e2561f 100644 --- a/src/core/public/ui_settings/ui_settings_api.ts +++ b/src/core/public/ui_settings/ui_settings_api.ts @@ -81,7 +81,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 b51a7a0b69b..4872787d0c3 100644 --- a/src/core/public/utils/crypto/sha256.ts +++ b/src/core/public/utils/crypto/sha256.ts @@ -141,7 +141,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 ce0161f04e2..7dcf54f6961 100644 --- a/src/core/server/http/cookie_session_storage.test.ts +++ b/src/core/server/http/cookie_session_storage.test.ts @@ -117,7 +117,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 0759e4f2430..8158cca4428 100644 --- a/src/core/server/http/http_tools.test.ts +++ b/src/core/server/http/http_tools.test.ts @@ -104,7 +104,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 45eebb54055..c804723bc0b 100644 --- a/src/core/server/http/integration_tests/request.test.ts +++ b/src/core/server/http/integration_tests/request.test.ts @@ -60,7 +60,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 b1785042691..be27344afb3 100644 --- a/src/core/server/http/integration_tests/router.test.ts +++ b/src/core/server/http/integration_tests/router.test.ts @@ -317,7 +317,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) { @@ -478,7 +478,7 @@ describe('Options', () => { }, }, async (context, req, res) => { - await new Promise((resolve) => setTimeout(resolve, 2000)); + await new Promise((resolve) => setTimeout(resolve, 2000)); return res.ok({}); } ); @@ -503,7 +503,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 1e2099be09c..21d08f002f1 100644 --- a/src/core/server/logging/appenders/file/file_appender.test.ts +++ b/src/core/server/logging/appenders/file/file_appender.test.ts @@ -33,7 +33,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 87959641e9f..9d00d26fe65 100644 --- a/src/core/server/logging/appenders/file/file_appender.ts +++ b/src/core/server/logging/appenders/file/file_appender.ts @@ -82,7 +82,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 5ffc86e42d3..14946ba9b72 100644 --- a/src/core/server/metrics/collectors/process.ts +++ b/src/core/server/metrics/collectors/process.ts @@ -57,7 +57,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 ef0b2fc23ae..d344c824e2b 100644 --- a/src/core/server/metrics/integration_tests/server_collector.test.ts +++ b/src/core/server/metrics/integration_tests/server_collector.test.ts @@ -45,7 +45,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 () => { @@ -92,7 +92,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 6d45e753c86..465df8705ff 100644 --- a/src/core/server/metrics/metrics_service.test.ts +++ b/src/core/server/metrics/metrics_service.test.ts @@ -101,7 +101,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); @@ -135,7 +135,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 1510d2b148f..203cbd7f864 100644 --- a/src/core/server/opensearch/client/cluster_client.test.ts +++ b/src/core/server/opensearch/client/cluster_client.test.ts @@ -434,7 +434,7 @@ describe('ClusterClient', () => { let closeScopedClient: () => void; internalClient.close.mockReturnValue( - new Promise((resolve) => { + new Promise((resolve) => { closeInternalClient = resolve; }).then(() => { expect(clusterClientClosed).toBe(false); @@ -442,7 +442,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 bb8884fd395..eb14f8425d0 100644 --- a/src/core/server/opensearch/legacy/cluster_client.ts +++ b/src/core/server/opensearch/legacy/cluster_client.ts @@ -79,7 +79,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 d5d354f9df8..8f0a53ae232 100644 --- a/src/core/server/opensearch/opensearch_service.test.ts +++ b/src/core/server/opensearch/opensearch_service.test.ts @@ -45,7 +45,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 29396d0acce..3b433dc4176 100644 --- a/src/core/server/plugins/integration_tests/plugins_service.test.ts +++ b/src/core/server/plugins/integration_tests/plugins_service.test.ts @@ -156,7 +156,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 1858f7557ad..5b77d6a0c0c 100644 --- a/src/core/server/plugins/plugin.test.ts +++ b/src/core/server/plugins/plugin.test.ts @@ -325,7 +325,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 2e8aa6b4a4c..640cb02f4e6 100644 --- a/src/core/server/plugins/plugins_system.test.ts +++ b/src/core/server/plugins/plugins_system.test.ts @@ -449,7 +449,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(() => ({})); @@ -487,7 +487,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/views/template.test.tsx b/src/core/server/rendering/views/template.test.tsx index f009f12eb89..58c8a404ce2 100644 --- a/src/core/server/rendering/views/template.test.tsx +++ b/src/core/server/rendering/views/template.test.tsx @@ -7,7 +7,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 17948eb0f2e..bc0a4353bc1 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 @@ -89,7 +89,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 f5b6053322b..cf67526f42d 100644 --- a/src/core/server/saved_objects/migrations/core/migration_coordinator.ts +++ b/src/core/server/saved_objects/migrations/core/migration_coordinator.ts @@ -134,5 +134,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 0fc03ccd05c..98a50ea4500 100644 --- a/src/core/server/saved_objects/migrations/core/opensearch_index.ts +++ b/src/core/server/saved_objects/migrations/core/opensearch_index.ts @@ -219,7 +219,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); } @@ -374,7 +374,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: String(task), diff --git a/src/core/server/status/plugins_status.test.ts b/src/core/server/status/plugins_status.test.ts index 9c954a4a053..c070216ed27 100644 --- a/src/core/server/status/plugins_status.test.ts +++ b/src/core/server/status/plugins_status.test.ts @@ -313,7 +313,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 354a78210ce..84677376452 100644 --- a/src/core/server/status/status_service.test.ts +++ b/src/core/server/status/status_service.test.ts @@ -48,7 +48,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 563879105b1..9d30f3077da 100644 --- a/src/core/server/utils/streams/list_stream.test.ts +++ b/src/core/server/utils/streams/list_stream.test.ts @@ -36,7 +36,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]); @@ -49,7 +49,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 907aab52b76..b2f6717f45d 100644 --- a/src/core/server/utils/streams/promise_from_streams.test.ts +++ b/src/core/server/utils/streams/promise_from_streams.test.ts @@ -36,9 +36,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); }); @@ -98,7 +98,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 9551ee336b7..328d69473e1 100644 --- a/src/core/server/utils/streams/promise_from_streams.ts +++ b/src/core/server/utils/streams/promise_from_streams.ts @@ -73,7 +73,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 c734d768c50..dcd4e83ce4b 100644 --- a/src/core/server/utils/streams/reduce_stream.test.ts +++ b/src/core/server/utils/streams/reduce_stream.test.ts @@ -32,7 +32,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 a3531057767..cda06b6d248 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 cf5c0f675f8..56ce171ddb5 100644 --- a/src/dev/build/lib/download.ts +++ b/src/dev/build/lib/download.ts @@ -85,7 +85,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 ae846ef7d67..70d0127dee8 100644 --- a/src/dev/build/lib/fs.ts +++ b/src/dev/build/lib/fs.ts @@ -223,7 +223,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 10a1aea61e4..a6e9ed02914 100644 --- a/src/dev/build/tasks/copy_source_task.ts +++ b/src/dev/build/tasks/copy_source_task.ts @@ -42,7 +42,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 4a8c72d9f61..e1c7bf3174a 100644 --- a/src/dev/index.js +++ b/src/dev/index.js @@ -28,6 +28,6 @@ * under the License. */ -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 383620fdf8e..f46c6c249da 100644 --- a/src/dev/jest/config.integration.js +++ b/src/dev/jest/config.integration.js @@ -28,6 +28,7 @@ * under the License. */ +import preset from '@osd/test/jest-preset'; import config from './config'; export default { @@ -37,12 +38,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 7c635e24e01..8b18183a534 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -28,9 +28,8 @@ * under the License. */ -import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants'; - export default { + preset: '@osd/test', rootDir: '../../..', roots: [ '/src/plugins', @@ -46,12 +45,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', @@ -59,60 +59,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 1a9a446d524..00000000000 --- 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 e3f46c40eb1..00000000000 --- a/src/dev/jest/integration_tests/junit_reporter.test.js +++ /dev/null @@ -1,104 +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. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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. - */ - -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 55892410ea7..640cf7a8e68 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -55,6 +55,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 5eb47861949..08b404b257b 100644 --- a/src/dev/typescript/projects.ts +++ b/src/dev/typescript/projects.ts @@ -36,7 +36,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 42c4e2b41b3..3941f0ca4cb 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 @@ -29,7 +29,7 @@ */ 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 4d0cbbbc151..0dfffd1c281 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 @@ -29,7 +29,7 @@ */ 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 46fe75ec859..e91b9c16c8d 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 @@ -29,7 +29,7 @@ */ 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 d1de7a7b469..3ee1091682d 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 @@ -31,7 +31,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 c5a8a89157f..a1653263c88 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 @@ -30,7 +30,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 c21c81cafa2..bfb0753e98c 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 @@ -678,9 +678,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 650d8b259f0..6c5896665fa 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 @@ -29,7 +29,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 34b69888b3b..470a8b06513 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 @@ -29,7 +29,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 5a3618fa1bc..7b41b620ca6 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 @@ -77,7 +77,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 2e80bc4048c..b415ec73051 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 @@ -104,7 +104,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); }); @@ -118,7 +118,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); }); @@ -132,7 +132,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', @@ -152,7 +152,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' }], @@ -216,7 +216,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); }); }); @@ -233,7 +233,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); @@ -251,7 +251,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); @@ -292,7 +292,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({ @@ -326,7 +326,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({ @@ -365,7 +365,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); @@ -396,7 +396,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({ @@ -405,7 +405,7 @@ describe('createStreamingBatchedFunction()', () => { }) + '\n' ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); stream.next( JSON.stringify({ @@ -414,7 +414,7 @@ describe('createStreamingBatchedFunction()', () => { }) + '\n' ); - await new Promise((r) => setTimeout(r, 1)); + await new Promise((r) => setTimeout(r, 1)); stream.next( JSON.stringify({ @@ -423,7 +423,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; @@ -447,11 +447,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; @@ -477,7 +477,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({ @@ -487,7 +487,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; @@ -514,13 +514,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; @@ -546,7 +546,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({ @@ -556,7 +556,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 678ca4bcca1..fe1849a0edb 100644 --- a/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts +++ b/src/plugins/bfetch/public/streaming/fetch_streaming.test.ts @@ -31,7 +31,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 23b643733a5..d0854d4c584 100644 --- a/src/plugins/charts/public/services/theme/theme.ts +++ b/src/plugins/charts/public/services/theme/theme.ts @@ -61,10 +61,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(); @@ -75,10 +73,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(); @@ -89,10 +85,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 0cbe7f929fe..27ede4a8b34 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 @@ -38,7 +38,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 a74ab610a67..4c81755b539 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 @@ -63,7 +63,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 55ee5fe2a34..4b39d510415 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 @@ -85,7 +85,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; @@ -250,7 +250,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 fd4291b2945..30d2838c9fd 100644 --- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx +++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx @@ -29,7 +29,7 @@ */ 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 4daeb276717..9fc1cee04bc 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx @@ -28,7 +28,7 @@ * under the License. */ -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 48d1a4adc51..ac946170c3c 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 @@ -32,7 +32,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 e4999938371..578b27e2a58 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx @@ -267,9 +267,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 bc1b56b64bf..a9ec479747d 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 @@ -30,11 +30,11 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import React from 'react'; +import SizeMe from 'react-sizeme'; import { skip } from 'rxjs/operators'; import { mount } from 'enzyme'; import { I18nProvider } from '@osd/i18n/react'; -import sizeMe from 'react-sizeme'; -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'; @@ -46,7 +46,7 @@ import { OpenSearchDashboardsContextProvider } from '../../../../../opensearch_d import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks'; import { applicationServiceMock } from '../../../../../../core/public/mocks'; -sizeMe.noPlaceholders = true; +SizeMe.noPlaceholders = true; let dashboardContainer: DashboardContainer | undefined; 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 d3198f6e1e3..e81148df48c 100644 --- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx @@ -31,7 +31,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 2529f146e2b..1f6796c4076 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 @@ -30,7 +30,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 91bdaebe4dc..615ce334d90 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 @@ -29,7 +29,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 3dc1377eab9..b9af55a9a95 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 @@ -55,7 +55,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 ffee8a6b9c9..038c96914d7 100644 --- a/src/plugins/data/public/actions/apply_filter_action.ts +++ b/src/plugins/data/public/actions/apply_filter_action.ts @@ -81,7 +81,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 b09bc8adde6..5a083fa416a 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 @@ -78,5 +78,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 9def385c7dd..dd35bded59c 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 @@ -30,7 +30,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 5b4e0f22806..6425a059264 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 @@ -39,7 +39,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 2d58a9263aa..a6c94c5af36 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 @@ -40,7 +40,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 22ec4e9edd9..5f2c144881a 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 @@ -32,7 +32,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 8e3134b1ae9..4ecc541f070 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 @@ -29,7 +29,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 8c509d573e1..7cb80600109 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 @@ -295,7 +295,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 b05b18b6d64..78eae4afb1f 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -425,7 +425,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 009aa47156d..7afad8efe11 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 @@ -29,7 +29,7 @@ */ 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 1b23d84b6e5..6cfae40750c 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 @@ -29,7 +29,7 @@ */ 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 1ff83cf474c..2e5f4b6f168 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 @@ -30,7 +30,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 529364df93b..c5409533c81 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 @@ -29,7 +29,7 @@ */ 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 db5abf3dbed..4469e445396 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 @@ -29,7 +29,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 e6b1c6b73eb..97084e5213d 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 @@ -29,7 +29,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 204d0b161c6..ffe81e4a22f 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 @@ -29,7 +29,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 4b13de634f0..7d8fdc7c7ea 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 @@ -29,7 +29,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 2e486976bbd..cb8ece92a3d 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 @@ -29,7 +29,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 30b57eaf0dc..f8bc6022831 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 @@ -29,7 +29,7 @@ */ 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 b107ae46b37..83dcfc16e88 100644 --- a/src/plugins/discover/public/application/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -31,7 +31,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'; @@ -72,7 +72,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 05435ccae99..fcf3edfda48 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 @@ -29,7 +29,7 @@ */ 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 5bc6aa29136..f03a78425bb 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 @@ -29,7 +29,7 @@ */ 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 39c5c0abed0..96147ae1223 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 @@ -32,7 +32,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 c57300f3032..3cdfe4543e8 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 @@ -32,7 +32,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 9170adccc7e..69ac98b1081 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 @@ -30,7 +30,7 @@ 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 { 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 566a54b538f..3619c7ed34d 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 @@ -29,7 +29,7 @@ */ 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 dbc8c896246..31d63fba779 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 @@ -35,7 +35,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 28ffef9dae8..ce654e8cb32 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 @@ -29,7 +29,7 @@ */ 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 4a88e469a08..82c9e3e37b8 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 @@ -29,7 +29,7 @@ */ 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 96e687398b7..cd2311e6e3e 100644 --- a/src/plugins/embeddable/public/lib/containers/container.ts +++ b/src/plugins/embeddable/public/lib/containers/container.ts @@ -176,7 +176,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 2e53448c75b..77ce6b12669 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 @@ -29,7 +29,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 072bcd93d32..f1b613e593a 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -30,7 +30,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 232c2ca82d1..7d25fabf816 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 @@ -38,7 +38,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'; @@ -91,7 +91,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 0eb4792c03b..ac4a8629427 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 @@ -32,7 +32,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 bd3da79797c..b58502cef35 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 @@ -29,7 +29,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 192cbb3ae5d..44a56ae2f7e 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 @@ -141,7 +141,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 cc50b9e44a9..1db043e7ca2 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 @@ -61,7 +61,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 981e98b03c4..ef08f348758 100644 --- a/src/plugins/embeddable/public/tests/container.test.ts +++ b/src/plugins/embeddable/public/tests/container.test.ts @@ -534,7 +534,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(); @@ -565,7 +565,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 2aaeb5e898a..e5ddafb812e 100644 --- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -46,7 +46,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 3af8c97b4de..0245cdb691e 100644 --- a/src/plugins/expressions/common/execution/execution.test.ts +++ b/src/plugins/expressions/common/execution/execution.test.ts @@ -275,9 +275,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 bb4fc45f097..ed16e6f3f61 100644 --- a/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts +++ b/src/plugins/expressions/common/test_helpers/expression_functions/sleep.ts @@ -41,7 +41,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 6bd3bbf494b..9583b569ece 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 @@ -30,7 +30,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 652b0330b6c..b6301f03e2c 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 @@ -30,7 +30,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 8407156a70f..b46e4d996a6 100644 --- a/src/plugins/home/public/application/components/recently_accessed.test.js +++ b/src/plugins/home/public/application/components/recently_accessed.test.js @@ -32,7 +32,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 b5144e0024e..3dd10dbf086 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 @@ -29,7 +29,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 4a5e6ace3b9..c732d1d8df8 100644 --- a/src/plugins/home/public/application/components/tutorial/introduction.test.js +++ b/src/plugins/home/public/application/components/tutorial/introduction.test.js @@ -29,7 +29,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 02eeb1c1729..e73f0bd0738 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 @@ -30,7 +30,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 127421d0dbd..744479592b1 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.test.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.test.js @@ -29,7 +29,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 { 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 4933e1c8e3d..834249b3e11 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 @@ -35,7 +35,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 41ef277add9..3173d3342e2 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 @@ -31,7 +31,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 e4b9b62eeca..6b2dd67a8d4 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 @@ -30,7 +30,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 27816e91d11..7ff623331d8 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 @@ -99,7 +99,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(); @@ -123,7 +123,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({ @@ -146,7 +146,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(); @@ -200,7 +200,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 @@ -215,7 +215,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 ce684a7779b..a8ea341f969 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 @@ -30,7 +30,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 b1c4653adb0..2900014b4c3 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 @@ -30,7 +30,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 6dca33ca239..fbf28668cc2 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 @@ -64,7 +64,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 77db08444b0..511ed31d970 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 @@ -90,7 +90,7 @@ describe('IndexedFieldsTable', () => { /> ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); @@ -110,7 +110,7 @@ describe('IndexedFieldsTable', () => { /> ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.setProps({ fieldFilter: 'Elast' }); component.update(); @@ -131,7 +131,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 3d2d065b516..3dcf0f45de7 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 @@ -29,7 +29,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 69b945dc05d..0de472e1263 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 @@ -29,7 +29,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 158727783d9..5ea8a7a6ddd 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 @@ -29,7 +29,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 9dc2599251b..43099cb3417 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 @@ -29,7 +29,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 ecb46987215..ef8a5df08a1 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 @@ -29,7 +29,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 c44673c3acb..c0b33487a41 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 @@ -29,7 +29,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 0d154ebc397..89032adc822 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 @@ -30,7 +30,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 bf59d08a10d..f50f2088268 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 @@ -141,7 +141,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -170,7 +170,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -200,7 +200,7 @@ describe('FieldEditor', () => { mockContext ); - await new Promise((resolve) => process.nextTick(resolve)); + await new Promise((resolve) => process.nextTick(resolve)); component.update(); expect(component).toMatchSnapshot(); }); @@ -217,7 +217,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(); @@ -242,7 +242,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 c943b503f6b..20d2379a202 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 @@ -30,7 +30,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 76756f092f7..a8914be581c 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 @@ -33,7 +33,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 e2355799d72..cb030614dd2 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 @@ -29,7 +29,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 d8a36ac9b6c..92c393168d1 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 @@ -34,7 +34,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 e344f7d4cf3..f2cef29992b 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 @@ -30,7 +30,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 a8dcc0761f2..1d66df3c8af 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 @@ -31,7 +31,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 1e931c084a5..37e86a88092 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 @@ -31,7 +31,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 6e2b654de8e..1c77c8f3513 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 @@ -30,7 +30,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 0043d6a4fa3..81846a85ac2 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 @@ -29,7 +29,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 287c0343e91..ae756c7e589 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 @@ -36,7 +36,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 e4e204c0dd2..77fb80480fb 100644 --- a/src/plugins/inspector/public/ui/inspector_panel.test.tsx +++ b/src/plugins/inspector/public/ui/inspector_panel.test.tsx @@ -29,7 +29,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 a84653978e2..ca084f44e2f 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 @@ -31,7 +31,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 10083efd338..2b013110420 100644 --- a/src/plugins/maps_legacy/public/get_service_settings.ts +++ b/src/plugins/maps_legacy/public/get_service_settings.ts @@ -40,7 +40,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 95ec9346c30..d5a982d93cf 100644 --- a/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts +++ b/src/plugins/maps_legacy/public/lazy_load_bundle/index.ts @@ -41,7 +41,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 d4dbd4c9f5e..fca7fbac4f7 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 @@ -34,7 +34,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 7e759d2a6c0..a945eaa1589 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 @@ -31,7 +31,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 8385e715efa..17208f4dbea 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 @@ -30,7 +30,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 2d490015b8f..9233f9e933a 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 @@ -30,7 +30,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 feb8e639275..1e538b9f645 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 @@ -30,7 +30,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 198c55d98e3..49c58823c42 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 @@ -31,7 +31,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 1e105c56e57..2293d9e855a 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 @@ -31,7 +31,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 4d66e5d9aae..f96736e67b7 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 @@ -30,7 +30,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 d8290f0dbcb..cbf1302da1e 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 @@ -30,7 +30,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 60b9974a6a3..0d3d9bf5fdd 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 @@ -30,7 +30,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 8127664c02c..ad349e1dab5 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 @@ -73,7 +73,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 71770e45fcf..e078cffd9e6 100644 --- a/src/plugins/opensearch_dashboards_utils/common/defer.test.ts +++ b/src/plugins/opensearch_dashboards_utils/common/defer.test.ts @@ -30,7 +30,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 499f831042e..66280559d9b 100644 --- a/src/plugins/opensearch_dashboards_utils/common/of.test.ts +++ b/src/plugins/opensearch_dashboards_utils/common/of.test.ts @@ -32,7 +32,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); @@ -51,7 +51,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 d71a44e6aea..67240de9cf2 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 @@ -108,11 +108,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 ); @@ -127,7 +125,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}; }; @@ -316,21 +314,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); }); @@ -352,21 +350,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); }); @@ -394,14 +392,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 6e4d8f53a80..fcd424d4994 100644 --- a/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts +++ b/src/plugins/opensearch_dashboards_utils/demos/state_sync/url.ts @@ -36,7 +36,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({ @@ -67,9 +67,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 51cf242bba4..8e3d40be348 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 @@ -38,7 +38,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."` @@ -53,14 +53,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, @@ -77,10 +77,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 b380a0f756a..1721769edec 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 @@ -28,7 +28,7 @@ * under the License. */ -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 aedd54eae01..b67af4f268a 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 @@ -29,7 +29,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 ee0ac1daeac..32c54fc744b 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 @@ -44,7 +44,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'; @@ -195,7 +195,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); @@ -365,7 +365,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 8e0e59afa15..5351bbf1d42 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 @@ -32,7 +32,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 1ad0a735555..f72ab9447e9 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 @@ -28,7 +28,7 @@ * under the License. */ -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 fb809f66d14..280407edc46 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 @@ -28,7 +28,7 @@ * under the License. */ -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 bd65e06c786..ae5e9b90af8 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 e9e6bffb7b5..68fdc333937 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 @@ -102,7 +102,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 dd3d0101189..60fd919383b 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 @@ -129,6 +129,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 f9964c3a423..382108c88e6 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 @@ -191,7 +191,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 ab7f76475f3..768792672ee 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 @@ -28,6 +28,6 @@ * under the License. */ -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 c4e885c33e7..ae6a2c9598b 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 @@ -32,7 +32,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 ebd5be5ad09..0c35d4f3010 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 @@ -32,7 +32,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 b673cde16de..1581b6a4e4f 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 @@ -29,7 +29,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 29f235d9fcf..92a0cb225ca 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 @@ -39,7 +39,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'; @@ -92,7 +92,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(); @@ -103,7 +103,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(); @@ -131,7 +131,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(); @@ -185,7 +185,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(); @@ -223,7 +223,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(); @@ -243,7 +243,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(); }); }); @@ -349,7 +349,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(); @@ -404,7 +404,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(); @@ -424,7 +424,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, @@ -450,7 +450,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(); @@ -469,7 +469,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 fb62f424115..0624299b281 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 @@ -30,7 +30,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 f94473078c5..5ea42fe3e23 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 @@ -30,7 +30,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 082332f2b49..ad1ec4fa08a 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 @@ -29,7 +29,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 d78b98bdc6f..854dd33014c 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 @@ -29,7 +29,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'; @@ -101,7 +101,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(); @@ -168,7 +168,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(); @@ -235,7 +235,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(); @@ -302,7 +302,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(); @@ -339,7 +339,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(); @@ -408,7 +408,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(); @@ -475,7 +475,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(); @@ -542,7 +542,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(); @@ -609,7 +609,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(); @@ -646,7 +646,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 8e473730615..2d57153b272 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 @@ -29,7 +29,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 2f8382c5946..dd7a093857a 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 @@ -41,7 +41,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, @@ -222,7 +222,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(); @@ -236,7 +236,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(); @@ -266,7 +266,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(); @@ -309,7 +309,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(); @@ -331,7 +331,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(); @@ -345,7 +345,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(); @@ -375,7 +375,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(); @@ -403,7 +403,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(); @@ -417,7 +417,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(); @@ -433,7 +433,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(); @@ -446,7 +446,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(); @@ -485,7 +485,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(); @@ -509,7 +509,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(); @@ -544,7 +544,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 4ee519cf4db..c9f33e456e4 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx @@ -30,7 +30,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 597d305191b..860608bbe98 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -29,7 +29,7 @@ */ 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 e517cd7b11b..6851e74c64e 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 @@ -30,7 +30,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 f43ffbc8a35..4864f2203cb 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 @@ -29,7 +29,7 @@ */ 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 13f40cda7e5..c56c6198b60 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 @@ -29,7 +29,7 @@ */ 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 4c6ecc4d93b..b4f0c79c845 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 @@ -29,7 +29,7 @@ */ 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 6084147fc41..2cb24913182 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 @@ -258,7 +258,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 284b4e9d5fb..dde8b7db0d0 100644 --- a/src/plugins/timeline/public/directives/saved_object_finder.js +++ b/src/plugins/timeline/public/directives/saved_object_finder.js @@ -31,7 +31,6 @@ import _ from 'lodash'; import rison from 'rison-node'; import savedObjectFinderTemplate from './saved_object_finder.html'; -import { keyMap } from './key_map'; import { PaginateControlsDirectiveProvider, PaginateDirectiveProvider, @@ -176,8 +175,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]; @@ -191,8 +190,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; @@ -208,7 +207,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) { @@ -216,7 +215,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) { @@ -224,7 +223,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) { @@ -234,7 +233,7 @@ export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings } $event.preventDefault(); break; - case 'left': + case 37: // left if (!self.selector.enabled) break; if (page.number > 1) { @@ -244,13 +243,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; @@ -260,7 +259,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 0e4e56034f0..2ac167daf5b 100644 --- a/src/plugins/usage_collection/server/collector/collector_set.test.ts +++ b/src/plugins/usage_collection/server/collector/collector_set.test.ts @@ -115,7 +115,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 8d7c335325b..b6a2d688ea0 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 @@ -30,7 +30,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 2361915dc6d..fc36717dc03 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 @@ -29,7 +29,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/percentiles.test.tsx b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx index 1dbce17da3e..3465f60b13c 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 @@ -32,7 +32,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 c15764b5ce7..44e424daf65 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 @@ -29,7 +29,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 b6936c81b2e..d99afad308b 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 @@ -29,7 +29,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 df7eeda61b5..06b8c1446e0 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 @@ -65,9 +65,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 aa7ffb05110..91da5d85ed1 100644 --- a/src/plugins/vis_type_table/public/vis_controller.ts +++ b/src/plugins/vis_type_table/public/vis_controller.ts @@ -80,7 +80,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 dfce75b6883..29497cbc16d 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 @@ -34,7 +34,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 a75644667e7..f034d022c61 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 @@ -33,7 +33,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 aaa2b303479..b9def48338d 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 @@ -29,7 +29,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 5a187d93e22..5b2b7b32e6f 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 @@ -29,7 +29,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 aeaf8fb883a..adfecf5b596 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 @@ -29,7 +29,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 750d377fac0..ac35acd9b60 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 @@ -29,7 +29,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 90f03b4e894..036e03cacd8 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 @@ -33,7 +33,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 5037b87de35..bbc71f74f07 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 @@ -29,7 +29,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 8a32de02294..d1565c874c3 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 @@ -30,7 +30,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 6471233ad34..d7355039e6d 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 @@ -30,7 +30,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 cdca3c3039c..7f719b1daff 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 @@ -30,7 +30,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 0d27b98f4a4..309d8dc7605 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 @@ -33,7 +33,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 ec994cbe3e8..88f185f2ac9 100644 --- a/src/plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/plugins/vis_type_vislib/public/vis_controller.tsx @@ -84,7 +84,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 3e137a0df98..523d5c5f328 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 @@ -134,7 +134,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); @@ -266,7 +266,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 f6e79b74841..b425a196274 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 @@ -193,7 +193,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 21f846c789e..de9d58a5fbe 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 @@ -34,7 +34,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 cf5b5424e12..a747d7087a5 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 @@ -34,7 +34,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 26d9e8d54d4..c0aa46a471b 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 @@ -33,7 +33,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 98a352180bf..9db4a194f11 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 @@ -34,7 +34,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 fcab7fe8028..a133150e37b 100644 --- a/src/plugins/vis_type_vislib/public/vislib/vis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/vis.test.js @@ -34,7 +34,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 bcffd203997..5d2adb9ee51 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 @@ -29,7 +29,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 aa25c059ed2..2af198f59fb 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 @@ -30,7 +30,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 5df1e01a901..a34f1765f09 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 @@ -35,7 +35,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 e5724bccf1e..c06e29a37c1 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 @@ -35,7 +35,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 1e28b334e4e..779a3679be2 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 @@ -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/visualizations/point_series/heatmap_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.test.js index b2d15103c91..a99306f0a20 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 @@ -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/visualizations/point_series/line_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.test.js index b9bacb69c0b..f4cfe3570d4 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 @@ -35,7 +35,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 135df198293..e09d6dc16c9 100644 --- a/src/plugins/visualizations/public/vis.test.ts +++ b/src/plugins/visualizations/public/vis.test.ts @@ -35,7 +35,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 1c0acb45038..b2f541ffe23 100644 --- a/src/plugins/visualizations/public/vis.ts +++ b/src/plugins/visualizations/public/vis.ts @@ -114,6 +114,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 2e575f606cf..4156dc747af 100644 --- a/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx +++ b/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx @@ -40,7 +40,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 91eb6323350..eb6c1a23dc2 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -29,7 +29,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 360f8ed1964..b7c78809809 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 @@ -29,7 +29,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 e344d94fb4d..111a685b615 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 @@ -210,7 +210,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 804df3528d4..00000000000 --- a/src/test_utils/__tests__/get_url.js +++ /dev/null @@ -1,78 +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. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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. - */ - -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 3b25d2bc626..00000000000 --- a/src/test_utils/get_url.js +++ /dev/null @@ -1,66 +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. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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. - */ - -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 56f5a5e13a7..00000000000 --- a/src/test_utils/public/index.ts +++ /dev/null @@ -1,36 +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. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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. - */ - -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 e85deb4e297..00000000000 --- a/src/test_utils/public/key_map.ts +++ /dev/null @@ -1,132 +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. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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. - */ - -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 2fa89e29898..00000000000 --- 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 d28ed55a2bb..35758d77b3f 100644 --- a/test/common/services/deployment.ts +++ b/test/common/services/deployment.ts @@ -31,8 +31,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 2b0560fadfd..b61a551960d 100644 --- a/test/common/services/retry/retry_for_success.ts +++ b/test/common/services/retry/retry_for_success.ts @@ -31,7 +31,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 5f0896d502c..360f76383db 100644 --- a/test/examples/bfetch_explorer/batched_function.ts +++ b/test/examples/bfetch_explorer/batched_function.ts @@ -45,7 +45,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); @@ -83,7 +83,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(); @@ -92,7 +92,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 1534c710179..3a49c39ad72 100644 --- a/test/functional/apps/saved_objects_management/edit_saved_object.ts +++ b/test/functional/apps/saved_objects_management/edit_saved_object.ts @@ -31,7 +31,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 1a303dab14d..eb26b07495b 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -32,9 +32,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 ea6a56eb18f..f54b5ffab41 100644 --- a/test/functional/page_objects/context_page.ts +++ b/test/functional/page_objects/context_page.ts @@ -29,9 +29,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 cc6c0a9eb94..2c7bc0253b8 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 @@ -31,7 +31,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 0ce9791c464..67cfb521c3f 100644 --- a/test/functional/services/remote/prevent_parallel_calls.ts +++ b/test/functional/services/remote/prevent_parallel_calls.ts @@ -40,7 +40,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 bad2fe7e3a5..7e22e9f7183 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 8b28e62e31b..fc2487e8c84 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 0304da467b4..0e5b0c4bbde 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 53ea6306f2a..5708fdd6a53 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 69e7caea397..88bc15c62bd 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 56ec66f867f..5bb17d798f7 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 33a247924d0..12c6405bd5a 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 974d9398dd6..a7886330604 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 0deef5fe1f7..87d1ac550d3 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 @@ -98,7 +98,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({}); } @@ -123,7 +123,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 5b50b579549..4b83b676db8 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 068d9b0e638..c3fab03d6fc 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 4df6b3ae084..ef1522afbaa 100644 --- a/test/plugin_functional/plugins/core_provider_plugin/public/index.ts +++ b/test/plugin_functional/plugins/core_provider_plugin/public/index.ts @@ -50,7 +50,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 fcd6ba5260f..cf724253b0b 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 4f0aa8b8ae4..008bd01f0f3 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 114131058ec..9eb0601f617 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 cd0b7eb62b8..b38467972eb 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 fc7aab14306..5ba7725f8d1 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 b9c03d0c28f..a641b59b4f9 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": "34.6.0", "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 49076bfe626..86223d014d7 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 4bc985019a8..e99a13e24dd 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": "34.6.0", "@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 bb651872f1a..ffba3679de9 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 f167bfc6994..7e48f887360 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 dadabe1e605..254d65b454f 100644 --- a/test/server_integration/http/platform/headers.ts +++ b/test/server_integration/http/platform/headers.ts @@ -30,12 +30,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 @@ -52,7 +50,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 5d4321fac3b..5c3c612c084 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/*"], "@opensearch-project/opensearch": ["node_modules/@opensearch-project/opensearch/api/new"] }, diff --git a/tsconfig.json b/tsconfig.json index 8992e17067f..4ae094893d9 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 8eaa1fcbc55..e181ab3adac 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 c52c9476bc5..5cf84f4a976 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2909,7 +2909,7 @@ resolved "https://registry.yarnpkg.com/@types/elasticsearch/-/elasticsearch-5.0.40.tgz#811f6954088c264173e0a9876b97933250a4da10" integrity sha512-lhnbkC0XorAD7Dt7X+94cXUSHEdDNnEVk/DgFLHgIZQNhixV631Lj4+KpXunTT5rCHyj9RqK3TfO7QrOiwEeUQ== -"@types/enzyme@^3.10.7": +"@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== @@ -2917,11 +2917,6 @@ "@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" @@ -3159,7 +3154,7 @@ resolved "https://registry.yarnpkg.com/@types/intl-relativeformat/-/intl-relativeformat-2.1.1.tgz#76cc9ab1e0c289377373f06386f4e7bc29c5d71e" integrity sha512-JFNHwkk8gYc1RsLbDqluO3icRREuXIGL+7edNTNiWBTlw2/RUHN30nz7JHpQhfFomp6d6nWirXQsAtdi5qbW8g== -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": +"@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== @@ -3208,7 +3203,7 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.7.tgz#330c5d97a3500e9c903210d6e49f02964af04a0e" integrity sha512-S6+8JAYTE1qdsc9HMVsfY7+SgSuUU/Tp6TYTmITW0PZxiyIMvol3Gy//y69Wkhs0ti4py5qgR3uZH6uz/DNzJQ== -"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== @@ -3880,39 +3875,30 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3" integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw== -"@typescript-eslint/eslint-plugin@^3.10.0": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz#7e061338a1383f59edc204c605899f93dc2e2c8f" - integrity sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ== +"@typescript-eslint/eslint-plugin@^5.15.0": + version "5.17.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.17.0.tgz#704eb4e75039000531255672bf1c85ee85cf1d67" + integrity sha512-qVstvQilEd89HJk3qcbKt/zZrfBZ+9h2ynpAGlWjWiizA7m/MtLT9RoX6gjtpE500vfIg8jogAkDzdCxbsFASQ== dependencies: - "@typescript-eslint/experimental-utils" "3.10.1" - debug "^4.1.1" + "@typescript-eslint/scope-manager" "5.17.0" + "@typescript-eslint/type-utils" "5.17.0" + "@typescript-eslint/utils" "5.17.0" + debug "^4.3.2" functional-red-black-tree "^1.0.1" - regexpp "^3.0.0" - semver "^7.3.2" - tsutils "^3.17.1" - -"@typescript-eslint/experimental-utils@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz#e179ffc81a80ebcae2ea04e0332f8b251345a686" - integrity sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw== - dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" - eslint-scope "^5.0.0" - eslint-utils "^2.0.0" + ignore "^5.1.8" + regexpp "^3.2.0" + semver "^7.3.5" + tsutils "^3.21.0" -"@typescript-eslint/parser@^3.10.0": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.10.1.tgz#1883858e83e8b442627e1ac6f408925211155467" - integrity sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw== +"@typescript-eslint/parser@^5.15.0": + version "5.17.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.17.0.tgz#7def77d5bcd8458d12d52909118cf3f0a45f89d5" + integrity sha512-aRzW9Jg5Rlj2t2/crzhA2f23SIYFlF9mchGudyP0uiD6SenIxzKoLjwzHbafgHn39dNV/TV7xwQkLfFTZlJ4ig== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.10.1" - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/typescript-estree" "3.10.1" - eslint-visitor-keys "^1.1.0" + "@typescript-eslint/scope-manager" "5.17.0" + "@typescript-eslint/types" "5.17.0" + "@typescript-eslint/typescript-estree" "5.17.0" + debug "^4.3.2" "@typescript-eslint/scope-manager@5.17.0": version "5.17.0" @@ -3922,30 +3908,20 @@ "@typescript-eslint/types" "5.17.0" "@typescript-eslint/visitor-keys" "5.17.0" -"@typescript-eslint/types@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" - integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== +"@typescript-eslint/type-utils@5.17.0": + version "5.17.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.17.0.tgz#1c4549d68c89877662224aabb29fbbebf5fc9672" + integrity sha512-3hU0RynUIlEuqMJA7dragb0/75gZmwNwFf/QJokWzPehTZousP/MNifVSgjxNcDCkM5HI2K22TjQWUmmHUINSg== + dependencies: + "@typescript-eslint/utils" "5.17.0" + debug "^4.3.2" + tsutils "^3.21.0" "@typescript-eslint/types@5.17.0": version "5.17.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.17.0.tgz#861ec9e669ffa2aa9b873dd4d28d9b1ce26d216f" integrity sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw== -"@typescript-eslint/typescript-estree@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz#fd0061cc38add4fad45136d654408569f365b853" - integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== - dependencies: - "@typescript-eslint/types" "3.10.1" - "@typescript-eslint/visitor-keys" "3.10.1" - 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.17.0": version "5.17.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.17.0.tgz#a7cba7dfc8f9cc2ac78c18584e684507df4f2488" @@ -3959,7 +3935,7 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/utils@^5.10.0": +"@typescript-eslint/utils@5.17.0", "@typescript-eslint/utils@^5.10.0": version "5.17.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.17.0.tgz#549a9e1d491c6ccd3624bc3c1b098f5cfb45f306" integrity sha512-DVvndq1QoxQH+hFv+MUQHrrWZ7gQ5KcJzyjhzcqB1Y2Xes1UQQkTRPUfRpqhS8mhTWsSb2+iyvDW1Lef5DD7vA== @@ -3971,13 +3947,6 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@3.10.1": - version "3.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" - integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ== - dependencies: - eslint-visitor-keys "^1.1.0" - "@typescript-eslint/visitor-keys@5.17.0": version "5.17.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.17.0.tgz#52daae45c61b0211b4c81b53a71841911e479128" @@ -5307,7 +5276,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: +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= @@ -5857,29 +5826,7 @@ cheerio-select@^1.5.0: domhandler "^4.3.1" domutils "^2.8.0" -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: +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== @@ -6766,16 +6713,6 @@ css-select@^4.3.0: domutils "^2.8.0" nth-check "^2.0.1" -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= - dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" - css-to-react-native@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.0.0.tgz#62dbe678072a824a689bcfee011fc96e02a7d756" @@ -6793,11 +6730,6 @@ css-tree@^1.1.2: mdn-data "2.0.14" 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@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.0.1.tgz#3be33be55b9f302f710ba3a9c3abc1e2a63fc7eb" @@ -7625,14 +7557,6 @@ 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.13.tgz#102ee5f25eacce09bdf1cfa5a298f86da473be4b" integrity sha512-R305kwb5CcMDIpSHUnLyIAp7SrSPBx6F0VfQFB3M75xVMHhXJJIdePYgbPPh1o57vCHNu5QztokWUPsLjWzFqw== -dom-serializer@0: - version "0.2.2" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51" - integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g== - dependencies: - domelementtype "^2.0.1" - entities "^2.0.0" - 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" @@ -7642,14 +7566,6 @@ dom-serializer@^1.0.1, dom-serializer@^1.3.2: domhandler "^4.2.0" entities "^2.0.0" -dom-serializer@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" - integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA== - dependencies: - domelementtype "^1.3.0" - entities "^1.1.1" - dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" @@ -7660,11 +7576,6 @@ domain-browser@^1.1.1: resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== -domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: - version "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" @@ -7677,13 +7588,6 @@ domexception@^2.0.1: dependencies: webidl-conversions "^5.0.0" -domhandler@^2.3.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" - integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== - dependencies: - domelementtype "1" - domhandler@^4.0, domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.2.2, domhandler@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" @@ -7691,22 +7595,6 @@ domhandler@^4.0, domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.2.2, domhan dependencies: domelementtype "^2.2.0" -domutils@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= - dependencies: - dom-serializer "0" - domelementtype "1" - -domutils@^1.5.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" - integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== - dependencies: - dom-serializer "0" - domelementtype "1" - domutils@^2.5.2, domutils@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" @@ -7945,11 +7833,6 @@ enhanced-resolve@~0.9.0: memory-fs "^0.2.0" tapable "^0.1.8" -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" @@ -7975,7 +7858,7 @@ 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.5: +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== @@ -8011,7 +7894,7 @@ enzyme-shallow-equal@^1.0.1, enzyme-shallow-equal@^1.0.4: has "^1.0.3" object-is "^1.1.2" -enzyme-to-json@^3.5.0: +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== @@ -8478,7 +8361,7 @@ eslint-plugin-prettier@^3.1.4: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-react-hooks@^4.0.4: +eslint-plugin-react-hooks@^4.2.0: version "4.4.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.4.0.tgz#71c39e528764c848d8253e1aa2c7024ed505f6c4" integrity sha512-U3RVIfdzJaeKDQKEJbz5p3NW8/L80PCATJAfuojwbaEL+gBjfGdhUcGde+WGUW46Q5sr/NgxevsIiDtNXrvZaQ== @@ -10654,18 +10537,6 @@ html@1.0.0: dependencies: concat-stream "^1.4.7" -htmlparser2@^3.9.1: - version "3.10.1" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" - integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== - dependencies: - domelementtype "^1.3.1" - domhandler "^2.3.0" - domutils "^1.5.1" - entities "^1.1.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" @@ -10862,7 +10733,7 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.0.5, ignore@^5.1.1, ignore@^5.2.0: +ignore@^5.0.5, ignore@^5.1.1, 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== @@ -12953,16 +12824,6 @@ lodash-es@^4.17.15: 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" @@ -12978,7 +12839,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= @@ -12993,17 +12854,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= @@ -13013,11 +12869,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" @@ -13063,17 +12914,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== @@ -13088,21 +12934,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" @@ -13113,11 +12944,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" @@ -14411,13 +14237,6 @@ nth-check@^2.0.1: dependencies: boolbase "^1.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== - dependencies: - boolbase "~1.0.0" - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -16385,7 +16204,7 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpp@^3.0.0: +regexpp@^3.0.0, 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== @@ -18832,7 +18651,7 @@ tslib@~2.0.3: 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== @@ -18948,10 +18767,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.6"