From 360843e937213a9baf277d6295f08fbb90cc4ce9 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Wed, 4 Nov 2020 13:07:49 -0800 Subject: [PATCH 1/5] Consolidates Jest configuration Jest tests are currently organized into main configuration files (src/dev/jest/config.js and x-pack/dev-tools/jest/create_jest_config.js). Both of these are similar, but very slightly due to previously being in separate repositories. This change consolidates the scripts referenced in those configs and moves them to the `@kbn/test` project. OSS contained an alias for `test_utils`. Those aliases have been removed in favor of importing these utilities from `@kbn/test/jest` Blocker to #72569 Signed-off-by: Tyler Smalley --- packages/kbn-es-archiver/package.json | 5 +- .../lib/get_webpack_config.js | 1 - packages/kbn-i18n/GUIDELINE.md | 2 +- packages/kbn-test/jest-preset.js | 111 ++++++ packages/kbn-test/jest/package.json | 4 + packages/kbn-test/package.json | 14 +- packages/kbn-test/scripts/build.js | 91 +++++ packages/kbn-test/src/index.ts | 2 - .../kbn-test/src}/jest/babel_transform.js | 0 packages/kbn-test/src/jest/index.ts | 4 +- .../integration_tests/junit_reporter.test.ts | 2 +- packages/kbn-test/src/jest/junit_reporter.ts | 2 +- .../src}/jest/mocks/css_module_mock.js | 0 .../kbn-test/src}/jest/mocks/file_mock.js | 0 .../kbn-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 .../kbn-test/src}/jest/setup/enzyme.js | 0 .../kbn-test/src}/jest/setup/mocks.js | 0 .../kbn-test/src}/jest/setup/polyfills.js | 8 + .../src/jest/setup/react_mount_serializer.ts | 23 +- .../src}/jest/setup/react_testing_library.js | 0 .../kbn-test/src/jest/setup/setup_test.js | 13 +- .../src/jest/utils}/enzyme_helpers.tsx | 31 +- .../src/jest/utils}/find_test_subject.ts | 0 .../kbn-test/src/jest/utils/get_url.test.ts | 66 ++++ packages/kbn-test/src/jest/utils/get_url.ts | 75 ++++ packages/kbn-test/src/jest/utils/index.ts | 40 ++ .../src/jest/utils}/jsdom_svg_mocks.ts | 0 .../kbn-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 | 36 ++ .../kbn-test/src/jest/utils}/testbed/index.ts | 0 .../jest/utils}/testbed/mount_component.tsx | 3 +- .../src/jest/utils}/testbed/testbed.ts | 21 +- .../kbn-test/src/jest/utils}/testbed/types.ts | 3 +- .../__tests__/junit_report_generation.js | 2 +- .../src/mocha/junit_report_generation.js | 2 +- .../kbn-test/src/{jest => }/report_path.ts | 2 +- packages/kbn-test/tsconfig.json | 16 +- .../chrome/ui/header/collapsible_nav.test.tsx | 2 +- .../public/chrome/ui/header/header.test.tsx | 3 +- .../fatal_errors/fatal_errors_screen.test.tsx | 2 +- .../notifications/toasts/error_toast.test.tsx | 2 +- src/dev/jest/config.integration.js | 5 +- src/dev/jest/config.js | 53 +-- src/dev/precommit_hook/casing_check_config.js | 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 +- .../components/form/form.test.tsx | 2 +- .../components/search/search.test.tsx | 2 +- .../legacy/console_editor/editor.test.tsx | 2 +- .../library_notification_popover.test.tsx | 2 +- .../dashboard_empty_screen.test.tsx | 2 +- .../embeddable/dashboard_container.test.tsx | 2 +- .../embeddable/grid/dashboard_grid.test.tsx | 2 +- .../viewport/dashboard_viewport.test.tsx | 2 +- .../tests/dashboard_container.test.tsx | 2 +- .../application/top_nav/clone_modal.test.js | 2 +- .../application/top_nav/save_modal.test.js | 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 +- .../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 +- .../pager/tool_bar_pager_buttons.test.tsx | 2 +- .../pager/tool_bar_pager_text.test.tsx | 2 +- .../table_header/table_header.test.tsx | 2 +- .../context_app/context_app_legacy.test.tsx | 2 +- .../context_error_message.test.tsx | 2 +- .../application/components/doc/doc.test.tsx | 2 +- .../hits_counter/hits_counter.test.tsx | 2 +- .../loading_spinner/loading_spinner.test.tsx | 2 +- .../components/no_results/no_results.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 +- .../embeddable_child_panel.test.tsx | 2 +- .../lib/panel/embeddable_panel.test.tsx | 2 +- .../add_panel/add_panel_flyout.test.tsx | 2 +- .../saved_object_finder_create_new.test.tsx | 2 +- .../customize_panel_action.test.ts | 2 +- .../tests/customize_panel_modal.test.tsx | 2 +- .../forms/hook_form_lib/shared_imports.ts | 4 +- .../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 +- .../components/header/header.test.tsx | 2 +- .../advanced_options.test.tsx | 2 +- .../components/time_field/time_field.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 +- .../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/ui/inspector_panel.test.tsx | 2 +- .../views/data/components/data_view.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 +- .../url/kbn_url_tracker.test.ts | 2 +- .../state_management/url/url_tracker.test.ts | 2 +- .../public/state_sync/state_sync.test.ts | 2 +- ...eate_session_storage_state_storage.test.ts | 2 +- .../hashed_item_store.test.ts | 2 +- .../public/storage/hashed_item_store/mock.ts | 2 +- .../public/top_nav_menu/top_nav_menu.test.tsx | 2 +- .../top_nav_menu/top_nav_menu_item.test.tsx | 2 +- .../saved_object_save_modal.test.tsx | 2 +- .../objects_table/components/flyout.test.tsx | 2 +- .../components/import_mode_control.test.tsx | 2 +- .../components/import_summary.test.tsx | 2 +- .../components/overwrite_modal.test.tsx | 2 +- .../components/relationships.test.tsx | 2 +- .../objects_table/components/table.test.tsx | 2 +- .../saved_objects_table.test.tsx | 2 +- .../insecure_cluster_service.test.tsx | 2 +- .../public/components/opt_in_banner.test.tsx | 2 +- .../public/components/opt_in_message.test.tsx | 2 +- .../opted_in_notice_banner.test.tsx | 2 +- .../example_security_payload.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 +- .../number_list/number_list.test.tsx | 2 +- .../components/controls/date_ranges.test.tsx | 2 +- .../public/components/controls/size.test.tsx | 2 +- .../controls/top_aggregate.test.tsx | 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 +- .../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 +- .../agg_based_selection.test.tsx | 2 +- .../group_selection/group_selection.test.tsx | 2 +- .../public/wizard/new_vis_modal.test.tsx | 2 +- src/test_utils/public/enzyme_helpers.tsx | 142 ------- src/test_utils/public/testbed/testbed.ts | 346 ------------------ x-pack/dev-tools/jest/create_jest_config.js | 68 +--- x-pack/dev-tools/jest/setup/enzyme.js | 10 - x-pack/dev-tools/jest/setup/polyfills.js | 27 -- x-pack/dev-tools/jest/setup/setup_test.js | 13 - .../auto_follow_pattern_list.test.js | 4 +- .../fixtures/auto_follow_pattern.ts | 2 +- .../fixtures/follower_index.ts | 2 +- .../follower_index_add.test.js | 6 +- .../follower_indices_list.test.js | 6 +- .../auto_follow_pattern_add.helpers.js | 2 +- .../auto_follow_pattern_edit.helpers.js | 2 +- .../auto_follow_pattern_list.helpers.js | 2 +- .../helpers/follower_index_add.helpers.js | 2 +- .../helpers/follower_index_edit.helpers.js | 2 +- .../helpers/follower_index_list.helpers.js | 2 +- .../helpers/home.helpers.js | 2 +- .../client_integration/helpers/index.js | 2 +- .../public/services/utils.test.ts | 2 +- .../public/components/search_bar.test.tsx | 2 +- .../public/components/search_bar.test.tsx | 2 +- .../components/settings/settings.test.tsx | 2 +- .../client_integration/app/app.helpers.tsx | 2 +- .../edit_policy/edit_policy.helpers.tsx | 2 +- .../__jest__/components/edit_policy.test.tsx | 2 +- .../__jest__/components/policy_table.test.tsx | 2 +- .../__jest__/extend_index_management.test.tsx | 2 +- .../client_integration/helpers/index.ts | 2 +- .../home/data_streams_tab.helpers.ts | 7 +- .../client_integration/home/home.helpers.ts | 2 +- .../client_integration/home/home.test.ts | 2 +- .../home/index_templates_tab.helpers.ts | 7 +- .../home/indices_tab.helpers.ts | 7 +- .../home/indices_tab.test.ts | 2 +- .../template_clone.helpers.ts | 2 +- .../template_create.helpers.ts | 2 +- .../template_edit.helpers.ts | 2 +- .../template_form.helpers.ts | 2 +- .../__jest__/components/index_table.test.js | 3 +- .../component_template_create.helpers.ts | 2 +- .../component_template_details.helpers.ts | 2 +- .../component_template_edit.helpers.ts | 2 +- .../component_template_form.helpers.ts | 2 +- .../component_template_list.helpers.ts | 8 +- .../client_integration/helpers/index.ts | 2 +- .../client_integration/helpers/index.ts | 7 +- .../helpers/mappings_editor.helpers.tsx | 2 +- .../load_mappings_provider.test.tsx | 2 +- .../test/fixtures/template.ts | 2 +- .../inventory/components/expression.test.tsx | 2 +- .../components/expression.test.tsx | 2 +- .../components/expression_chart.test.tsx | 2 +- .../components/expression_row.test.tsx | 2 +- .../logs/log_view_configuration.test.tsx | 2 +- .../metric_detail/hooks/metrics_time.test.tsx | 2 +- .../client_integration/helpers/index.ts | 2 +- .../helpers/pipeline_form.helpers.ts | 2 +- .../helpers/pipelines_clone.helpers.ts | 2 +- .../helpers/pipelines_create.helpers.ts | 2 +- .../helpers/pipelines_edit.helpers.ts | 2 +- .../helpers/pipelines_list.helpers.ts | 7 +- .../pipeline_processors_editor.helpers.tsx | 2 +- .../__jest__/test_pipeline.helpers.tsx | 4 +- .../load_from_json/modal_provider.test.tsx | 2 +- .../expression.test.tsx | 2 +- .../debounced_component.test.tsx | 2 +- .../config_panel/layer_panel.test.tsx | 2 +- .../editor_frame/editor_frame.test.tsx | 2 +- .../editor_frame/suggestion_panel.test.tsx | 2 +- .../workspace_panel/chart_switch.test.tsx | 2 +- .../workspace_panel/workspace_panel.test.tsx | 2 +- .../workspace_panel_wrapper.test.tsx | 2 +- .../datapanel.test.tsx | 2 +- .../dimension_panel/dimension_panel.test.tsx | 2 +- .../field_item.test.tsx | 2 +- .../fields_accordion.test.tsx | 2 +- .../layerpanel.test.tsx | 2 +- .../legend_settings_popover.test.tsx | 2 +- .../axis_settings_popover.test.tsx | 2 +- .../xy_visualization/expression.test.tsx | 2 +- .../xy_visualization/xy_config_panel.test.tsx | 2 +- .../__jest__/upload_license.test.tsx | 2 +- .../license_management/__jest__/util/util.js | 2 +- .../pipeline_editor/pipeline_editor.test.js | 2 +- .../pipeline_list/add_role_alert.test.js | 2 +- .../pipeline_list/alert_call_out.test.js | 2 +- .../confirm_delete_modal.test.js | 2 +- .../enable_monitoring_alert.test.js | 2 +- .../pipeline_list/pipeline_list.test.js | 2 +- .../pipeline_list/pipelines_table.test.js | 2 +- .../upgrade_failure/upgrade_failure.test.js | 2 +- .../upgrade_failure_actions.test.js | 2 +- .../layer_panel/view.test.js | 2 +- .../attribution_control/view.test.js | 2 +- .../layer_toc/toc_entry/view.test.js | 2 +- .../index.test.tsx | 2 +- .../annotation_flyout/index.test.tsx | 2 +- .../annotations_table.test.js | 2 +- .../anomalies_table/anomaly_details.test.js | 2 +- .../entity_cell/entity_cell.test.js | 2 +- .../field_title_bar/field_title_bar.test.js | 2 +- .../full_time_range_selector.test.tsx | 2 +- .../rule_editor/actions_section.test.js | 2 +- .../detector_description_list.test.js | 2 +- .../rule_editor/condition_expression.test.js | 2 +- .../rule_editor/conditions_section.test.js | 2 +- .../rule_editor/rule_editor_flyout.test.js | 2 +- .../rule_editor/scope_expression.test.js | 2 +- .../rule_editor/scope_section.test.js | 2 +- .../add_to_filter_list_link.test.js | 2 +- .../delete_rule_modal.test.js | 2 +- .../edit_condition_link.test.js | 2 +- .../rule_action_panel.test.js | 2 +- .../validate_job/validate_job_view.test.js | 2 +- .../use_create_analytics_form.test.tsx | 2 +- .../components/edit_flyout/overrides.test.js | 2 +- .../explorer_chart_distribution.test.js | 2 +- .../explorer_chart_info_tooltip.test.js | 2 +- .../explorer_chart_single_metric.test.js | 2 +- .../edit/calendar_form/calendar_form.test.js | 2 +- .../edit/events_table/events_table.test.js | 2 +- .../edit/import_modal/import_modal.test.js | 2 +- .../imported_events/imported_events.test.js | 2 +- .../calendars/edit/new_calendar.test.js | 2 +- .../new_event_modal/new_event_modal.test.js | 2 +- .../calendars/list/calendars_list.test.js | 2 +- .../settings/calendars/list/header.test.js | 2 +- .../calendars/list/table/table.test.js | 2 +- .../add_item_popover/add_item_popover.test.js | 2 +- .../delete_filter_list_modal.test.js | 2 +- .../edit_description_popover.test.js | 2 +- .../edit/edit_filter_list.test.js | 2 +- .../settings/filter_lists/edit/header.test.js | 2 +- .../filter_lists/edit/toolbar.test.js | 2 +- .../filter_lists/list/filter_lists.test.js | 2 +- .../settings/filter_lists/list/header.test.js | 2 +- .../settings/filter_lists/list/table.test.js | 2 +- .../application/settings/settings.test.tsx | 2 +- .../timeseries_chart/timeseries_chart.test.js | 2 +- .../overview/__tests__/helpers.test.js | 2 +- .../nodes/__tests__/cells.test.js | 2 +- .../no_data/__tests__/checker_errors.test.js | 2 +- .../no_data/__tests__/no_data.test.js | 2 +- .../__tests__/collection_enabled.test.js | 2 +- .../__tests__/collection_interval.test.js | 2 +- .../exporters/__tests__/exporters.test.js | 2 +- .../__tests__/plugin_enabled.test.js | 2 +- .../reasons/__tests__/reason_found.test.js | 2 +- .../reasons/__tests__/we_tried.test.js | 2 +- .../__tests__/page_loading.test.js | 2 +- .../summary_status/summary_status.test.js | 2 +- .../add/remote_clusters_add.helpers.js | 2 +- .../edit/remote_clusters_edit.helpers.js | 2 +- .../client_integration/helpers/index.js | 2 +- .../list/remote_clusters_list.helpers.js | 2 +- .../fixtures/remote_cluster.js | 2 +- .../remote_cluster_form.test.js | 2 +- .../buttons/report_info_button.test.tsx | 2 +- .../public/components/report_listing.test.tsx | 2 +- x-pack/plugins/rollup/fixtures/job.js | 2 +- .../detail_panel/detail_panel.test.js | 2 +- .../sections/job_list/job_list.test.js | 2 +- .../job_list/job_table/job_table.test.js | 2 +- .../test/client_integration/helpers/index.js | 2 +- .../helpers/job_clone.helpers.js | 2 +- .../helpers/job_create.helpers.js | 2 +- .../helpers/job_list.helpers.js | 2 +- .../empty_tree_placeholder.test.tsx | 2 +- .../highlight_details_flyout.test.tsx | 2 +- .../license_warning_notice.test.ts | 2 +- .../profile_loading_placeholder.test.tsx | 2 +- .../editor/editor.test.tsx | 2 +- .../__jest__/profile_tree.test.tsx | 2 +- .../searchprofiler_tabs.test.ts | 2 +- .../account_management_page.test.tsx | 2 +- .../access_agreement_page.test.tsx | 4 +- .../authentication_state_page.test.tsx | 2 +- .../components/login_form/login_form.test.tsx | 4 +- .../authentication/login/login_page.test.tsx | 2 +- .../overwritten_session_page.test.tsx | 2 +- .../api_keys_grid/api_keys_grid_page.test.tsx | 2 +- .../role_combo_box/role_combo_box.test.tsx | 4 +- .../role_combo_box_option.test.tsx | 2 +- .../delete_provider/delete_provider.test.tsx | 4 +- .../section_loading/section_loading.test.tsx | 2 +- .../edit_role_mapping_page.test.tsx | 6 +- .../mapping_info_panel.test.tsx | 4 +- .../add_role_template_button.test.tsx | 2 +- .../role_selector/role_selector.test.tsx | 4 +- .../role_template_editor.test.tsx | 4 +- .../add_rule_button.test.tsx | 4 +- .../field_rule_editor.test.tsx | 4 +- .../json_rule_editor.test.tsx | 4 +- .../rule_editor_panel.test.tsx | 6 +- .../rule_group_editor.test.tsx | 4 +- .../visual_rule_editor.test.tsx | 4 +- .../role_mappings_grid_page.test.tsx | 4 +- .../collapsible_panel.test.tsx | 2 +- .../edit_role/delete_role_button.test.tsx | 2 +- .../roles/edit_role/edit_role_page.test.tsx | 2 +- .../privileges/es/cluster_privileges.test.tsx | 2 +- .../es/elasticsearch_privileges.test.tsx | 2 +- .../es/index_privilege_form.test.tsx | 2 +- .../privileges/es/index_privileges.test.tsx | 2 +- .../feature_table/__fixtures__/index.ts | 2 +- .../feature_table/feature_table.test.tsx | 4 +- .../feature_table_expanded_row.test.tsx | 4 +- .../feature_table/sub_feature_form.test.tsx | 2 +- .../feature_table_cell.test.tsx | 2 +- .../privilege_summary/__fixtures__/index.ts | 2 +- .../privilege_summary.test.tsx | 4 +- .../privilege_summary_table.test.tsx | 2 +- .../space_column_header.test.tsx | 2 +- .../simple_privilege_section.test.tsx | 2 +- .../privilege_display.test.tsx | 2 +- .../privilege_space_form.test.tsx | 4 +- .../privilege_space_table.test.tsx | 4 +- .../space_aware_privilege_section.test.tsx | 2 +- .../spaces_popover_list.test.tsx | 2 +- .../roles/roles_grid/roles_grid_page.test.tsx | 4 +- .../change_password_form.test.tsx | 2 +- .../confirm_delete_users.test.tsx | 2 +- .../users/edit_user/edit_user_page.test.tsx | 4 +- .../users/users_grid/users_grid_page.test.tsx | 4 +- .../nav_control_component.test.tsx | 4 +- .../nav_control/nav_control_service.test.ts | 2 +- .../session_idle_timeout_warning.test.tsx | 2 +- .../public/session/session_timeout.test.tsx | 2 +- .../authorization_service.test.ts | 2 +- .../elasticsearch_service.test.ts | 2 +- .../session_management_service.test.ts | 2 +- .../empty_value/empty_value.test.tsx | 2 +- .../exceptions/error_callout.test.tsx | 2 +- .../viewer/exceptions_utility.test.tsx | 2 +- .../common/components/links/index.test.tsx | 2 +- .../components/ml_popover/ml_popover.test.tsx | 2 +- .../components/notes/note_card/index.test.tsx | 2 +- .../notes/note_card/note_card_header.test.tsx | 2 +- .../notes/note_card/note_created.test.tsx | 2 +- .../notes/note_cards/index.test.tsx | 2 +- .../delete_timeline_modal.test.tsx | 2 +- .../delete_timeline_modal/index.test.tsx | 2 +- .../note_previews/index.test.tsx | 2 +- .../note_previews/note_preview.test.tsx | 2 +- .../open_timeline/open_timeline.test.tsx | 2 +- .../open_timeline_modal_body.test.tsx | 2 +- .../open_timeline/search_row/index.test.tsx | 2 +- .../timelines_table/actions_columns.test.tsx | 2 +- .../timelines_table/common_columns.test.tsx | 2 +- .../timelines_table/extended_columns.test.tsx | 2 +- .../icon_header_columns.test.tsx | 2 +- .../timelines_table/index.test.tsx | 2 +- .../open_timeline/title_row/index.test.tsx | 2 +- .../timeline/properties/index.test.tsx | 2 +- .../helpers/home.helpers.ts | 12 +- .../client_integration/helpers/index.ts | 2 +- .../helpers/policy_add.helpers.ts | 2 +- .../helpers/policy_edit.helpers.ts | 2 +- .../helpers/policy_form.helpers.ts | 2 +- .../helpers/repository_add.helpers.ts | 2 +- .../helpers/repository_edit.helpers.ts | 2 +- .../helpers/restore_snapshot.helpers.ts | 2 +- .../__jest__/client_integration/home.test.ts | 7 +- .../client_integration/repository_add.test.ts | 4 +- .../snapshot_restore/test/fixtures/policy.ts | 2 +- .../test/fixtures/repository.ts | 2 +- .../test/fixtures/snapshot.ts | 2 +- .../advanced_settings_subtitle.test.tsx | 2 +- .../advanced_settings_title.test.tsx | 2 +- .../components/copy_mode_control.test.tsx | 2 +- .../components/copy_to_space_flyout.test.tsx | 4 +- .../components/resolve_all_conflicts.test.tsx | 4 +- .../confirm_delete_modal.test.tsx | 2 +- .../unauthorized_prompt.test.tsx | 2 +- .../confirm_alter_active_space_modal.test.tsx | 2 +- .../customize_space_avatar.test.tsx | 2 +- .../customize_space/space_identifier.test.tsx | 2 +- .../edit_space/delete_spaces_button.test.tsx | 2 +- .../enabled_features.test.tsx | 4 +- .../edit_space/manage_space_page.test.tsx | 2 +- .../edit_space/reserved_space_badge.test.tsx | 2 +- .../section_panel/section_panel.test.tsx | 2 +- .../spaces_grid/spaces_grid_pages.test.tsx | 2 +- .../components/manage_spaces_button.test.tsx | 2 +- .../nav_control/nav_control_popover.test.tsx | 2 +- .../components/share_to_space_flyout.test.tsx | 4 +- ...are_saved_objects_to_space_column.test.tsx | 2 +- .../space_selector/space_selector.test.tsx | 2 +- .../spaces_manager/spaces_manager.test.ts | 2 +- .../default_space_service.test.ts | 2 +- .../email/email_connector.test.tsx | 2 +- .../email/email_params.test.tsx | 2 +- .../es_index/es_index_connector.test.tsx | 2 +- .../es_index/es_index_params.test.tsx | 2 +- .../jira/jira_connectors.test.tsx | 2 +- .../jira/jira_params.test.tsx | 2 +- .../pagerduty/pagerduty_connectors.test.tsx | 2 +- .../pagerduty/pagerduty_params.test.tsx | 2 +- .../resilient/resilient_connectors.test.tsx | 2 +- .../resilient/resilient_params.test.tsx | 2 +- .../server_log/server_log_params.test.tsx | 2 +- .../servicenow/servicenow_connectors.test.tsx | 2 +- .../servicenow/servicenow_params.test.tsx | 2 +- .../slack/slack_connectors.test.tsx | 2 +- .../slack/slack_params.test.tsx | 2 +- .../webhook/webhook_connectors.test.tsx | 2 +- .../webhook/webhook_params.test.tsx | 2 +- .../public/application/home.test.tsx | 2 +- .../action_connector_form.test.tsx | 2 +- .../action_form.test.tsx | 2 +- .../action_type_menu.test.tsx | 2 +- .../connector_add_flyout.test.tsx | 2 +- .../connector_add_modal.test.tsx | 2 +- .../connector_edit_flyout.test.tsx | 2 +- .../test_connector_form.test.tsx | 2 +- .../actions_connectors_list.test.tsx | 2 +- .../sections/alert_form/alert_add.test.tsx | 2 +- .../sections/alert_form/alert_edit.test.tsx | 2 +- .../sections/alert_form/alert_form.test.tsx | 2 +- .../components/alerts_list.test.tsx | 2 +- .../expression_items/threshold.test.tsx | 2 +- .../public/custom_time_range_action.test.ts | 2 +- .../public/custom_time_range_badge.test.ts | 2 +- ...ected_flyout_manage_drilldowns.stories.tsx | 2 +- ...onnected_flyout_manage_drilldowns.test.tsx | 2 +- .../application/components/tabs.test.tsx | 2 +- .../checkup/deprecations/grouped.test.tsx | 2 +- .../checkup/deprecations/index_table.test.tsx | 2 +- .../common/__tests__/location_link.test.tsx | 2 +- .../__tests__/monitor_page_link.test.tsx | 2 +- .../__tests__/chart_empty_state.test.tsx | 2 +- .../charts/__tests__/chart_wrapper.test.tsx | 4 +- .../charts/__tests__/donut_chart.test.tsx | 2 +- .../__tests__/donut_chart_legend.test.tsx | 2 +- .../__tests__/donut_chart_legend_row.test.tsx | 2 +- .../__tests__/responsive_wrapper.test.tsx | 2 +- .../ml/__tests__/confirm_delete.test.tsx | 2 +- .../ml/__tests__/license_info.test.tsx | 2 +- .../monitor/ml/__tests__/ml_flyout.test.tsx | 2 +- .../__tests__/doc_link_body.test.tsx | 2 +- .../ping_list/__tests__/expanded_row.test.tsx | 2 +- .../ping_list/__tests__/ping_headers.test.tsx | 2 +- .../ping_list/__tests__/ping_list.test.tsx | 2 +- .../__test__/status_by_location.test.tsx | 2 +- .../__tests__/availability_reporting.test.tsx | 2 +- .../__tests__/location_status_tags.test.tsx | 2 +- .../__tests__/tag_label.test.tsx | 2 +- .../__tests__/location_availability.test.tsx | 2 +- .../__tests__/location_map.test.tsx | 2 +- .../__tests__/location_missing.test.tsx | 2 +- .../__tests__/browser_expanded_row.test.tsx | 2 +- .../__tests__/console_event.test.tsx | 2 +- .../console_output_event_list.test.tsx | 2 +- .../__tests__/empty_journey.test.tsx | 2 +- .../__tests__/executed_journey.test.tsx | 2 +- .../__tests__/executed_step.test.tsx | 2 +- .../__tests__/status_badge.test.tsx | 2 +- .../step_screenshot_display.test.tsx | 2 +- .../__tests__/parsing_error_callout.test.tsx | 2 +- .../overview/__tests__/snapshot.test.tsx | 2 +- .../__tests__/snapshot_heading.test.tsx | 2 +- .../__tests__/synthetics_callout.test.tsx | 2 +- .../alerts/__tests__/add_filter_btn.test.tsx | 2 +- .../__tests__/alert_field_number.test.tsx | 2 +- .../__tests__/alert_monitor_status.test.tsx | 2 +- .../__tests__/old_alert_callout.test.tsx | 2 +- .../__tests__/down_number_select.test.tsx | 2 +- .../filters_expression_select.test.tsx | 2 +- .../__tests__/time_expression_select.test.tsx | 2 +- .../__tests__/data_or_index_missing.test.tsx | 2 +- .../__tests__/filter_popover.test.tsx | 2 +- .../monitor_list_page_size_select.test.tsx | 2 +- .../monitor_list_status_column.test.tsx | 2 +- .../__tests__/integration_group.test.tsx | 2 +- .../__tests__/integration_link.test.tsx | 2 +- .../__tests__/monitor_status_list.test.tsx | 2 +- .../__tests__/monitor_status_row.test.tsx | 2 +- .../__tests__/most_recent_error.test.tsx | 2 +- .../public/lib/helper/helper_with_router.tsx | 2 +- .../client_integration/helpers/index.ts | 2 +- .../helpers/watch_create_json.helpers.ts | 2 +- .../helpers/watch_create_threshold.helpers.ts | 2 +- .../helpers/watch_edit.helpers.ts | 2 +- .../helpers/watch_list.helpers.ts | 8 +- .../helpers/watch_status.helpers.ts | 10 +- .../client_integration/watch_edit.test.ts | 2 +- x-pack/plugins/watcher/test/fixtures/watch.ts | 2 +- .../watcher/test/fixtures/watch_history.ts | 2 +- x-pack/test_utils/README.md | 2 +- x-pack/test_utils/find_test_subject.ts | 52 --- x-pack/test_utils/index.ts | 2 - x-pack/test_utils/jest/config.integration.js | 2 +- x-pack/test_utils/jest/config.js | 12 +- x-pack/test_utils/redux_helpers.tsx | 14 - x-pack/test_utils/router_helpers.tsx | 73 ---- x-pack/test_utils/stub_web_worker.ts | 23 -- x-pack/test_utils/testbed/index.ts | 8 - x-pack/test_utils/testbed/mount_component.tsx | 63 ---- x-pack/test_utils/testbed/types.ts | 174 --------- 589 files changed, 1120 insertions(+), 1748 deletions(-) create mode 100644 packages/kbn-test/jest-preset.js create mode 100644 packages/kbn-test/jest/package.json create mode 100644 packages/kbn-test/scripts/build.js rename {src/dev => packages/kbn-test/src}/jest/babel_transform.js (100%) rename {src/dev => packages/kbn-test/src}/jest/mocks/css_module_mock.js (100%) rename {src/dev => packages/kbn-test/src}/jest/mocks/file_mock.js (100%) rename {src/dev => packages/kbn-test/src}/jest/mocks/style_mock.js (100%) rename {src/dev => packages/kbn-test/src}/jest/mocks/worker_module_mock.js (100%) rename {src/dev => packages/kbn-test/src}/jest/setup/after_env.integration.js (100%) rename {src/dev => packages/kbn-test/src}/jest/setup/babel_polyfill.js (100%) rename {src/dev => packages/kbn-test/src}/jest/setup/enzyme.js (100%) rename {src/dev => packages/kbn-test/src}/jest/setup/mocks.js (100%) rename {src/dev => packages/kbn-test/src}/jest/setup/polyfills.js (83%) rename src/test_utils/public/helpers/index.ts => packages/kbn-test/src/jest/setup/react_mount_serializer.ts (67%) rename {src/dev => packages/kbn-test/src}/jest/setup/react_testing_library.js (100%) rename src/test_utils/public/index.ts => packages/kbn-test/src/jest/setup/setup_test.js (77%) rename {x-pack/test_utils => packages/kbn-test/src/jest/utils}/enzyme_helpers.tsx (81%) rename {src/test_utils/public/helpers => packages/kbn-test/src/jest/utils}/find_test_subject.ts (100%) create mode 100644 packages/kbn-test/src/jest/utils/get_url.test.ts create mode 100644 packages/kbn-test/src/jest/utils/get_url.ts create mode 100644 packages/kbn-test/src/jest/utils/index.ts rename {src/test_utils/public/helpers => packages/kbn-test/src/jest/utils}/jsdom_svg_mocks.ts (100%) rename src/test_utils/public/helpers/utils.ts => packages/kbn-test/src/jest/utils/random.ts (92%) rename {src/test_utils/public/helpers => packages/kbn-test/src/jest/utils}/redux_helpers.tsx (100%) rename {src/test_utils/public/helpers => packages/kbn-test/src/jest/utils}/router_helpers.tsx (93%) rename {src/test_utils/public => packages/kbn-test/src/jest/utils}/stub_browser_storage.test.ts (100%) rename {src/test_utils/public => packages/kbn-test/src/jest/utils}/stub_browser_storage.ts (100%) create mode 100644 packages/kbn-test/src/jest/utils/stub_web_worker.ts rename {src/test_utils/public => packages/kbn-test/src/jest/utils}/testbed/index.ts (100%) rename {src/test_utils/public => packages/kbn-test/src/jest/utils}/testbed/mount_component.tsx (95%) rename {x-pack/test_utils => packages/kbn-test/src/jest/utils}/testbed/testbed.ts (92%) rename {src/test_utils/public => packages/kbn-test/src/jest/utils}/testbed/types.ts (98%) rename packages/kbn-test/src/{jest => }/report_path.ts (94%) delete mode 100644 src/test_utils/public/enzyme_helpers.tsx delete mode 100644 src/test_utils/public/testbed/testbed.ts delete mode 100644 x-pack/dev-tools/jest/setup/enzyme.js delete mode 100644 x-pack/dev-tools/jest/setup/polyfills.js delete mode 100644 x-pack/dev-tools/jest/setup/setup_test.js delete mode 100644 x-pack/test_utils/find_test_subject.ts delete mode 100644 x-pack/test_utils/redux_helpers.tsx delete mode 100644 x-pack/test_utils/router_helpers.tsx delete mode 100644 x-pack/test_utils/stub_web_worker.ts delete mode 100644 x-pack/test_utils/testbed/index.ts delete mode 100644 x-pack/test_utils/testbed/mount_component.tsx delete mode 100644 x-pack/test_utils/testbed/types.ts diff --git a/packages/kbn-es-archiver/package.json b/packages/kbn-es-archiver/package.json index 9e7ff757996b7..28e9ce1ffef36 100644 --- a/packages/kbn-es-archiver/package.json +++ b/packages/kbn-es-archiver/package.json @@ -11,6 +11,7 @@ "kbn:watch": "rm -rf target && ../../node_modules/.bin/tsc --watch" }, "dependencies": { - "@kbn/dev-utils": "link:../kbn-dev-utils" + "@kbn/dev-utils": "link:../kbn-dev-utils", + "@kbn/test": "link:../kbn-test" } -} \ No newline at end of file +} diff --git a/packages/kbn-eslint-import-resolver-kibana/lib/get_webpack_config.js b/packages/kbn-eslint-import-resolver-kibana/lib/get_webpack_config.js index 60a03ae8a104e..65c432dd69b60 100755 --- a/packages/kbn-eslint-import-resolver-kibana/lib/get_webpack_config.js +++ b/packages/kbn-eslint-import-resolver-kibana/lib/get_webpack_config.js @@ -29,7 +29,6 @@ exports.getWebpackConfig = function (kibanaPath) { alias: { // Dev defaults for test bundle https://github.com/elastic/kibana/blob/6998f074542e8c7b32955db159d15661aca253d7/src/core_plugins/tests_bundle/index.js#L73-L78 fixtures: resolve(kibanaPath, 'src/fixtures'), - test_utils: resolve(kibanaPath, 'src/test_utils/public'), }, unsafeCache: true, }, diff --git a/packages/kbn-i18n/GUIDELINE.md b/packages/kbn-i18n/GUIDELINE.md index 45408dc6582b5..b7c1371d59ea4 100644 --- a/packages/kbn-i18n/GUIDELINE.md +++ b/packages/kbn-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 `@kbn/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/kbn-test/jest-preset.js b/packages/kbn-test/jest-preset.js new file mode 100644 index 0000000000000..4a85eca206c96 --- /dev/null +++ b/packages/kbn-test/jest-preset.js @@ -0,0 +1,111 @@ +/* + * 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. + */ + +// For a detailed explanation regarding each configuration property, visit: +// https://jestjs.io/docs/en/configuration.html + +const { resolve } = require('path'); + +module.exports = { + // The directory where Jest should output its coverage files + coverageDirectory: '/target/kibana-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/kbn-test/target/jest/mocks/css_module_mock.js', + '\\.(css|less|scss)$': '/packages/kbn-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/kbn-test/target/jest/mocks/file_mock.js', + '\\.ace\\.worker.js$': '/packages/kbn-test/target/jest/mocks/worker_module_mock.js', + '\\.editor\\.worker.js$': '/packages/kbn-test/target/jest/mocks/worker_module_mock.js', + '^(!!)?file-loader!': '/packages/kbn-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/'], + + // Use this configuration option to add custom reporters to Jest + reporters: ['default', resolve(__dirname, './target/jest/junit_reporter')], + + // The paths to modules that run some code to configure or set up the testing environment before each test + setupFiles: [ + '/packages/kbn-test/target/jest/setup/babel_polyfill.js', + '/packages/kbn-test/target/jest/setup/polyfills.js', + '/packages/kbn-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/kbn-test/target/jest/setup/setup_test.js', + '/packages/kbn-test/target/jest/setup/mocks.js', + '/packages/kbn-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/kibana_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-thirteen', + + // 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/kbn-ui-framework/(dist|doc_site|generator-kui)/', + '/packages/kbn-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/kbn-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)[/\\\\].+\\.js$', + 'packages/kbn-pm/dist/index.js', + ], +}; diff --git a/packages/kbn-test/jest/package.json b/packages/kbn-test/jest/package.json new file mode 100644 index 0000000000000..c8b50f7b1b5ba --- /dev/null +++ b/packages/kbn-test/jest/package.json @@ -0,0 +1,4 @@ +{ + "main": "../target/jest", + "types": "../target/types/jest/index.d.ts" +} diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json index 550294dba1f23..ecf59f942d0f2 100644 --- a/packages/kbn-test/package.json +++ b/packages/kbn-test/package.json @@ -5,16 +5,22 @@ "license": "Apache-2.0", "main": "./target/index.js", "scripts": { - "build": "../../node_modules/.bin/babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/** --source-maps=inline", - "kbn:bootstrap": "yarn build", - "kbn:watch": "yarn build --watch" + "build": "node scripts/build", + "kbn:bootstrap": "node scripts/build --source-maps", + "kbn:watch": "node scripts/build --watch --source-maps" }, "kibana": { "devOnly": true }, + "dependencies": { + "@kbn/es": "link:../kbn-es", + "@kbn/i18n": "link:../kbn-i18n", + "@kbn/optimizer": "link:../kbn-optimizer" + }, "devDependencies": { "@kbn/babel-preset": "link:../kbn-babel-preset", "@kbn/dev-utils": "link:../kbn-dev-utils", + "@kbn/expect": "link:../kbn-expect", "@kbn/utils": "link:../kbn-utils" } -} \ No newline at end of file +} diff --git a/packages/kbn-test/scripts/build.js b/packages/kbn-test/scripts/build.js new file mode 100644 index 0000000000000..4ded402ab4439 --- /dev/null +++ b/packages/kbn-test/scripts/build.js @@ -0,0 +1,91 @@ +/* + * 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. + */ + +const { resolve } = require('path'); + +const del = require('del'); +const supportsColor = require('supports-color'); +const { run, withProcRunner } = require('@kbn/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 @kbn/i18n package', + flags: { + boolean: ['watch', 'source-maps'], + help: ` + --watch Run in watch mode + --source-maps Include sourcemaps + `, + }, + } +); diff --git a/packages/kbn-test/src/index.ts b/packages/kbn-test/src/index.ts index a57b92fbdde25..3e4a62387d1bf 100644 --- a/packages/kbn-test/src/index.ts +++ b/packages/kbn-test/src/index.ts @@ -58,5 +58,3 @@ export { runFailedTestsReporterCli } from './failed_tests_reporter'; export { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; export * from './functional_test_runner'; - -export * from './jest'; diff --git a/src/dev/jest/babel_transform.js b/packages/kbn-test/src/jest/babel_transform.js similarity index 100% rename from src/dev/jest/babel_transform.js rename to packages/kbn-test/src/jest/babel_transform.js diff --git a/packages/kbn-test/src/jest/index.ts b/packages/kbn-test/src/jest/index.ts index c6d680863d9c4..8604973f9f4be 100644 --- a/packages/kbn-test/src/jest/index.ts +++ b/packages/kbn-test/src/jest/index.ts @@ -17,6 +17,4 @@ * under the License. */ -export * from './junit_reporter'; - -export * from './report_path'; +export * from './utils'; diff --git a/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts b/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts index a95215a0044f1..1842d577bd797 100644 --- a/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts +++ b/packages/kbn-test/src/jest/integration_tests/junit_reporter.test.ts @@ -24,7 +24,7 @@ import { readFileSync } from 'fs'; import del from 'del'; import execa from 'execa'; import xml2js from 'xml2js'; -import { getUniqueJunitReportPath } from '@kbn/test'; +import { getUniqueJunitReportPath } from '../../report_path'; import { REPO_ROOT } from '@kbn/utils'; const MINUTE = 1000 * 60; diff --git a/packages/kbn-test/src/jest/junit_reporter.ts b/packages/kbn-test/src/jest/junit_reporter.ts index b6e964c22adfc..234b15724f498 100644 --- a/packages/kbn-test/src/jest/junit_reporter.ts +++ b/packages/kbn-test/src/jest/junit_reporter.ts @@ -27,7 +27,7 @@ import type { Config } from '@jest/types'; import { AggregatedResult, Test, BaseReporter } from '@jest/reporters'; import { escapeCdata } from '../mocha/xml'; -import { getUniqueJunitReportPath } from './report_path'; +import { getUniqueJunitReportPath } from '../report_path'; interface ReporterOptions { reportName?: string; diff --git a/src/dev/jest/mocks/css_module_mock.js b/packages/kbn-test/src/jest/mocks/css_module_mock.js similarity index 100% rename from src/dev/jest/mocks/css_module_mock.js rename to packages/kbn-test/src/jest/mocks/css_module_mock.js diff --git a/src/dev/jest/mocks/file_mock.js b/packages/kbn-test/src/jest/mocks/file_mock.js similarity index 100% rename from src/dev/jest/mocks/file_mock.js rename to packages/kbn-test/src/jest/mocks/file_mock.js diff --git a/src/dev/jest/mocks/style_mock.js b/packages/kbn-test/src/jest/mocks/style_mock.js similarity index 100% rename from src/dev/jest/mocks/style_mock.js rename to packages/kbn-test/src/jest/mocks/style_mock.js diff --git a/src/dev/jest/mocks/worker_module_mock.js b/packages/kbn-test/src/jest/mocks/worker_module_mock.js similarity index 100% rename from src/dev/jest/mocks/worker_module_mock.js rename to packages/kbn-test/src/jest/mocks/worker_module_mock.js diff --git a/src/dev/jest/setup/after_env.integration.js b/packages/kbn-test/src/jest/setup/after_env.integration.js similarity index 100% rename from src/dev/jest/setup/after_env.integration.js rename to packages/kbn-test/src/jest/setup/after_env.integration.js diff --git a/src/dev/jest/setup/babel_polyfill.js b/packages/kbn-test/src/jest/setup/babel_polyfill.js similarity index 100% rename from src/dev/jest/setup/babel_polyfill.js rename to packages/kbn-test/src/jest/setup/babel_polyfill.js diff --git a/src/dev/jest/setup/enzyme.js b/packages/kbn-test/src/jest/setup/enzyme.js similarity index 100% rename from src/dev/jest/setup/enzyme.js rename to packages/kbn-test/src/jest/setup/enzyme.js diff --git a/src/dev/jest/setup/mocks.js b/packages/kbn-test/src/jest/setup/mocks.js similarity index 100% rename from src/dev/jest/setup/mocks.js rename to packages/kbn-test/src/jest/setup/mocks.js diff --git a/src/dev/jest/setup/polyfills.js b/packages/kbn-test/src/jest/setup/polyfills.js similarity index 83% rename from src/dev/jest/setup/polyfills.js rename to packages/kbn-test/src/jest/setup/polyfills.js index 9e4f1db9ac289..2c1f7333d8126 100644 --- a/src/dev/jest/setup/polyfills.js +++ b/packages/kbn-test/src/jest/setup/polyfills.js @@ -28,3 +28,11 @@ const MutationObserver = require('mutation-observer'); Object.defineProperty(window, 'MutationObserver', { value: MutationObserver }); require('whatwg-fetch'); + +if (!global.URL.hasOwnProperty('createObjectURL')) { + Object.defineProperty(global.URL, 'createObjectURL', { value: () => '' }); +} + +// Will be replaced with a better solution in EUI +// https://github.com/elastic/eui/issues/3713 +global._isJest = true; diff --git a/src/test_utils/public/helpers/index.ts b/packages/kbn-test/src/jest/setup/react_mount_serializer.ts similarity index 67% rename from src/test_utils/public/helpers/index.ts rename to packages/kbn-test/src/jest/setup/react_mount_serializer.ts index fcc0102c76683..45ad4cb407175 100644 --- a/src/test_utils/public/helpers/index.ts +++ b/packages/kbn-test/src/jest/setup/react_mount_serializer.ts @@ -17,17 +17,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/kbn-test/src/jest/setup/react_testing_library.js similarity index 100% rename from src/dev/jest/setup/react_testing_library.js rename to packages/kbn-test/src/jest/setup/react_testing_library.js diff --git a/src/test_utils/public/index.ts b/packages/kbn-test/src/jest/setup/setup_test.js similarity index 77% rename from src/test_utils/public/index.ts rename to packages/kbn-test/src/jest/setup/setup_test.js index e57f1ae8ea7a9..94a4db0594504 100644 --- a/src/test_utils/public/index.ts +++ b/packages/kbn-test/src/jest/setup/setup_test.js @@ -17,9 +17,10 @@ * under the License. */ -export { - setSVGElementGetBBox, - setHTMLElementOffset, - setHTMLElementClientSizes, - setSVGElementGetComputedTextLength, -} from './helpers'; +/* + Global import, so we don't need to remember to import the lib in each file + https://www.npmjs.com/package/jest-styled-components#global-installation +*/ + +import 'jest-styled-components'; +import '@testing-library/jest-dom'; diff --git a/x-pack/test_utils/enzyme_helpers.tsx b/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx similarity index 81% rename from x-pack/test_utils/enzyme_helpers.tsx rename to packages/kbn-test/src/jest/utils/enzyme_helpers.tsx index 6e2c0144a9f0e..d23a496e7c675 100644 --- a/x-pack/test_utils/enzyme_helpers.tsx +++ b/packages/kbn-test/src/jest/utils/enzyme_helpers.tsx @@ -1,7 +1,20 @@ /* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ /** @@ -192,4 +205,14 @@ export const mountHook = ( }; }; -export const nextTick = () => new Promise((res) => process.nextTick(res)); +export function shallowWithI18nProvider(child: ReactElement) { + const wrapped = shallow({child}); + const name = typeof child.type === 'string' ? child.type : child.type.name; + return wrapped.find(name).dive(); +} + +export function mountWithI18nProvider(child: ReactElement) { + const wrapped = mount({child}); + const name = typeof child.type === 'string' ? child.type : child.type.name; + return wrapped.find(name); +} diff --git a/src/test_utils/public/helpers/find_test_subject.ts b/packages/kbn-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/kbn-test/src/jest/utils/find_test_subject.ts diff --git a/packages/kbn-test/src/jest/utils/get_url.test.ts b/packages/kbn-test/src/jest/utils/get_url.test.ts new file mode 100644 index 0000000000000..cc54efa4fe725 --- /dev/null +++ b/packages/kbn-test/src/jest/utils/get_url.test.ts @@ -0,0 +1,66 @@ +/* + * 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 { 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/kbn-test/src/jest/utils/get_url.ts b/packages/kbn-test/src/jest/utils/get_url.ts new file mode 100644 index 0000000000000..0bf70307d9236 --- /dev/null +++ b/packages/kbn-test/src/jest/utils/get_url.ts @@ -0,0 +1,75 @@ +/* + * 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'; + +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: kibanaTestUser.username + ':' + kibanaTestUser.password + * } + * @param {object} app The params to append + * example: + * { + * pathname: 'app/kibana', + * 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/kbn-test/src/jest/utils/index.ts b/packages/kbn-test/src/jest/utils/index.ts new file mode 100644 index 0000000000000..f85160652828b --- /dev/null +++ b/packages/kbn-test/src/jest/utils/index.ts @@ -0,0 +1,40 @@ +/* + * 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 * 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/kbn-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/kbn-test/src/jest/utils/jsdom_svg_mocks.ts diff --git a/src/test_utils/public/helpers/utils.ts b/packages/kbn-test/src/jest/utils/random.ts similarity index 92% rename from src/test_utils/public/helpers/utils.ts rename to packages/kbn-test/src/jest/utils/random.ts index 90788c4f4e521..3b4418b7120c1 100644 --- a/src/test_utils/public/helpers/utils.ts +++ b/packages/kbn-test/src/jest/utils/random.ts @@ -22,8 +22,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/kbn-test/src/jest/utils/redux_helpers.tsx similarity index 100% rename from src/test_utils/public/helpers/redux_helpers.tsx rename to packages/kbn-test/src/jest/utils/redux_helpers.tsx diff --git a/src/test_utils/public/helpers/router_helpers.tsx b/packages/kbn-test/src/jest/utils/router_helpers.tsx similarity index 93% rename from src/test_utils/public/helpers/router_helpers.tsx rename to packages/kbn-test/src/jest/utils/router_helpers.tsx index 94ff4798d0226..acc63758cd957 100644 --- a/src/test_utils/public/helpers/router_helpers.tsx +++ b/packages/kbn-test/src/jest/utils/router_helpers.tsx @@ -29,9 +29,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/kbn-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/kbn-test/src/jest/utils/stub_browser_storage.test.ts diff --git a/src/test_utils/public/stub_browser_storage.ts b/packages/kbn-test/src/jest/utils/stub_browser_storage.ts similarity index 100% rename from src/test_utils/public/stub_browser_storage.ts rename to packages/kbn-test/src/jest/utils/stub_browser_storage.ts diff --git a/packages/kbn-test/src/jest/utils/stub_web_worker.ts b/packages/kbn-test/src/jest/utils/stub_web_worker.ts new file mode 100644 index 0000000000000..170b641b235a4 --- /dev/null +++ b/packages/kbn-test/src/jest/utils/stub_web_worker.ts @@ -0,0 +1,36 @@ +/* + * 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. + */ + +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/kbn-test/src/jest/utils/testbed/index.ts similarity index 100% rename from src/test_utils/public/testbed/index.ts rename to packages/kbn-test/src/jest/utils/testbed/index.ts diff --git a/src/test_utils/public/testbed/mount_component.tsx b/packages/kbn-test/src/jest/utils/testbed/mount_component.tsx similarity index 95% rename from src/test_utils/public/testbed/mount_component.tsx rename to packages/kbn-test/src/jest/utils/testbed/mount_component.tsx index 9cebca8eda7d8..bc0748e1d18ac 100644 --- a/src/test_utils/public/testbed/mount_component.tsx +++ b/packages/kbn-test/src/jest/utils/testbed/mount_component.tsx @@ -23,7 +23,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/x-pack/test_utils/testbed/testbed.ts b/packages/kbn-test/src/jest/utils/testbed/testbed.ts similarity index 92% rename from x-pack/test_utils/testbed/testbed.ts rename to packages/kbn-test/src/jest/utils/testbed/testbed.ts index e981d0b6918a3..0e0ed4e09d31e 100644 --- a/x-pack/test_utils/testbed/testbed.ts +++ b/packages/kbn-test/src/jest/utils/testbed/testbed.ts @@ -1,7 +1,20 @@ /* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import { ComponentType, ReactWrapper } from 'enzyme'; @@ -31,7 +44,7 @@ const defaultConfig: TestBedConfig = { * * @example ```typescript - import { registerTestBed } from '../../../../test_utils'; + import { registerTestBed } from '@kbn/test/jest'; import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; import { remoteClustersStore } from '../../app/store'; diff --git a/src/test_utils/public/testbed/types.ts b/packages/kbn-test/src/jest/utils/testbed/types.ts similarity index 98% rename from src/test_utils/public/testbed/types.ts rename to packages/kbn-test/src/jest/utils/testbed/types.ts index 39422fa68081b..1ebdf8f28b5f5 100644 --- a/src/test_utils/public/testbed/types.ts +++ b/packages/kbn-test/src/jest/utils/testbed/types.ts @@ -74,6 +74,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. @@ -175,7 +176,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/packages/kbn-test/src/mocha/__tests__/junit_report_generation.js b/packages/kbn-test/src/mocha/__tests__/junit_report_generation.js index dc7d161eca5a3..407ab37123d5d 100644 --- a/packages/kbn-test/src/mocha/__tests__/junit_report_generation.js +++ b/packages/kbn-test/src/mocha/__tests__/junit_report_generation.js @@ -25,7 +25,7 @@ import { parseString } from 'xml2js'; import del from 'del'; import Mocha from 'mocha'; import expect from '@kbn/expect'; -import { getUniqueJunitReportPath } from '@kbn/test'; +import { getUniqueJunitReportPath } from '../../report_path'; import { setupJUnitReportGeneration } from '../junit_report_generation'; diff --git a/packages/kbn-test/src/mocha/junit_report_generation.js b/packages/kbn-test/src/mocha/junit_report_generation.js index 9ac9bd18548f4..84d488bd8b5a1 100644 --- a/packages/kbn-test/src/mocha/junit_report_generation.js +++ b/packages/kbn-test/src/mocha/junit_report_generation.js @@ -22,7 +22,7 @@ import { writeFileSync, mkdirSync } from 'fs'; import { inspect } from 'util'; import xmlBuilder from 'xmlbuilder'; -import { getUniqueJunitReportPath } from '@kbn/test'; +import { getUniqueJunitReportPath } from '../report_path'; import { getSnapshotOfRunnableLogs } from './log_cache'; import { escapeCdata } from '../'; diff --git a/packages/kbn-test/src/jest/report_path.ts b/packages/kbn-test/src/report_path.ts similarity index 94% rename from packages/kbn-test/src/jest/report_path.ts rename to packages/kbn-test/src/report_path.ts index c9cf3ce454e6a..8843204097e85 100644 --- a/packages/kbn-test/src/jest/report_path.ts +++ b/packages/kbn-test/src/report_path.ts @@ -20,7 +20,7 @@ import Fs from 'fs'; import Path from 'path'; -import { CI_PARALLEL_PROCESS_PREFIX } from '../ci_parallel_process_prefix'; +import { CI_PARALLEL_PROCESS_PREFIX } from './ci_parallel_process_prefix'; export function getUniqueJunitReportPath( rootDirectory: string, diff --git a/packages/kbn-test/tsconfig.json b/packages/kbn-test/tsconfig.json index fec35e45b2a15..3219e6cf3d6ee 100644 --- a/packages/kbn-test/tsconfig.json +++ b/packages/kbn-test/tsconfig.json @@ -1,11 +1,19 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-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/src/core/public/chrome/ui/header/collapsible_nav.test.tsx b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx index 267e17dc0a9d0..7fd79fa76635c 100644 --- a/src/core/public/chrome/ui/header/collapsible_nav.test.tsx +++ b/src/core/public/chrome/ui/header/collapsible_nav.test.tsx @@ -21,7 +21,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 '@kbn/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 868d7f29f34e4..722b2a209c88f 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -20,11 +20,10 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { BehaviorSubject } from 'rxjs'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { StubBrowserStorage, mountWithIntl } from '@kbn/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'; jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ htmlIdGenerator: () => () => 'mockId', 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 35a9cbc48f6c1..94896f42c5693 100644 --- a/src/core/public/fatal_errors/fatal_errors_screen.test.tsx +++ b/src/core/public/fatal_errors/fatal_errors_screen.test.tsx @@ -21,7 +21,7 @@ import { EuiCallOut } from '@elastic/eui'; import testSubjSelector from '@kbn/test-subj-selector'; import React from 'react'; import * as Rx from 'rxjs'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { FatalErrorsScreen } from './fatal_errors_screen'; diff --git a/src/core/public/notifications/toasts/error_toast.test.tsx b/src/core/public/notifications/toasts/error_toast.test.tsx index b497be526093d..07ba5e23c2175 100644 --- a/src/core/public/notifications/toasts/error_toast.test.tsx +++ b/src/core/public/notifications/toasts/error_toast.test.tsx @@ -19,7 +19,7 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ErrorToast } from './error_toast'; diff --git a/src/dev/jest/config.integration.js b/src/dev/jest/config.integration.js index 970c00bb68b98..9e7bbc34ac711 100644 --- a/src/dev/jest/config.integration.js +++ b/src/dev/jest/config.integration.js @@ -17,6 +17,7 @@ * under the License. */ +import preset from '@kbn/test/jest-preset'; import config from './config'; export default { @@ -26,7 +27,7 @@ export default { '**/integration_tests/**/*.test.ts', '**/integration_tests/**/*.test.tsx', ], - testPathIgnorePatterns: config.testPathIgnorePatterns.filter( + testPathIgnorePatterns: preset.testPathIgnorePatterns.filter( (pattern) => !pattern.includes('integration_tests') ), reporters: [ @@ -36,5 +37,5 @@ export default { { reportName: 'Jest Integration Tests' }, ], ], - setupFilesAfterEnv: ['/src/dev/jest/setup/after_env.integration.js'], + setupFilesAfterEnv: ['/packages/kbn-test/target/jest/setup/after_env.integration.js'], }; diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index f582a8f3d4410..9f445b0c05be9 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -17,9 +17,8 @@ * under the License. */ -import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../constants'; - export default { + preset: '@kbn/test', rootDir: '../../..', roots: [ '/src/plugins', @@ -51,53 +50,5 @@ export default { '!packages/kbn-ui-framework/src/services/index.js', '!packages/kbn-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/kibana-coverage/jest', - coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'], - moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'], - modulePathIgnorePatterns: ['__fixtures__/', 'target/'], - testEnvironment: 'jest-environment-jsdom-thirteen', - testMatch: ['**/*.test.{js,mjs,ts,tsx}'], - testPathIgnorePatterns: [ - '/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/', - '/packages/kbn-pm/dist/', - `${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`, - ], - 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)[/\\\\].+\\.js$', - 'packages/kbn-pm/dist/index.js', - ], - snapshotSerializers: [ - '/src/plugins/kibana_react/public/util/test_helpers/react_mount_serializer.ts', - '/node_modules/enzyme-to-json/serializer', - ], - reporters: ['default', '/packages/kbn-test/target/jest/junit_reporter'], + testRunner: 'jasmine2', }; diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index 9cd6ca6801bc3..1fbf039b6e4d7 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -49,6 +49,7 @@ export const IGNORE_FILE_GLOBS = [ 'Dockerfile*', 'vars/*', '.ci/pipeline-library/**/*', + 'packages/kbn-test/jest-preset.js', // filename must match language code which requires capital letters '**/translations/*.json', 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 cde2f47e7c180..6d63789b367b8 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 0703706a50101..1b50bce36bf76 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 54244909a668a..ff6211d960979 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 68a21c6a1587c..03a6fc1d30305 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 @@ -20,7 +20,7 @@ import React from 'react'; import { Observable } from 'rxjs'; import { ReactWrapper } from 'enzyme'; -import { mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { mountWithI18nProvider } from '@kbn/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 5b33b0e0ea120..d9b63f2e5334f 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 @@ -19,7 +19,7 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n/react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/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/form/form.test.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx index a691af4a22bef..f7461242220d8 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/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 01f54cce60319..58a31c3960f5b 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; 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 3e188ce591e9a..bb9f0a80e344f 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 @@ -27,7 +27,7 @@ import * as sinon from 'sinon'; import { serviceContextMock } from '../../../../contexts/services_context.mock'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { ServicesContextProvider, EditorContextProvider, diff --git a/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx b/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx index c6f223fa45c23..22795a4cbf9e3 100644 --- a/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx +++ b/src/plugins/dashboard/public/application/actions/library_notification_popover.test.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { DashboardContainer } from '..'; import { isErrorEmbeddable } from '../../embeddable_plugin'; -import { mountWithIntl } from '../../../../../test_utils/public/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { embeddablePluginMock } from '../../../../embeddable/public/mocks'; import { getSampleDashboardInput } from '../test_helpers'; import { 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 0a49e524d3350..c2162a931daf8 100644 --- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx +++ b/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 caa8321d7b8b2..9c337ef1259a9 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx @@ -17,7 +17,7 @@ * under the License. */ -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/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 42d8f92de80aa..5c4b976b15225 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 @@ -21,7 +21,7 @@ import sizeMe from 'react-sizeme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx index 60395bce678c2..94d0f8890c494 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 @@ -22,7 +22,7 @@ import React from 'react'; import { skip } from 'rxjs/operators'; import { mount } from 'enzyme'; import { I18nProvider } from '@kbn/i18n/react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { DashboardViewport, DashboardViewportProps } from './dashboard_viewport'; import { DashboardContainer, DashboardContainerOptions } from '../dashboard_container'; import { getSampleDashboardInput } from '../../test_helpers'; diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx index 24075e0a634ba..f8f7226d23454 100644 --- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx @@ -20,7 +20,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 '@kbn/test/jest'; import { I18nProvider } from '@kbn/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 ac3bf7ed2d794..a696e8f2265dc 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 @@ -19,7 +19,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/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 3eb7cb995ab19..ea12c55aecee9 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; jest.mock('../../../../saved_objects/public', () => ({ SavedObjectSaveModal: () => null, 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 aa1556480452a..5f4315b19648f 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 @@ -19,7 +19,7 @@ import { QueryStringManager } from './query_string_manager'; import { Storage } from '../../../../kibana_utils/public/storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/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 2053e0b94b21a..c970dd521c142 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 @@ -24,7 +24,7 @@ import { Filter, FilterStateStore, UI_SETTINGS } from '../../../common'; import { coreMock } from '../../../../../core/public/mocks'; import { BaseStateContainer, createStateContainer, Storage } from '../../../../kibana_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from '../../../../../test_utils/public/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/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 0b4a3f663eb6b..47af09bfc7c0e 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 @@ -29,7 +29,7 @@ import { Storage, } from '../../../../kibana_utils/public'; import { QueryService, QueryStart } from '../query_service'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/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 f8f576c4b6e97..bcc35b4f2971d 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 @@ -21,7 +21,7 @@ import React from 'react'; import { QueryLanguageSwitcher } from './language_switcher'; import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; import { coreMock } from '../../../../../core/public/mocks'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 27f924d98e6eb..e46b4918db040 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/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/shard_failure_modal/shard_failure_description.test.tsx b/src/plugins/data/public/ui/shard_failure_modal/shard_failure_description.test.tsx index d40770fb74ef1..c509c8ffa25d6 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 245ff8b7bdbfc..d740e6c2a9617 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 7a4ca80e6192f..8878e90073d8e 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 @@ -18,7 +18,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 '@kbn/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 22478ebd57393..ca277e304a8c2 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 ab7adba193d87..bddd399701984 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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/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 2cd829d89f78e..f591386e9047d 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/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 4085c22057c84..e63507b0d6e21 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/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 224e249a274cd..3d5698e2e0d96 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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_app/context_app_legacy.test.tsx b/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx index 77dd0a6d647c6..f76e0178e98b0 100644 --- a/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx +++ b/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { ContextAppLegacy } from './context_app_legacy'; import { IIndexPattern } from '../../../../../data/common/index_patterns'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DocTableLegacy } from '../../angular/doc_table/create_doc_table_react'; import { findTestSubject } from '@elastic/eui/lib/test'; import { ActionBar } from '../../angular/context/components/action_bar/action_bar'; 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 1cc8247957512..a99d5c04f47eb 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 d562291db46ac..9e22f481a95a5 100644 --- a/src/plugins/discover/public/application/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -19,7 +19,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 '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; import { Doc, DocProps } from './doc'; 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 c2eb4f08cf549..534947ea72148 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 e996da5fe0e3c..845ece0455830 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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/no_results/no_results.test.tsx b/src/plugins/discover/public/application/components/no_results/no_results.test.tsx index dde75236eb15e..4b17a5aa797d0 100644 --- a/src/plugins/discover/public/application/components/no_results/no_results.test.tsx +++ b/src/plugins/discover/public/application/components/no_results/no_results.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { DiscoverNoResults, DiscoverNoResultsProps } from './no_results'; 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 8ab296bf1af4f..02ed17cd01f07 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 @@ -21,7 +21,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 '@kbn/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 2cf626d182eeb..8607873b98d3d 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 @@ -21,7 +21,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 '@kbn/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 625d6833406eb..527be8cff9f0c 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 @@ -18,7 +18,7 @@ */ import React, { EventHandler, MouseEvent as ReactMouseEvent } from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 a1b231c2d4479..9109262e639da 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl as shallow } from '@kbn/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 3d2c20109a264..7504d181d82b2 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 @@ -24,7 +24,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 '@kbn/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 fdb0ff973dcf0..4fce196ed0b19 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 7889b05a88415..39e7bfdc864ac 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index aa0b504b63fbe..7ef605c7dab70 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/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 c717e4370231e..2104d93da9ad8 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { mount } from 'enzyme'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { findTestSubject } from '@elastic/eui/lib/test'; import { I18nProvider } from '@kbn/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 95aee3d9cb335..7c65041e74d36 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 @@ -27,7 +27,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 '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { coreMock } from '../../../../../../../../core/public/mocks'; import { findTestSubject } from '@elastic/eui/lib/test'; 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 a4c80e1d86a80..9af4b80c7c885 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 @@ -20,7 +20,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 '@kbn/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 dbfa55a4e0f13..1ca62d2170b71 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 @@ -18,7 +18,7 @@ */ import { Container, isErrorEmbeddable } from '../../../..'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { CustomizePanelTitleAction } from './customize_panel_action'; import { ContactCardEmbeddable, 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 24d94020af4dc..4014d4aa83735 100644 --- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -35,7 +35,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 '@kbn/test/jest'; let api: EmbeddableStart; let container: Container; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts index f9f718b8b2f33..734bede78e033 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/shared_imports.ts @@ -17,6 +17,6 @@ * under the License. */ -export { registerTestBed, TestBed } from '../../../../../test_utils/public/testbed'; +export { registerTestBed, TestBed } from '@kbn/test/jest'; -export { getRandomString } from '../../../../../test_utils/public/helpers'; +export { getRandomString } from '@kbn/test/jest'; 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 9ba554dd2c222..e9ac686df83d1 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 @@ -19,7 +19,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 69c7ec46a7a2c..25e8c1306bced 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 @@ -19,7 +19,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 f3ce6eb17e632..2b8a5f1c96d01 100644 --- a/src/plugins/home/public/application/components/recently_accessed.test.js +++ b/src/plugins/home/public/application/components/recently_accessed.test.js @@ -21,7 +21,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 '@kbn/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 6c9ce530f6b20..e446552fb4322 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 ae87bc6030c9a..bb81875e12021 100644 --- a/src/plugins/home/public/application/components/tutorial/introduction.test.js +++ b/src/plugins/home/public/application/components/tutorial/introduction.test.js @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 e7b7d8ed1d7fd..77c625a226ac0 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 @@ -19,7 +19,7 @@ import React from 'react'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/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 65e11170e0e42..316d4a08384ea 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.test.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.test.js @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { Tutorial } from './tutorial'; 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 acc133a4dd649..a760e5918cea8 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 @@ -19,7 +19,7 @@ import React from 'react'; import { Header } from '../header'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; describe('Header', () => { it('should render normally', () => { 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 ffb3779d47c89..612218fd711f3 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 @@ -19,7 +19,7 @@ import React from 'react'; import { AdvancedOptions } from '../advanced_options'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 8994ffd79b6e4..20a861809f4fd 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 @@ -19,7 +19,7 @@ import React from 'react'; import { TimeField } from '../time_field'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; describe('TimeField', () => { it('should render normally', () => { 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 f13cb0975c8d2..9bcdcfde639c2 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 a8356923eb381..9fa9dda808f7b 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from '../../../../../../../../../test_utils/public/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 637b35911d369..8a42ed0bd0dbc 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 d7e74bbec2bf7..db1a530863c50 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 01f405e9aff1f..b244a4f728080 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; import { FormatEditorSamples } from './samples'; 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 83eb803333afc..333bb73678362 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 @@ -19,7 +19,7 @@ import React from 'react'; import { EmptyIndexPatternPrompt } from '../empty_index_pattern_prompt'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 9a4a04af0354e..23d11ffc7a671 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 @@ -22,7 +22,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 '@kbn/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 0a7f6fc244a91..a85f98c7b89ba 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/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 0c0d94f0cf631..fa9f9222ab186 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 @@ -23,7 +23,7 @@ import { shallow } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/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 c53d7abc4d659..0f126e915a68c 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 @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 1ff03d555739e..b7afe45e8e0de 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 @@ -20,7 +20,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 '@kbn/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 0b5f36acd2fc3..560daf14bd085 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 @@ -20,7 +20,7 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 4944a9dacfed6..d8b3c4ce707d6 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 @@ -19,7 +19,7 @@ import React from 'react'; import sinon from 'sinon'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 569d115c9dbda..085e834285f52 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { RangeControl, ceilWithPrecision, floorWithPrecision } from './range_control'; import { RangeControl as RangeControlClass } from '../../control/range_control_factory'; diff --git a/src/plugins/inspector/public/ui/inspector_panel.test.tsx b/src/plugins/inspector/public/ui/inspector_panel.test.tsx index 67e197abe7134..731ccef551448 100644 --- a/src/plugins/inspector/public/ui/inspector_panel.test.tsx +++ b/src/plugins/inspector/public/ui/inspector_panel.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 6a7f878ef807e..82bec5ee3fe8c 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 @@ -20,7 +20,7 @@ import React, { Suspense } from 'react'; import { getDataViewDescription } from '../index'; import { DataAdapter } from '../../../../common/adapters/data'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; jest.mock('../lib/export_csv', () => ({ exportAsCsv: jest.fn(), diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx index f5cdbd9e27e28..c04aa9db87ace 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { AddData } from './add_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/kibana_overview/public/components/getting_started/getting_started.test.tsx b/src/plugins/kibana_overview/public/components/getting_started/getting_started.test.tsx index 7d40c4174f39b..856966732d405 100644 --- a/src/plugins/kibana_overview/public/components/getting_started/getting_started.test.tsx +++ b/src/plugins/kibana_overview/public/components/getting_started/getting_started.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { GettingStarted } from './getting_started'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx index 3ce2364c96083..69ef12f217738 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { ManageData } from './manage_data'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; const mockFeatures = [ diff --git a/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx b/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx index 6716c28b1f682..88fc717b97543 100644 --- a/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx +++ b/src/plugins/kibana_overview/public/components/news_feed/news_feed.test.tsx @@ -20,7 +20,7 @@ import moment from 'moment'; import React from 'react'; import { NewsFeed } from './news_feed'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; const mockNewsFetchResult = { error: null, diff --git a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx index efef0a8a1f0a4..07c3a6e69c15c 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx @@ -20,7 +20,7 @@ import moment from 'moment'; import React from 'react'; import { Overview } from './overview'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FeatureCatalogueCategory } from 'src/plugins/home/public'; jest.mock('../../../../../../src/plugins/kibana_react/public', () => ({ diff --git a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx index ac28211d5032a..f90ecdda93242 100644 --- a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx +++ b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { OverviewPageFooter } from './overview_page_footer'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; jest.mock('../../app_links', () => ({ RedirectAppLinks: jest.fn((element: JSX.Element) => element), diff --git a/src/plugins/kibana_react/public/overview_page/overview_page_header/overview_page_header.test.tsx b/src/plugins/kibana_react/public/overview_page/overview_page_header/overview_page_header.test.tsx index 73e5dada02d09..fd03c9d53aac2 100644 --- a/src/plugins/kibana_react/public/overview_page/overview_page_header/overview_page_header.test.tsx +++ b/src/plugins/kibana_react/public/overview_page/overview_page_header/overview_page_header.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { OverviewPageHeader } from './overview_page_header'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; jest.mock('../../app_links', () => ({ RedirectAppLinks: jest.fn((element: JSX.Element) => element), diff --git a/src/plugins/kibana_react/public/use_url_tracker/use_url_tracker.test.tsx b/src/plugins/kibana_react/public/use_url_tracker/use_url_tracker.test.tsx index d1425a09b2f9c..695c8fc29c0c2 100644 --- a/src/plugins/kibana_react/public/use_url_tracker/use_url_tracker.test.tsx +++ b/src/plugins/kibana_react/public/use_url_tracker/use_url_tracker.test.tsx @@ -19,7 +19,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 '@kbn/test/jest'; import { createMemoryHistory } from 'history'; describe('useUrlTracker', () => { diff --git a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts index e50469546417c..2a50fa7a70247 100644 --- a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { createMemoryHistory, History } from 'history'; import { createKbnUrlTracker, KbnUrlTracker } from './kbn_url_tracker'; import { BehaviorSubject, Subject } from 'rxjs'; diff --git a/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts b/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts index d7e5f99ffb700..0301cff83799f 100644 --- a/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/url_tracker.test.ts @@ -18,7 +18,7 @@ */ import { createUrlTracker, IUrlTracker } from './url_tracker'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { createMemoryHistory, History } from 'history'; describe('urlTracker', () => { diff --git a/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts b/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts index 0450f420784dd..4b2b2bd99911b 100644 --- a/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts +++ b/src/plugins/kibana_utils/public/state_sync/state_sync.test.ts @@ -33,7 +33,7 @@ import { IKbnUrlStateStorage, ISessionStorageStateStorage, } from './state_sync_state_storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { createBrowserHistory, History } from 'history'; import { INullableBaseStateContainer } from './types'; diff --git a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts index f69629e755008..d38f19b0f09b6 100644 --- a/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts +++ b/src/plugins/kibana_utils/public/state_sync/state_sync_state_storage/create_session_storage_state_storage.test.ts @@ -21,7 +21,7 @@ import { createSessionStorageStateStorage, ISessionStorageStateStorage, } from './create_session_storage_state_storage'; -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; describe('SessionStorageStateStorage', () => { let browserStorage: StubBrowserStorage; diff --git a/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts b/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts index f0ff77d516270..c1e4b0e6261ba 100644 --- a/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts +++ b/src/plugins/kibana_utils/public/storage/hashed_item_store/hashed_item_store.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { HashedItemStore } from './hashed_item_store'; describe('hashedItemStore', () => { diff --git a/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts b/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts index 43a8856176c42..4d722a818fe12 100644 --- a/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts +++ b/src/plugins/kibana_utils/public/storage/hashed_item_store/mock.ts @@ -17,7 +17,7 @@ * under the License. */ -import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { HashedItemStore } from './hashed_item_store'; /** 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 147feee3cd472..0cd00ae5d6478 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 @@ -23,7 +23,7 @@ import { act } from 'react-dom/test-utils'; import { MountPoint } from 'kibana/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 '@kbn/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 9ba58379c5ce1..3e82421bc7901 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 @@ -20,7 +20,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 '@kbn/test/jest'; describe('TopNavMenu', () => { const ensureMenuItemDisabled = (data: TopNavMenuData) => { 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 15400087c2641..9701d46c55513 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 @@ -20,7 +20,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 '@kbn/test/jest'; describe('SavedObjectSaveModal', () => { it('should render matching snapshot', () => { 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 37da411a1e96b..0994f704464e5 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 @@ -28,7 +28,7 @@ import { } from './flyout.test.mocks'; import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; import { coreMock } from '../../../../../../core/public/mocks'; import { serviceRegistryMock } from '../../../services/service_registry.mock'; import { Flyout, FlyoutProps, FlyoutState } from './flyout'; 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 467347d95d1d7..61400bd3ebe16 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 @@ -19,7 +19,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { shallowWithI18nProvider, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithIntl } from '@kbn/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 20ac5a903ef22..d1224a03af98e 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 @@ -19,7 +19,7 @@ import React from 'react'; import { ShallowWrapper } from 'enzyme'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/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 7576b62552aa2..6d93a8c164bcf 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithIntl } from '@kbn/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 ead2738973074..3bea827022285 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider } from '@kbn/test/jest'; import { httpServiceMock } from '../../../../../../core/public/mocks'; import { Relationships, RelationshipsProps } from './relationships'; 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 f83536d2c5ea0..b4d4f55b0fb5c 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers'; +import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/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 63aefde6fd233..0171c13fd974b 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 @@ -30,7 +30,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 '@kbn/test/jest'; import { httpServiceMock, overlayServiceMock, diff --git a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx index a81f361689743..7bd2d9c4e5a0a 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/insecure_cluster_service.test.tsx @@ -20,7 +20,7 @@ import { InsecureClusterService } from './insecure_cluster_service'; import { ConfigType } from '../config'; import { coreMock } from '../../../../core/public/mocks'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; let mockOnDismissCallback: (persist: boolean) => void = jest.fn().mockImplementation(() => { throw new Error('expected callback to be replaced!'); 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 097c17862c668..f180927618aab 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 dbe0941345a02..19dd805129b23 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 f4e0287cab93f..6c5fb2473023e 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 @@ -18,7 +18,7 @@ */ import React from 'react'; import { EuiButton } from '@elastic/eui'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { OptedInNoticeBanner } from './opted_in_notice_banner'; describe('OptInDetailsComponent', () => { diff --git a/src/plugins/telemetry_management_section/public/components/example_security_payload.test.tsx b/src/plugins/telemetry_management_section/public/components/example_security_payload.test.tsx index e27342a0621be..2baa590c3aadc 100644 --- a/src/plugins/telemetry_management_section/public/components/example_security_payload.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/example_security_payload.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import ExampleSecurityPayload from './example_security_payload'; describe('example security payload', () => { 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 fe5e73a244893..f91c534ad5ff7 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 c80d0daf5a695..09858a6a8474f 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 cb21c66c1cbc1..e7693d1e918bb 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 @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/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/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 7964da23d8f50..25c0387bee9fb 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 @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 5c95d72bcd282..5e4260059cea9 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DateRangesParamEditor } from './date_ranges'; import { KibanaContextProvider } from '../../../../kibana_react/public'; import { docLinksServiceMock } from '../../../../../core/public/mocks'; 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 caab47892de93..f4eb5e30408b2 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/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 74dab1a3b551a..3948c8bcb0b0b 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { AggregateValueProp, TopAggregateParamEditor, 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 89a6a67bcb2fb..11e3b71345a5d 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 @@ -23,7 +23,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 '@kbn/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 7da77ce4785cb..597aafea0d162 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 @@ -22,7 +22,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 '@kbn/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 0fb3e80344e2b..3c6c649f2948b 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 6c75e081429de..00e62a9bfad44 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 f25cd310f6353..5c337a05c091a 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 aa4afda028a29..8f7267f20729b 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 db6024d48be12..fb84ae9dd17b4 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 @@ -22,7 +22,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 '@kbn/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 936cc000db8d9..81ccf69fc974a 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 @@ -18,7 +18,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 39a2228984854..727c2ebd763c6 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 @@ -18,7 +18,7 @@ */ import React from 'react'; import { GaugeSeries } from './series'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 cd4bca453d4d8..e8057a8ffb081 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 @@ -19,7 +19,7 @@ import React from 'react'; import { MetricSeries } from './series'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/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 39ae94b7489a2..112cfeaa29d5a 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 @@ -19,7 +19,7 @@ import React from 'react'; import { expect } from 'chai'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/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 c5dfebdf720d8..070433ca03f6d 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 @@ -22,7 +22,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 '@kbn/test/jest'; import { valueAxis, seriesParam, vis } from './mocks'; describe('ValueAxesPanel component', () => { 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 d8d5087f8c380..57e378846e92c 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 @@ -23,7 +23,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@kbn/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 9c714af4d8434..f383c87b87a21 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 @@ -23,7 +23,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@kbn/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 119a24d2f25d1..a4814a6b81454 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 @@ -22,7 +22,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@kbn/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 824d7073d6db5..e30df49c3e776 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 @@ -23,7 +23,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@kbn/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 0c4fac97ccb9c..933eea12481b6 100644 --- a/src/plugins/vis_type_vislib/public/vislib/vis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/vis.test.js @@ -23,7 +23,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../test_utils/public'; +} from '@kbn/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 94c9693819b69..3aedb61f5b3a7 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 @@ -18,7 +18,7 @@ */ import d3 from 'd3'; -import { setHTMLElementClientSizes, setSVGElementGetBBox } from '../../../../../test_utils/public'; +import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@kbn/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 913b237a10e58..95b9a3c1b033a 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 @@ -19,7 +19,7 @@ import $ from 'jquery'; import _ from 'lodash'; -import { setHTMLElementClientSizes, setSVGElementGetBBox } from '../../../../../test_utils/public'; +import { setHTMLElementClientSizes, setSVGElementGetBBox } from '@kbn/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 1207db2e54bb8..2538f7c1c5c64 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 @@ -24,7 +24,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../test_utils/public'; +} from '@kbn/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 ae15d95d560ca..b65381ec294ee 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 @@ -24,7 +24,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@kbn/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 d7fc177a30009..e693c44f741f8 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 @@ -24,7 +24,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@kbn/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 a7534add76e36..875ddd6c33ca7 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 @@ -24,7 +24,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@kbn/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 8d86df7c27da4..bed33fd801002 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 @@ -24,7 +24,7 @@ import { setHTMLElementClientSizes, setSVGElementGetBBox, setSVGElementGetComputedTextLength, -} from '../../../../../../test_utils/public'; +} from '@kbn/test/jest'; // Data import seriesPos from '../../../fixtures/mock_data/date_histogram/_series'; diff --git a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx index 3cbe6a0b604c6..20cc1c0630ff9 100644 --- a/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/agg_based_selection/agg_based_selection.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { TypesStart, VisType, VisGroups } from '../../vis_types'; import { AggBasedSelection } from './agg_based_selection'; diff --git a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx index b357f42bbae8b..797f0cf9d7ad0 100644 --- a/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx +++ b/src/plugins/visualizations/public/wizard/group_selection/group_selection.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { TypesStart, VisType, VisGroups } from '../../vis_types'; import { GroupSelection } from './group_selection'; import { DocLinksStart } from '../../../../../core/public'; 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 eea364b754e31..c41ccd23a8497 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { TypesStart, VisType, VisGroups } from '../vis_types'; import NewVisModal from './new_vis_modal'; import { ApplicationStart, SavedObjectsStart, DocLinksStart } from '../../../../core/public'; diff --git a/src/test_utils/public/enzyme_helpers.tsx b/src/test_utils/public/enzyme_helpers.tsx deleted file mode 100644 index ce4e7c7298734..0000000000000 --- a/src/test_utils/public/enzyme_helpers.tsx +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -/** - * Components using the @kbn/i18n module require access to the intl context. - * This is not available when mounting single components in Enzyme. - * These helper functions aim to address that and wrap a valid, - * intl context around them. - */ - -import { I18nProvider, InjectedIntl, intlShape, __IntlProvider } from '@kbn/i18n/react'; -import { mount, ReactWrapper, render, shallow } from 'enzyme'; -import React, { ReactElement, ValidationMap } from 'react'; - -// Use fake component to extract `intl` property to use in tests. -const { intl } = (mount( - -
-
-).find('IntlProvider') as ReactWrapper<{}, {}, __IntlProvider>) - .instance() - .getChildContext(); - -function getOptions(context = {}, childContextTypes: ValidationMap = {}, props = {}) { - return { - context: { - ...context, - intl, - }, - childContextTypes: { - ...childContextTypes, - intl: intlShape, - }, - ...props, - }; -} - -/** - * When using @kbn/i18n `injectI18n` on components, props.intl is required. - */ -function nodeWithIntlProp(node: ReactElement): ReactElement { - return React.cloneElement(node, { intl }); -} - -/** - * Creates the wrapper instance using shallow with provided intl object into context - * - * @param node The React element or cheerio wrapper - * @param options properties to pass into shallow wrapper - * @return The wrapper instance around the rendered output with intl object in context - */ -export function shallowWithIntl( - node: ReactElement, - { - context, - childContextTypes, - ...props - }: { - context?: any; - childContextTypes?: ValidationMap; - } = {} -) { - const options = getOptions(context, childContextTypes, props); - - return shallow(nodeWithIntlProp(node), options); -} - -/** - * Creates the wrapper instance using mount with provided intl object into context - * - * @param node The React element or cheerio wrapper - * @param options properties to pass into mount wrapper - * @return The wrapper instance around the rendered output with intl object in context - */ -export function mountWithIntl( - node: ReactElement, - { - context, - childContextTypes, - ...props - }: { - context?: any; - childContextTypes?: ValidationMap; - } = {} -) { - const options = getOptions(context, childContextTypes, props); - - return mount(nodeWithIntlProp(node), options); -} - -/** - * Creates the wrapper instance using render with provided intl object into context - * - * @param node The React element or cheerio wrapper - * @param options properties to pass into render wrapper - * @return The wrapper instance around the rendered output with intl object in context - */ -export function renderWithIntl( - node: ReactElement, - { - context, - childContextTypes, - ...props - }: { - context?: any; - childContextTypes?: ValidationMap; - } = {} -) { - const options = getOptions(context, childContextTypes, props); - - return render(nodeWithIntlProp(node), options); -} - -export const nextTick = () => new Promise((res) => process.nextTick(res)); - -export function shallowWithI18nProvider(child: ReactElement) { - const wrapped = shallow({child}); - const name = typeof child.type === 'string' ? child.type : child.type.name; - return wrapped.find(name).dive(); -} - -export function mountWithI18nProvider(child: ReactElement) { - const wrapped = mount({child}); - const name = typeof child.type === 'string' ? child.type : child.type.name; - return wrapped.find(name); -} diff --git a/src/test_utils/public/testbed/testbed.ts b/src/test_utils/public/testbed/testbed.ts deleted file mode 100644 index 1044189009c64..0000000000000 --- a/src/test_utils/public/testbed/testbed.ts +++ /dev/null @@ -1,346 +0,0 @@ -/* - * 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 { ComponentType, ReactWrapper } from 'enzyme'; - -import { findTestSubject, reactRouterMock } from '../helpers'; -import { - mountComponentSync, - mountComponentAsync, - getJSXComponentWithProps, -} from './mount_component'; -import { TestBedConfig, TestBed, SetupFunc } from './types'; - -const defaultConfig: TestBedConfig = { - defaultProps: {}, - memoryRouter: { - wrapComponent: true, - }, - store: null, -}; - -/** - * Register a new Testbed to test a React Component. - * - * @param Component The component under test - * @param config An optional configuration object for the Testbed - * - * @example - ```typescript - import { registerTestBed } from '../../../../test_utils'; - 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(); - expect(exists('remoteClustersTable')).toBe(true); - }); - }); - ``` - */ -export const registerTestBed = ( - Component: ComponentType, - config?: TestBedConfig -): SetupFunc => { - const { - defaultProps = defaultConfig.defaultProps, - memoryRouter = defaultConfig.memoryRouter!, - store = defaultConfig.store, - doMountAsync = false, - } = config || {}; - - // Keep a reference to the React Router - let router: any; - - const onRouter = (_router: any) => { - router = _router; - - if (memoryRouter.onRouter) { - memoryRouter.onRouter(_router); - } - }; - - /** - * In some cases, component have some logic that interacts with the react router - * _before_ the component is mounted.(Class constructor() I'm looking at you :) - * - * By adding the following lines, we make sure there is always a router available - * when instantiating the Component. - */ - onRouter(reactRouterMock); - - const setup: SetupFunc = (props) => { - // If a function is provided we execute it - const storeToMount = typeof store === 'function' ? store() : store!; - const mountConfig = { - Component, - memoryRouter, - store: storeToMount, - props: { - ...defaultProps, - ...props, - }, - onRouter, - }; - - if (doMountAsync) { - return mountComponentAsync(mountConfig).then(onComponentMounted); - } - - return onComponentMounted(mountComponentSync(mountConfig)); - - // --------------------- - - function onComponentMounted(component: ReactWrapper) { - /** - * ---------------------------------------------------------------- - * Utils - * ---------------------------------------------------------------- - */ - - const find: TestBed['find'] = (testSubject: T, sourceReactWrapper = component) => { - const testSubjectToArray = testSubject.split('.'); - - return testSubjectToArray.reduce((reactWrapper, subject, i) => { - const target = findTestSubject(reactWrapper, subject); - if (!target.length && i < testSubjectToArray.length - 1) { - throw new Error( - `Can't access nested test subject "${ - testSubjectToArray[i + 1] - }" of unknown node "${subject}"` - ); - } - return target; - }, sourceReactWrapper); - }; - - const exists: TestBed['exists'] = (testSubject, count = 1) => - find(testSubject).length === count; - - const setProps: TestBed['setProps'] = (updatedProps) => { - if (memoryRouter.wrapComponent !== false) { - throw new Error( - 'setProps() can only be called on a component **not** wrapped by a router route.' - ); - } - if (store === null) { - return component.setProps({ ...defaultProps, ...updatedProps }); - } - // Update the props on the Redux Provider children - return component.setProps({ - children: getJSXComponentWithProps(Component, { ...defaultProps, ...updatedProps }), - }); - }; - - const waitFor: TestBed['waitFor'] = async (testSubject: T, count = 1) => { - 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 process = async (): Promise => { - const elemFound = exists(testSubject, count); - - if (elemFound) { - // 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!` - ); - } - - return new Promise((resolve) => setTimeout(resolve, WAIT_INTERVAL)).then(() => { - component.update(); - return process(); - }); - }; - - return process(); - }; - - /** - * ---------------------------------------------------------------- - * Forms - * ---------------------------------------------------------------- - */ - - const setInputValue: TestBed['form']['setInputValue'] = ( - input, - value, - isAsync = false - ) => { - const formInput = typeof input === 'string' ? find(input) : (input as ReactWrapper); - - if (!formInput.length) { - throw new Error(`Input "${input}" was not found.`); - } - formInput.simulate('change', { target: { value } }); - component.update(); - - if (!isAsync) { - return; - } - return new Promise((resolve) => setTimeout(resolve)); - }; - - const setSelectValue: TestBed['form']['setSelectValue'] = ( - select, - value, - doUpdateComponent = true - ) => { - const formSelect = typeof select === 'string' ? find(select) : (select as ReactWrapper); - - if (!formSelect.length) { - throw new Error(`Select "${select}" was not found.`); - } - - formSelect.simulate('change', { target: { value } }); - - if (doUpdateComponent) { - component.update(); - } - }; - - const selectCheckBox: TestBed['form']['selectCheckBox'] = ( - testSubject, - isChecked = true - ) => { - const checkBox = find(testSubject); - if (!checkBox.length) { - throw new Error(`"${testSubject}" was not found.`); - } - checkBox.simulate('change', { target: { checked: isChecked } }); - }; - - const toggleEuiSwitch: TestBed['form']['toggleEuiSwitch'] = (testSubject) => { - const checkBox = find(testSubject); - if (!checkBox.length) { - throw new Error(`"${testSubject}" was not found.`); - } - checkBox.simulate('click'); - }; - - const setComboBoxValue: TestBed['form']['setComboBoxValue'] = ( - comboBoxTestSubject, - value - ) => { - const comboBox = find(comboBoxTestSubject); - const formInput = findTestSubject(comboBox, 'comboBoxSearchInput'); - setInputValue(formInput, value); - - // keyCode 13 === ENTER - comboBox.simulate('keydown', { keyCode: 13 }); - component.update(); - }; - - const getErrorsMessages: TestBed['form']['getErrorsMessages'] = () => { - const errorMessagesWrappers = component.find('.euiFormErrorText'); - return errorMessagesWrappers.map((err) => err.text()); - }; - - /** - * ---------------------------------------------------------------- - * Tables - * ---------------------------------------------------------------- - */ - - /** - * Parse an EUI table and return meta data information about its rows and colum content. - * - * @param tableTestSubject The data test subject of the EUI table - */ - const getMetaData: TestBed['table']['getMetaData'] = (tableTestSubject) => { - const table = find(tableTestSubject); - - if (!table.length) { - throw new Error(`Eui Table "${tableTestSubject}" not found.`); - } - - const rows = table - .find('tr') - .slice(1) // we remove the first row as it is the table header - .map((row) => ({ - reactWrapper: row, - columns: row.find('td').map((col) => ({ - reactWrapper: col, - // We can't access the td value with col.text() because - // eui adds an extra div in td on mobile => (.euiTableRowCell__mobileHeader) - value: col.find('.euiTableCellContent').text(), - })), - })); - - // Also output the raw cell values, in the following format: [[td0, td1, td2], [td0, td1, td2]] - const tableCellsValues = rows.map(({ columns }) => columns.map((col) => col.value)); - return { rows, tableCellsValues }; - }; - - /** - * ---------------------------------------------------------------- - * Router - * ---------------------------------------------------------------- - */ - const navigateTo = (_url: string) => { - const url = - _url[0] === '#' - ? _url.replace('#', '') // remove the beginning hash as the memory router does not understand them - : _url; - router.history.push(url); - }; - - return { - component, - exists, - find, - setProps, - waitFor, - table: { - getMetaData, - }, - form: { - setInputValue, - setSelectValue, - selectCheckBox, - toggleEuiSwitch, - setComboBoxValue, - getErrorsMessages, - }, - router: { - navigateTo, - }, - }; - } - }; - - return setup; -}; diff --git a/x-pack/dev-tools/jest/create_jest_config.js b/x-pack/dev-tools/jest/create_jest_config.js index 1495d52fceae8..2ddc58500d15e 100644 --- a/x-pack/dev-tools/jest/create_jest_config.js +++ b/x-pack/dev-tools/jest/create_jest_config.js @@ -4,71 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -export function createJestConfig({ kibanaDirectory, rootDir, xPackKibanaDirectory }) { - const fileMockPath = `${kibanaDirectory}/src/dev/jest/mocks/file_mock.js`; +export function createJestConfig({ kibanaDirectory, rootDir }) { return { - rootDir, - roots: ['/plugins'], - moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'], - moduleNameMapper: { - '@elastic/eui$': `${kibanaDirectory}/node_modules/@elastic/eui/test-env`, - '@elastic/eui/lib/(.*)?': `${kibanaDirectory}/node_modules/@elastic/eui/test-env/$1`, - '^fixtures/(.*)': `${kibanaDirectory}/src/fixtures/$1`, - '^src/core/(.*)': `${kibanaDirectory}/src/core/$1`, - '^src/legacy/(.*)': `${kibanaDirectory}/src/legacy/$1`, - '^src/plugins/(.*)': `${kibanaDirectory}/src/plugins/$1`, - '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': fileMockPath, - '\\.module.(css|scss)$': `${kibanaDirectory}/src/dev/jest/mocks/css_module_mock.js`, - '\\.(css|less|scss)$': `${kibanaDirectory}/src/dev/jest/mocks/style_mock.js`, - '\\.ace\\.worker.js$': `${kibanaDirectory}/src/dev/jest/mocks/worker_module_mock.js`, - '\\.editor\\.worker.js$': `${kibanaDirectory}/src/dev/jest/mocks/worker_module_mock.js`, - '^test_utils/enzyme_helpers': `${xPackKibanaDirectory}/test_utils/enzyme_helpers.tsx`, - '^test_utils/find_test_subject': `${xPackKibanaDirectory}/test_utils/find_test_subject.ts`, - '^test_utils/stub_web_worker': `${xPackKibanaDirectory}/test_utils/stub_web_worker.ts`, - '^(!!)?file-loader!': fileMockPath, - }, - collectCoverageFrom: [ - 'plugins/**/*.{js,mjs,jsx,ts,tsx}', - '!**/{__test__,__snapshots__,__examples__,integration_tests,tests}/**', - '!**/*.test.{js,mjs,ts,tsx}', - '!**/flot-charts/**', - '!**/test/**', - '!**/build/**', - '!**/scripts/**', - '!**/mocks/**', - '!**/plugins/apm/e2e/**', - '!**/plugins/siem/cypress/**', - '!**/plugins/**/test_helpers/**', - ], - coveragePathIgnorePatterns: ['.*\\.d\\.ts'], - coverageDirectory: `${kibanaDirectory}/target/kibana-coverage/jest`, - coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html'], - setupFiles: [ - `${kibanaDirectory}/src/dev/jest/setup/babel_polyfill.js`, - `${xPackKibanaDirectory}/dev-tools/jest/setup/polyfills.js`, - `${xPackKibanaDirectory}/dev-tools/jest/setup/enzyme.js`, - ], - setupFilesAfterEnv: [ - `${xPackKibanaDirectory}/dev-tools/jest/setup/setup_test.js`, - `${kibanaDirectory}/src/dev/jest/setup/mocks.js`, - `${kibanaDirectory}/src/dev/jest/setup/react_testing_library.js`, - ], - testEnvironment: 'jest-environment-jsdom-thirteen', - testMatch: ['**/*.test.{js,mjs,ts,tsx}'], - testRunner: 'jest-circus/runner', - transform: { - '^.+\\.(js|tsx?)$': `${kibanaDirectory}/src/dev/jest/babel_transform.js`, - '^.+\\.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)[/\\\\].+\\.js$', - ], - snapshotSerializers: [ - `${kibanaDirectory}/node_modules/enzyme-to-json/serializer`, - `${kibanaDirectory}/src/plugins/kibana_react/public/util/test_helpers/react_mount_serializer.ts`, - ], + preset: '@kbn/test', + rootDir: kibanaDirectory, + roots: [`${rootDir}/plugins`], reporters: [ 'default', [ diff --git a/x-pack/dev-tools/jest/setup/enzyme.js b/x-pack/dev-tools/jest/setup/enzyme.js deleted file mode 100644 index 290e3d220aa4b..0000000000000 --- a/x-pack/dev-tools/jest/setup/enzyme.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { configure } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -configure({ adapter: new Adapter() }); diff --git a/x-pack/dev-tools/jest/setup/polyfills.js b/x-pack/dev-tools/jest/setup/polyfills.js deleted file mode 100644 index a841a3bf9cad0..0000000000000 --- a/x-pack/dev-tools/jest/setup/polyfills.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -// bluebird < v3.3.5 does not work with MutationObserver polyfill -// when MutationObserver exists, bluebird avoids using node's builtin async schedulers -// x-pack has a different version of bluebird so it needs its own polyfills.js to ensure -// the scheduler is set on the right bluebird instance -const bluebird = require('bluebird'); -bluebird.Promise.setScheduler(function (fn) { - global.setImmediate.call(global, fn); -}); - -const MutationObserver = require('mutation-observer'); -Object.defineProperty(window, 'MutationObserver', { value: MutationObserver }); - -require('whatwg-fetch'); - -if (!global.URL.hasOwnProperty('createObjectURL')) { - Object.defineProperty(global.URL, 'createObjectURL', { value: () => '' }); -} - -// Will be replaced with a better solution in EUI -// https://github.com/elastic/eui/issues/3713 -global._isJest = true; diff --git a/x-pack/dev-tools/jest/setup/setup_test.js b/x-pack/dev-tools/jest/setup/setup_test.js deleted file mode 100644 index 0f044717ac789..0000000000000 --- a/x-pack/dev-tools/jest/setup/setup_test.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -/* - Global import, so we don't need to remember to import the lib in each file - https://www.npmjs.com/package/jest-styled-components#global-installation -*/ - -import 'jest-styled-components'; -import '@testing-library/jest-dom'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/auto_follow_pattern_list.test.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/auto_follow_pattern_list.test.js index 60b5b393c5b07..808417c5fa38c 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/auto_follow_pattern_list.test.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/auto_follow_pattern_list.test.js @@ -6,7 +6,7 @@ import { getAutoFollowPatternMock } from './fixtures/auto_follow_pattern'; import './mocks'; -import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers'; +import { setupEnvironment, pageHelpers, nextTick, delay, getRandomString } from './helpers'; const { setup } = pageHelpers.autoFollowPatternList; @@ -146,7 +146,7 @@ describe('', () => { afterEach(async () => { // The updates are not all synchronouse // We need to wait for all the updates to ran before unmounting our component - await nextTick(100); + await delay(100); }); test('should not display the empty prompt', () => { diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts index e6444c37e8590..a1d99c9d81fe7 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/auto_follow_pattern.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString } from '../../../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; import { AutoFollowPattern } from '../../../../common/types'; export const getAutoFollowPatternMock = ({ diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts index ce40a0e46b0a0..244b460a364bc 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/fixtures/follower_index.ts @@ -5,7 +5,7 @@ */ import Chance from 'chance'; -import { getRandomString } from '../../../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; import { FollowerIndex } from '../../../../common/types'; const chance = new Chance(); diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_index_add.test.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_index_add.test.js index f5305f43e7f8c..36927ef2d16be 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_index_add.test.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_index_add.test.js @@ -6,7 +6,7 @@ import { indexPatterns } from '../../../../../../src/plugins/data/public'; import './mocks'; -import { setupEnvironment, pageHelpers, nextTick } from './helpers'; +import { setupEnvironment, pageHelpers, nextTick, delay } from './helpers'; import { RemoteClustersFormField } from '../../app/components'; const { setup } = pageHelpers.followerIndexAdd; @@ -169,7 +169,7 @@ describe('Create Follower index', () => { const totalRequests = server.requests.length; form.setInputValue('followerIndexInput', 'index-name'); - await nextTick(550); // we need to wait as there is a debounce of 500ms on the http validation + await delay(550); // we need to wait as there is a debounce of 500ms on the http validation expect(server.requests.length).toBe(totalRequests + 1); expect(server.requests[server.requests.length - 1].url).toBe( @@ -182,7 +182,7 @@ describe('Create Follower index', () => { httpRequestsMockHelpers.setGetClusterIndicesResponse([{ name: indexName }]); form.setInputValue('followerIndexInput', indexName); - await nextTick(550); + await delay(550); component.update(); expect(form.getErrorsMessages()).toContain('An index with the same name already exists.'); diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js index 91227299e92f9..3219cabe335e0 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/follower_indices_list.test.js @@ -10,11 +10,11 @@ Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import * as stubWebWorker from '../../../../../test_utils/stub_web_worker'; // eslint-disable-line no-unused-vars +import { stubWebWorker } from '@kbn/test/jest'; // eslint-disable-line no-unused-vars import { getFollowerIndexMock } from './fixtures/follower_index'; import './mocks'; -import { setupEnvironment, pageHelpers, nextTick, getRandomString } from './helpers'; +import { setupEnvironment, pageHelpers, nextTick, delay, getRandomString } from './helpers'; const { setup } = pageHelpers.followerIndexList; @@ -147,7 +147,7 @@ describe('', () => { afterEach(async () => { // The updates are not all synchronouse // We need to wait for all the updates to ran before unmounting our component - await nextTick(100); + await delay(100); }); test('should not display the empty prompt', () => { diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js index a4edee7268a23..8bbc6dac022cb 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_add.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { AutoFollowPatternAdd } from '../../../app/sections/auto_follow_pattern_add'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js index ea372d534d817..e316c9ab404df 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_edit.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { AutoFollowPatternEdit } from '../../../app/sections/auto_follow_pattern_edit'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js index 550e178a1c733..9a64ea708a8b6 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/auto_follow_pattern_list.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, findTestSubject } from '../../../../../../test_utils'; +import { registerTestBed, findTestSubject } from '@kbn/test/jest'; import { AutoFollowPatternList } from '../../../app/sections/home/auto_follow_pattern_list'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js index 31f3844f57fb5..c2b61436ca31d 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_add.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { FollowerIndexAdd } from '../../../app/sections/follower_index_add'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js index 8fc2811e58cdb..f269c453165e4 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_edit.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { FollowerIndexEdit } from '../../../app/sections/follower_index_edit'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js index 65be10b9d272e..31afebcc59055 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/follower_index_list.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, findTestSubject } from '../../../../../../test_utils'; +import { registerTestBed, findTestSubject } from '@kbn/test/jest'; import { FollowerIndicesList } from '../../../app/sections/home/follower_indices_list'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js index e51c444a6b370..2a1628f1418b8 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/home.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { CrossClusterReplicationHome } from '../../../app/sections/home/home'; import { ccrStore } from '../../../app/store'; import { routing } from '../../../app/services/routing'; diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js index fdcc3ccb08876..05c38956fff56 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/helpers/index.js @@ -12,7 +12,7 @@ import { setup as followerIndexAddSetup } from './follower_index_add.helpers'; import { setup as followerIndexEditSetup } from './follower_index_edit.helpers'; import { setup as homeSetup } from './home.helpers'; -export { nextTick, getRandomString, findTestSubject } from '../../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject, delay } from '@kbn/test/jest'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/global_search/public/services/utils.test.ts b/x-pack/plugins/global_search/public/services/utils.test.ts index f69fb1d2fd825..d3cff49db1ec0 100644 --- a/x-pack/plugins/global_search/public/services/utils.test.ts +++ b/x-pack/plugins/global_search/public/services/utils.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { StubBrowserStorage } from '../../../../../src/test_utils/public/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { getDefaultPreference } from './utils'; describe('getDefaultPreference', () => { diff --git a/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx b/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx index b669499c63f05..a3e2d66eabe5b 100644 --- a/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx +++ b/x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx @@ -9,7 +9,7 @@ import { waitFor, act } from '@testing-library/react'; import { ReactWrapper } from 'enzyme'; import { of, BehaviorSubject } from 'rxjs'; import { filter, map } from 'rxjs/operators'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { applicationServiceMock } from '../../../../../src/core/public/mocks'; import { GlobalSearchBatchedResults, GlobalSearchResult } from '../../../global_search/public'; import { globalSearchPluginMock } from '../../../global_search/public/mocks'; diff --git a/x-pack/plugins/graph/public/components/search_bar.test.tsx b/x-pack/plugins/graph/public/components/search_bar.test.tsx index 1b783df1b7d02..f26666025d35d 100644 --- a/x-pack/plugins/graph/public/components/search_bar.test.tsx +++ b/x-pack/plugins/graph/public/components/search_bar.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SearchBar, OuterSearchBarProps } from './search_bar'; import React, { ReactElement } from 'react'; import { CoreStart } from 'src/core/public'; diff --git a/x-pack/plugins/graph/public/components/settings/settings.test.tsx b/x-pack/plugins/graph/public/components/settings/settings.test.tsx index 7d13249288d53..135b9744765c6 100644 --- a/x-pack/plugins/graph/public/components/settings/settings.test.tsx +++ b/x-pack/plugins/graph/public/components/settings/settings.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiTab, EuiListGroupItem, EuiButton, EuiAccordion, EuiFieldText } from '@elastic/eui'; import * as Rx from 'rxjs'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { Settings, AngularProps } from './settings'; import { act } from '@testing-library/react'; import { ReactWrapper } from 'enzyme'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx index de7242a6c5ddf..1530d5c2cc4c8 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { App } from '../../../public/application/app'; import { TestSubjects } from '../helpers'; import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx index 646978dd68153..f9f2233ff02ee 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { EditPolicy } from '../../../public/application/sections/edit_policy'; import { DataTierAllocationType } from '../../../public/application/sections/edit_policy/types'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx index 43910583ceec9..3e1577d8033ba 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import moment from 'moment-timezone'; import { findTestSubject } from '@elastic/eui/lib/test'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SinonFakeServer } from 'sinon'; import { ReactWrapper } from 'enzyme'; import axios from 'axios'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/policy_table.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/components/policy_table.test.tsx index 0d66d9a8cdf9f..4b4096e8716b8 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/components/policy_table.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/policy_table.test.tsx @@ -6,7 +6,7 @@ import moment from 'moment-timezone'; import React, { ReactElement } from 'react'; import { ReactWrapper } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { findTestSubject, takeMountedSnapshot } from '@elastic/eui/lib/test'; import { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx index ca3121bf6b7a6..27900add85e0b 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment-timezone'; import axios from 'axios'; import axiosXhrAdapter from 'axios/lib/adapters/xhr'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/public/mocks'; import { Index } from '../common/types'; import { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts index f581083e28cc6..d2d7eb0165d30 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts @@ -6,7 +6,7 @@ import './mocks'; -export { nextTick, getRandomString, findTestSubject, TestBed } from '../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; export { setupEnvironment, WithAppDependencies, services } from './setup_environment'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts index 6bf6c11a37bb4..f52ba7adb87d9 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/data_streams_tab.helpers.ts @@ -8,12 +8,7 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; import { EuiDescriptionListDescription } from '@elastic/eui'; -import { - registerTestBed, - TestBed, - TestBedConfig, - findTestSubject, -} from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; import { DataStream } from '../../../common'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts index 27920ad8cdbdb..21c29baefce7c 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts index a7ac2ebf9bb02..48551321fde8a 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/home.test.ts @@ -15,7 +15,7 @@ import { HomeTestBed, setup } from './home.helpers'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { stubWebWorker } from '../../../../../test_utils/stub_web_worker'; +import { stubWebWorker } from '@kbn/test/jest'; stubWebWorker(); describe('', () => { diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts index fe938bb087d2e..583f8f723f0a7 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts @@ -6,12 +6,7 @@ import { act } from 'react-dom/test-utils'; -import { - registerTestBed, - TestBed, - TestBedConfig, - findTestSubject, -} from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; import { TemplateList } from '../../../public/application/sections/home/template_list'; import { TemplateDeserialized } from '../../../common'; import { WithAppDependencies, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts index c7af3a8f45105..f20d0487e1378 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.helpers.ts @@ -7,12 +7,7 @@ import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { - registerTestBed, - TestBed, - TestBedConfig, - findTestSubject, -} from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; import { IndexManagementHome } from '../../../public/application/sections/home'; import { indexManagementStore } from '../../../public/application/store'; import { WithAppDependencies, services, TestSubjects } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts index adc47515acaee..db4624d4389ff 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/home/indices_tab.test.ts @@ -17,7 +17,7 @@ import { createDataStreamPayload } from './data_streams_tab.helpers'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import { stubWebWorker } from '../../../../../test_utils/stub_web_worker'; +import { stubWebWorker } from '@kbn/test/jest'; import { createMemoryHistory } from 'history'; stubWebWorker(); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts index 62adb8c433366..4cc40c71e4efd 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_clone.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { TemplateClone } from '../../../public/application/sections/template_clone'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts index 9ad8d61e637e5..330723d87a3de 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { TemplateCreate } from '../../../public/application/sections/template_create'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts index c3a139f89cb5f..21ecf18aa0d38 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_edit.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { TemplateEdit } from '../../../public/application/sections/template_edit'; import { WithAppDependencies } from '../helpers'; diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts index 025410129a002..e02b312d38607 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed, SetupFunc, UnwrapPromise } from '../../../../../test_utils'; +import { TestBed, SetupFunc, UnwrapPromise } from '@kbn/test/jest'; import { TemplateDeserialized } from '../../../common'; interface MappingField { diff --git a/x-pack/plugins/index_management/__jest__/components/index_table.test.js b/x-pack/plugins/index_management/__jest__/components/index_table.test.js index 49902d8b09675..67623b18930c8 100644 --- a/x-pack/plugins/index_management/__jest__/components/index_table.test.js +++ b/x-pack/plugins/index_management/__jest__/components/index_table.test.js @@ -15,7 +15,7 @@ import { MemoryRouter } from 'react-router-dom'; Could not load worker ReferenceError: Worker is not defined at createWorker (//node_modules/brace/index.js:17992:5) */ -import * as stubWebWorker from '../../../../test_utils/stub_web_worker'; // eslint-disable-line no-unused-vars +import { mountWithIntl, stubWebWorker } from '@kbn/test/jest'; // eslint-disable-line no-unused-vars import { AppWithoutRouter } from '../../public/application/app'; import { AppContextProvider } from '../../public/application/app_context'; @@ -29,7 +29,6 @@ import { setUiMetricService } from '../../public/application/services/api'; import { indexManagementStore } from '../../public/application/store'; import { setExtensionsService } from '../../public/application/store/selectors'; import { BASE_PATH, API_BASE_PATH } from '../../common/constants'; -import { mountWithIntl } from '../../../../test_utils/enzyme_helpers'; import { ExtensionsService } from '../../public/services'; import sinon from 'sinon'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts index e6ced2fcc309a..fcfb97d72e383 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_create.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateCreate } from '../../../component_template_wizard'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts index fe81e8dcfe123..b8ce9dfa2d04a 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_details.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed } from '../../../../../../../../../test_utils'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateDetailsFlyoutContent } from '../../../component_template_details'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts index 3c0cbb19577a9..f7575c6fc987f 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_edit.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; import { ComponentTemplateEdit } from '../../../component_template_wizard'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts index 870b8b7ec5509..d8b3413eebf7e 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_form.helpers.ts @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '../../../../../../../../../test_utils'; +import { TestBed } from '@kbn/test/jest'; interface MappingField { name: string; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts index cdcb1abf8ed5d..bd760fb79e696 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/component_template_list.helpers.ts @@ -6,14 +6,8 @@ import { act } from 'react-dom/test-utils'; +import { registerTestBed, TestBed, TestBedConfig, findTestSubject, nextTick } from '@kbn/test/jest'; import { BASE_PATH } from '../../../../../../../common'; -import { - registerTestBed, - TestBed, - TestBedConfig, - findTestSubject, - nextTick, -} from '../../../../../../../../../test_utils'; import { WithAppDependencies } from './setup_environment'; import { ComponentTemplateList } from '../../../component_template_list/component_template_list'; diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts index 4b92235993e26..4e03adcbcbb44 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/public/application/components/component_templates/__jest__/client_integration/helpers/index.ts @@ -7,7 +7,7 @@ import { setup as componentTemplatesListSetup } from './component_template_list.helpers'; import { setup as componentTemplateDetailsSetup } from './component_template_details.helpers'; -export { nextTick, getRandomString, findTestSubject } from '../../../../../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { setupEnvironment, appDependencies } from './setup_environment'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts index afdc039ae77d2..f47ab3884d083 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts @@ -10,12 +10,7 @@ import { getMappingsEditorDataFactory, } from './mappings_editor.helpers'; -export { - nextTick, - getRandomString, - findTestSubject, - TestBed, -} from '../../../../../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; export const componentHelpers = { mappingsEditor: { setup: mappingsEditorSetup, getMappingsEditorDataFactory }, diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx index a625cc8c0ab4b..9302e080028cc 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; import { GlobalFlyout } from '../../../../../../../../../../src/plugins/es_ui_shared/public'; -import { registerTestBed, TestBed } from '../../../../../../../../../test_utils'; import { getChildFieldsName } from '../../../lib'; import { MappingsEditor } from '../../../mappings_editor'; import { MappingsEditorProvider } from '../../../mappings_editor_context'; diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx index 88a7e9252d6dd..2918bac9aa683 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx @@ -32,7 +32,7 @@ jest.mock('lodash', () => { }; }); -import { registerTestBed, TestBed } from '../../../../../../../../test_utils'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; import { LoadMappingsProvider } from './load_mappings_provider'; const ComponentToTest = ({ onJson }: { onJson: () => void }) => ( diff --git a/x-pack/plugins/index_management/test/fixtures/template.ts b/x-pack/plugins/index_management/test/fixtures/template.ts index ac6e8b7879a26..016100faea601 100644 --- a/x-pack/plugins/index_management/test/fixtures/template.ts +++ b/x-pack/plugins/index_management/test/fixtures/template.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString, getRandomNumber } from '../../../../test_utils'; +import { getRandomString, getRandomNumber } from '@kbn/test/jest'; import { TemplateDeserialized, TemplateType, TemplateListItem } from '../../common'; const objHasProperties = (obj?: Record): boolean => { diff --git a/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx b/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx index 54d3b783d22f6..6f830598ac46d 100644 --- a/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx +++ b/x-pack/plugins/infra/public/alerting/inventory/components/expression.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { actionTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/action_type_registry.mock'; import { alertTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/alert_type_registry.mock'; import { coreMock } from '../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx index b14c7877787ab..c83f9ff33bac5 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { actionTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/action_type_registry.mock'; import { alertTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/alert_type_registry.mock'; import { coreMock } from '../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx index 39a5a7feb2774..5f3f0ea7f3490 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_chart.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { actionTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/action_type_registry.mock'; import { alertTypeRegistryMock } from '../../../../../triggers_actions_ui/public/application/alert_type_registry.mock'; import { coreMock } from '../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx index d5be8a2ec2675..8fae6c6a51343 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { MetricExpression } from '../types'; import React from 'react'; import { ExpressionRow } from './expression_row'; diff --git a/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx index 5954cb834a11d..d3f46bed07cc0 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountHook } from 'test_utils/enzyme_helpers'; +import { mountHook } from '@kbn/test/jest'; import { useLogViewConfiguration } from './log_view_configuration'; diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx index d2076ad6df502..62688a19ad835 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/hooks/metrics_time.test.tsx @@ -7,7 +7,7 @@ import { createMemoryHistory } from 'history'; import React from 'react'; import { Router } from 'react-router-dom'; -import { mountHook } from 'test_utils/enzyme_helpers'; +import { mountHook } from '@kbn/test/jest'; import { ScopedHistory } from '../../../../../../../../src/core/public'; import { useMetricsTime } from './use_metrics_time'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts index 6216119c5d1d1..a86a18cca0717 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/index.ts @@ -9,7 +9,7 @@ import { setup as pipelinesCreateSetup } from './pipelines_create.helpers'; import { setup as pipelinesCloneSetup } from './pipelines_clone.helpers'; import { setup as pipelinesEditSetup } from './pipelines_edit.helpers'; -export { nextTick, getRandomString, findTestSubject } from '../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts index dd354b4927836..fd92c25d250cf 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipeline_form.helpers.ts @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { TestBed } from '../../../../../test_utils'; +import { TestBed } from '@kbn/test/jest'; export const getFormActions = (testBed: TestBed) => { const { find, form, component } = testBed; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts index 2559b93bd606d..a200509f98e04 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig, TestBed } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesClone } from '../../../public/application/sections/pipelines_clone'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts index 22f68f12804d6..0cbcca8b49dc8 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig, TestBed } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesCreate } from '../../../public/application/sections/pipelines_create'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts index 5e0739f78eecd..498a1b3ad3688 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig, TestBed } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig, TestBed } from '@kbn/test/jest'; import { PipelinesEdit } from '../../../public/application/sections/pipelines_edit'; import { getFormActions, PipelineFormTestSubjects } from './pipeline_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts index 6c446e8254f6b..76cd525bc9c45 100644 --- a/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts +++ b/x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_list.helpers.ts @@ -6,12 +6,7 @@ import { act } from 'react-dom/test-utils'; -import { - registerTestBed, - TestBed, - TestBedConfig, - findTestSubject, -} from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig, findTestSubject } from '@kbn/test/jest'; import { PipelinesList } from '../../../public/application/sections/pipelines_list'; import { WithAppDependencies } from './setup_environment'; import { getListPath, ROUTES } from '../../../public/application/services/navigation'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.helpers.tsx index 135a5854f36cd..36c7e9b752e08 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/pipeline_processors_editor.helpers.tsx @@ -6,7 +6,7 @@ import { act } from 'react-dom/test-utils'; import React from 'react'; -import { registerTestBed, TestBed } from '../../../../../../../test_utils'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; import { Props } from '../'; import { ProcessorsEditorWithDeps } from './processors_editor'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/test_pipeline.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/test_pipeline.helpers.tsx index 570d9878f7634..7294446d82b41 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/test_pipeline.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/__jest__/test_pipeline.helpers.tsx @@ -11,8 +11,8 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr'; /* eslint-disable @kbn/eslint/no-restricted-paths */ import { usageCollectionPluginMock } from 'src/plugins/usage_collection/public/mocks'; -import { registerTestBed, TestBed } from '../../../../../../../test_utils'; -import { stubWebWorker } from '../../../../../../../test_utils/stub_web_worker'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; +import { stubWebWorker } from '@kbn/test/jest'; import { uiMetricService, apiService } from '../../../services'; import { Props } from '../'; import { initHttpRequests } from './http_requests.helpers'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/load_from_json/modal_provider.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/load_from_json/modal_provider.test.tsx index 2f4cdce1edd0b..67350314e260a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/load_from_json/modal_provider.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/load_from_json/modal_provider.test.tsx @@ -32,7 +32,7 @@ jest.mock('lodash', () => { }; }); -import { registerTestBed, TestBed } from '../../../../../../../../test_utils/testbed'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; const setup = ({ onDone }: { onDone: OnDoneLoadJsonHandler }) => { return registerTestBed( diff --git a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx b/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx index c95f6085b4791..ea6b99a3fc767 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { datatable, DatatableComponent } from './expression'; import { LensMultiTable } from '../types'; import { DatatableProps } from './expression'; diff --git a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx b/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx index 929dd8e434afe..fab2483de4fd6 100644 --- a/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx +++ b/x-pack/plugins/lens/public/debounced_component/debounced_component.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { debouncedComponent } from './debounced_component'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index c0cd211a49dd9..f440042801ca6 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -14,7 +14,7 @@ import { } from '../../mocks'; import { ChildDragDropProvider, DroppableEvent } from '../../../drag_drop'; import { EuiFormRow } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { Visualization } from '../../../types'; import { LayerPanel } from './layer_panel'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx index b3ea14efbae80..53d94f24d616c 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx @@ -7,7 +7,7 @@ import React, { ReactElement } from 'react'; import { ReactWrapper } from 'enzyme'; import { EuiPanel, EuiToolTip } from '@elastic/eui'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { EditorFrame } from './editor_frame'; import { DatasourcePublicAPI, DatasourceSuggestion, Visualization } from '../../types'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.test.tsx index 8694cebc70391..382178a14793b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { Visualization } from '../../types'; import { createMockVisualization, diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.test.tsx index 5109d8808a233..0bbb42012b68b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.test.tsx @@ -12,7 +12,7 @@ import { createMockDatasource, } from '../../mocks'; import { EuiKeyPadMenuItem } from '@elastic/eui'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { Visualization, FramePublicAPI, DatasourcePublicAPI } from '../../../types'; import { Action } from '../state_management'; import { ChartSwitch } from './chart_switch'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx index 231c38ea54048..33deb0356660c 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx @@ -23,7 +23,7 @@ jest.mock('../../../debounced_component', () => { }); import { WorkspacePanel, WorkspacePanelProps } from './workspace_panel'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { DragDrop, ChildDragDropProvider } from '../../../drag_drop'; import { Ast } from '@kbn/interpreter/common'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx index 6cca42dc1cb93..db0be190c45c8 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { Visualization } from '../../../types'; import { createMockVisualization, createMockFramePublicAPI, FrameMock } from '../../mocks'; -import { mountWithIntl as mount } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { WorkspacePanelWrapper, WorkspacePanelWrapperProps } from './workspace_panel_wrapper'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx index d2ec1c81bbeec..ac82caf9d5227 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx @@ -13,7 +13,7 @@ import { NoFieldsCallout } from './no_fields_callout'; import { act } from 'react-dom/test-utils'; import { coreMock } from 'src/core/public/mocks'; import { IndexPatternPrivateState } from './types'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { ChangeIndexPattern } from './change_indexpattern'; import { EuiProgress, EuiLoadingSpinner } from '@elastic/eui'; import { documentField } from './document_field'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index e9eb3fa4542fe..b2edc61a56736 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -13,7 +13,7 @@ import { IndexPatternDimensionEditorComponent, IndexPatternDimensionEditorProps, } from './dimension_panel'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; import { IUiSettingsClient, SavedObjectsClientContract, HttpSetup, CoreSetup } from 'kibana/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { IndexPatternPrivateState } from '../types'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx index 781222888b6dc..2f3549911dfe7 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx @@ -10,7 +10,7 @@ import { act } from 'react-dom/test-utils'; import { EuiLoadingSpinner, EuiPopover } from '@elastic/eui'; import { InnerFieldItem, FieldItemProps } from './field_item'; import { coreMock } from 'src/core/public/mocks'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; import { IndexPattern } from './types'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx index 7d1c80e5a7f6a..d85d08e4ae000 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/fields_accordion.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiLoadingSpinner, EuiNotificationBadge } from '@elastic/eui'; import { coreMock } from 'src/core/public/mocks'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; import { IndexPattern } from './types'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx index b7df3cc5c3687..2c6a1c67d2948 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/layerpanel.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { IndexPatternPrivateState } from './types'; import { IndexPatternLayerPanelProps, LayerPanel } from './layerpanel'; -import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl as shallow } from '@kbn/test/jest'; import { ShallowWrapper } from 'enzyme'; import { EuiSelectable } from '@elastic/eui'; import { ChangeIndexPattern } from './change_indexpattern'; diff --git a/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx b/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx index 1e0e6b33b6cd4..f5ae125945c45 100644 --- a/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/legend_settings_popover.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { Position } from '@elastic/charts'; -import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl as shallow } from '@kbn/test/jest'; import { LegendSettingsPopover, LegendSettingsPopoverProps } from './legend_settings_popover'; describe('Legend Settings', () => { diff --git a/x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.test.tsx b/x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.test.tsx index 9e71323377c1a..0ba7a56f50695 100644 --- a/x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl as shallow } from '@kbn/test/jest'; import { AxisSettingsPopover, AxisSettingsPopoverProps } from './axis_settings_popover'; import { ToolbarPopover } from '../shared_components'; diff --git a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx index a5d292fdf265a..1bcae4d09e7e7 100644 --- a/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/expression.test.tsx @@ -34,7 +34,7 @@ import { gridlinesConfig, } from './types'; import { createMockExecutionContext } from '../../../../../src/plugins/expressions/common/mocks'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; import { EmptyPlaceholder } from '../shared_components/empty_placeholder'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx index 721bff8684a19..99fbfa058a2de 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_config_panel.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl as mount, shallowWithIntl as shallow } from 'test_utils/enzyme_helpers'; +import { mountWithIntl as mount, shallowWithIntl as shallow } from '@kbn/test/jest'; import { EuiButtonGroupProps, EuiSuperSelect, EuiButtonGroup } from '@elastic/eui'; import { LayerContextMenu, XyToolbar, DimensionEditor } from './xy_config_panel'; import { ToolbarPopover } from '../shared_components'; diff --git a/x-pack/plugins/license_management/__jest__/upload_license.test.tsx b/x-pack/plugins/license_management/__jest__/upload_license.test.tsx index 947907c7dcc9c..4dd32c1a6025c 100644 --- a/x-pack/plugins/license_management/__jest__/upload_license.test.tsx +++ b/x-pack/plugins/license_management/__jest__/upload_license.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { Provider } from 'react-redux'; import { LocationDescriptorObject } from 'history'; import { httpServiceMock, scopedHistoryMock } from '../../../../src/core/public/mocks'; -import { mountWithIntl } from '../../../test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; // @ts-ignore import { uploadLicense } from '../public/application/store/actions/upload_license'; diff --git a/x-pack/plugins/license_management/__jest__/util/util.js b/x-pack/plugins/license_management/__jest__/util/util.js index c13dcdb7fdbfa..38ef3ed01c012 100644 --- a/x-pack/plugins/license_management/__jest__/util/util.js +++ b/x-pack/plugins/license_management/__jest__/util/util.js @@ -8,7 +8,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { mountWithIntl } from '../../../../test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { httpServiceMock, scopedHistoryMock } from '../../../../../src/core/public/mocks'; import { licenseManagementStore } from '../../public/application/store/store'; import { AppContextProvider } from '../../public/application/app_context'; diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js index bb5961ce36120..be5f6b984fea5 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_editor/pipeline_editor.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import 'brace'; import { PipelineEditor } from './pipeline_editor'; diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js index 6da29411a025d..d611fd4836024 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/add_role_alert.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AddRoleAlert } from './add_role_alert'; describe('AddRoleAlert component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js index b717cf5340942..c43a0839f4c11 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/alert_call_out.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AlertCallOut } from './alert_call_out'; describe('AlertCallOut component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js index bbf91f2c0b957..60d05e2359836 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/confirm_delete_modal.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { ConfirmDeleteModal } from './confirm_delete_modal'; describe('ConfirmDeleteModal component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js index da70815bc1313..e27864ad5ffc0 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/enable_monitoring_alert.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { EnableMonitoringAlert } from './enable_monitoring_alert'; describe('EnableMonitoringAlert component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js index 019cd29f7a017..cd7a218f54385 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipeline_list.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { PipelineList } from './pipeline_list'; describe('PipelineList component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js index 6c2f0d02801c4..2a187d95ec9a7 100644 --- a/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js +++ b/x-pack/plugins/logstash/public/application/components/pipeline_list/pipelines_table.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { PipelinesTable } from './pipelines_table'; describe('PipelinesTable component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js index d9d6c544141d3..fe93ddb22077c 100644 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js +++ b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { UpgradeFailure } from './upgrade_failure'; describe('UpgradeFailure component', () => { diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js index 6ff28a1d36a6e..603ab0ff543b8 100644 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js +++ b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { UpgradeFailureActions } from './upgrade_failure_actions'; describe('UpgradeFailureActions component', () => { diff --git a/x-pack/plugins/maps/public/connected_components/layer_panel/view.test.js b/x-pack/plugins/maps/public/connected_components/layer_panel/view.test.js index 1a0eda102986f..cdc24ed728abb 100644 --- a/x-pack/plugins/maps/public/connected_components/layer_panel/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/layer_panel/view.test.js @@ -52,7 +52,7 @@ jest.mock('../../kibana_services', () => { }); import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { LayerPanel } from './view'; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/attribution_control/view.test.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/attribution_control/view.test.js index 2e85e8ab792d3..96cc6cf812020 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/attribution_control/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/attribution_control/view.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AttributionControl } from './view'; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js index 877e8658ab03e..e25e5bb36be1a 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; jest.mock('../../../../../kibana_services', () => { return { diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx index e7330ca1dbe5d..9d885742f2008 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx @@ -8,7 +8,7 @@ import mockAnnotations from '../annotations_table/__mocks__/mock_annotations.jso import moment from 'moment-timezone'; import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AnnotationDescriptionList } from './index'; diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx b/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx index d71a23f478282..a4d2cd6b091a8 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx +++ b/x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx @@ -9,7 +9,7 @@ import useObservable from 'react-use/lib/useObservable'; import mockAnnotations from '../annotations_table/__mocks__/mock_annotations.json'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { Annotation } from '../../../../../common/types/annotations'; import { annotation$ } from '../../../services/annotations_service'; diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js index b19328f89fbe4..339695eff8ad0 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js +++ b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js @@ -7,7 +7,7 @@ import jobConfig from '../../../../../common/types/__mocks__/job_config_farequote'; import mockAnnotations from './__mocks__/mock_annotations.json'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { AnnotationsTable } from './annotations_table'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js index 78c036eac1903..219ca77804113 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { AnomalyDetails } from './anomaly_details'; const props = { diff --git a/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.js b/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.js index 674cdb8b869b0..59f1e1acf9326 100644 --- a/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.js +++ b/x-pack/plugins/ml/public/application/components/entity_cell/entity_cell.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { EntityCell } from './entity_cell'; const defaultProps = { diff --git a/x-pack/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js b/x-pack/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js index 329863fdc9986..b467b6bfa3654 100644 --- a/x-pack/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js +++ b/x-pack/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { FieldTitleBar } from './field_title_bar'; diff --git a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx index bed8deff1ff83..c3a936027d9cc 100644 --- a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx +++ b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FullTimeRangeSelector } from './index'; import { Query } from 'src/plugins/data/public'; import { IndexPattern } from '../../../../../../../src/plugins/data/public'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js index 692817be1fa89..c02a212d64034 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/actions_section.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ActionsSection } from './actions_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js index d873734adce7d..3f2994f690e79 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DetectorDescriptionList } from './detector_description_list'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js index 79ed620d151f2..3417bd263b4d9 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/condition_expression.test.js @@ -7,7 +7,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ConditionExpression } from './condition_expression'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js index 5fdfff79e694f..c330e3827465d 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/conditions_section.test.js @@ -7,7 +7,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ConditionsSection } from './conditions_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js index 79080ef0f9bb6..b5c4abc5efd7c 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js @@ -55,7 +55,7 @@ jest.mock('../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { RuleEditorFlyout } from './rule_editor_flyout'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js index d671492d566ad..db59020630043 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/scope_expression.test.js @@ -7,7 +7,7 @@ // Mock the mlJobService that is imported for saving rules. jest.mock('../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ScopeExpression } from './scope_expression'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js index 839dcee870983..7aeb9366eacf6 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/scope_section.test.js @@ -15,7 +15,7 @@ jest.mock('../../capabilities/check_capabilities', () => ({ checkPermission: (privilege) => mockCheckPermission(privilege), })); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ScopeSection } from './scope_section'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js index 717ebd71d9c62..63e38f947742a 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { AddToFilterListLink } from './add_to_filter_list_link'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js index 4774539a1881c..91aaee09bc7ae 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DeleteRuleModal } from './delete_rule_modal'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js index 5d8916cf22a12..3a2e75d13a5db 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js @@ -6,7 +6,7 @@ jest.mock('../../../services/job_service.js', () => 'mlJobService'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EditConditionLink } from './edit_condition_link'; diff --git a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js index 1fbf44d55c025..aaa74454085d2 100644 --- a/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js +++ b/x-pack/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js @@ -28,7 +28,7 @@ jest.mock('../../../services/ml_api_service', () => ({ }, })); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { RuleActionPanel } from './rule_action_panel'; diff --git a/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js b/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js index 280dbd76d5487..f2f785d91dcac 100644 --- a/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js +++ b/x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ValidateJob } from './validate_job_view'; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx index f833cf4708cec..96d6c5ff4837d 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountHook } from 'test_utils/enzyme_helpers'; +import { mountHook } from '@kbn/test/jest'; import { MlContext } from '../../../../../contexts/ml'; import { kibanaContextValueMock } from '../../../../../contexts/ml/__mocks__/kibana_context_value'; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js index 1a2bc20a5192a..05ebf601b5979 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { Overrides } from './overrides'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js index 53aca826f2dda..1b1098576fb21 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js @@ -24,7 +24,7 @@ jest.mock('../../services/field_format_service', () => ({ }, })); -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ExplorerChartDistribution } from './explorer_chart_distribution'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js index 632c5a1006df5..afc4162cdc0a6 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ExplorerChartInfoTooltip } from './explorer_chart_info_tooltip'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js index a1e9a9b4760dd..f9060a5f8a14e 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js @@ -24,7 +24,7 @@ jest.mock('../../services/field_format_service', () => ({ }, })); -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ExplorerChartSingleMetric } from './explorer_chart_single_metric'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js index 54a6cdfea7b4f..b72cfc5995ca5 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { CalendarForm } from './calendar_form'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js index 8336a2d286639..d0564fc5a5b2a 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EventsTable } from './events_table'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js index 2faac7d850fa9..725486888f84b 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ImportModal } from './import_modal'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js index c41ed3d17a56a..b10b9b84f39cd 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ImportedEvents } from './imported_events'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js index 068d443300088..c03a5d73125d3 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js @@ -57,7 +57,7 @@ jest.mock('../../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { NewCalendar } from './new_calendar'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js index f8b9c97db09e3..80d392f027813 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { NewEventModal } from './new_event_modal'; import moment from 'moment'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js index 619478db54441..ff294645deeb6 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ml } from '../../../services/ml_api_service'; import { CalendarsList } from './calendars_list'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js index 857d2e7e6659b..3b674f3a71959 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/header.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { CalendarsListHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js b/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js index f2c6a619adde5..6fcb25f28bed8 100644 --- a/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js +++ b/x-pack/plugins/ml/public/application/settings/calendars/list/table/table.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { CalendarsListTable } from './table'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js index 1641a1d4ba7bb..97ab683e29708 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { AddItemPopover } from './add_item_popover'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js index bb909ddc3aa78..4cc38c530ae39 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js @@ -13,7 +13,7 @@ jest.mock('../../../../capabilities/check_capabilities', () => ({ })); jest.mock('../../../../services/ml_api_service', () => 'ml'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DeleteFilterListModal } from './delete_filter_list_modal'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js index f97bfe6682f5e..a137b2367cda7 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EditDescriptionPopover } from './edit_description_popover'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js index 1223194030e64..148f435a9104f 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js @@ -42,7 +42,7 @@ jest.mock('../../../../../../../../src/plugins/kibana_react/public', () => ({ }, })); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EditFilterList } from './edit_filter_list'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js index b23b1eedf172a..ba10deedd02ac 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/header.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EditFilterListHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js index 143cfbf100421..d7c13392b32c9 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EditFilterListToolbar } from './toolbar'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js index 6ddea7a3281d3..1f290f807ab45 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { FilterLists } from './filter_lists'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js index a21b70f563680..908991606df4e 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/header.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { FilterListsHeader } from './header'; diff --git a/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js b/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js index 29b1185ddd4ab..e54dd3e88f19c 100644 --- a/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js +++ b/x-pack/plugins/ml/public/application/settings/filter_lists/list/table.test.js @@ -11,7 +11,7 @@ jest.mock('../../../capabilities/check_capabilities', () => ({ })); jest.mock('../../../services/ml_api_service', () => 'ml'); -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { FilterListsTable } from './table'; diff --git a/x-pack/plugins/ml/public/application/settings/settings.test.tsx b/x-pack/plugins/ml/public/application/settings/settings.test.tsx index a5e69f233e2df..1ef216560604b 100644 --- a/x-pack/plugins/ml/public/application/settings/settings.test.tsx +++ b/x-pack/plugins/ml/public/application/settings/settings.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { AnomalyDetectionSettingsContext } from './anomaly_detection_settings_context'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js index 2a0fcd57467bd..2140eea27d265 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js @@ -7,7 +7,7 @@ //import mockOverallSwimlaneData from './__mocks__/mock_overall_swimlane.json'; import moment from 'moment-timezone'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { TimeseriesChart } from './timeseries_chart'; diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/__tests__/helpers.test.js b/x-pack/plugins/monitoring/public/components/cluster/overview/__tests__/helpers.test.js index e09c42bc59429..a4d7e7527024d 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/__tests__/helpers.test.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/__tests__/helpers.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { BytesUsage, BytesPercentageUsage } from '../helpers'; describe('Bytes Usage', () => { diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/__tests__/cells.test.js b/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/__tests__/cells.test.js index f0b131b65433c..67773a6745f96 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/__tests__/cells.test.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/nodes/__tests__/cells.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { MetricCell } from '../cells'; describe('Node Listing Metric Cell', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/__tests__/checker_errors.test.js b/x-pack/plugins/monitoring/public/components/no_data/__tests__/checker_errors.test.js index 22700bf3fb5a8..b3dd093022a2b 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/__tests__/checker_errors.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/__tests__/checker_errors.test.js @@ -6,7 +6,7 @@ import React from 'react'; import { boomify, forbidden } from '@hapi/boom'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { CheckerErrors } from '../checker_errors'; describe('CheckerErrors', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/__tests__/no_data.test.js b/x-pack/plugins/monitoring/public/components/no_data/__tests__/no_data.test.js index 5b54df3a82812..f692c7ee919dc 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/__tests__/no_data.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/__tests__/no_data.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { NoData } from '../'; const enabler = {}; diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/__tests__/collection_enabled.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/__tests__/collection_enabled.test.js index 13a49b1c7b200..6dd1ac185f901 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/__tests__/collection_enabled.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/__tests__/collection_enabled.test.js @@ -6,7 +6,7 @@ import React from 'react'; import sinon from 'sinon'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ExplainCollectionEnabled } from '../collection_enabled'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/collection_interval.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/collection_interval.test.js index 88185283b6faa..6e8dde4056e8d 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/collection_interval.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/collection_interval.test.js @@ -6,7 +6,7 @@ import React from 'react'; import sinon from 'sinon'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ExplainCollectionInterval } from '../collection_interval'; import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/exporters.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/exporters.test.js index 44b97bc807ce9..ea41cf1b81cd5 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/exporters.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/exporters/__tests__/exporters.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { ExplainExporters, ExplainExportersCloud } from '../exporters'; describe('ExplainExporters', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/__tests__/plugin_enabled.test.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/__tests__/plugin_enabled.test.js index 031c4baa0a424..2f101f44f014a 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/__tests__/plugin_enabled.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/plugin_enabled/__tests__/plugin_enabled.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { ExplainPluginEnabled } from '../plugin_enabled'; describe('ExplainPluginEnabled', () => { diff --git a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/reason_found.test.js b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/reason_found.test.js index a5f9691880b2c..f30799ebd4f73 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/reason_found.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/reason_found.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { ReasonFound } from '../'; const enabler = {}; diff --git a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/we_tried.test.js b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/we_tried.test.js index 95970453d4b7c..57cee4baeb8bf 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/we_tried.test.js +++ b/x-pack/plugins/monitoring/public/components/no_data/reasons/__tests__/we_tried.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { WeTried } from '../'; describe('WeTried', () => { diff --git a/x-pack/plugins/monitoring/public/components/page_loading/__tests__/page_loading.test.js b/x-pack/plugins/monitoring/public/components/page_loading/__tests__/page_loading.test.js index 41f3ef4be969e..bbe6afce193d5 100644 --- a/x-pack/plugins/monitoring/public/components/page_loading/__tests__/page_loading.test.js +++ b/x-pack/plugins/monitoring/public/components/page_loading/__tests__/page_loading.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { PageLoading } from '../'; describe('PageLoading', () => { diff --git a/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js b/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js index 5f4dced47ee6f..b3930e6e3e47b 100644 --- a/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js +++ b/x-pack/plugins/monitoring/public/components/summary_status/summary_status.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl } from '@kbn/test/jest'; import { SummaryStatus } from './summary_status'; jest.mock(`@elastic/eui/lib/components/form/form_row/make_id`, () => () => `generated-id`); diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.js b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.js index f420e83adc031..f01e01224f1f1 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.js +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/add/remote_clusters_add.helpers.js @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed } from '../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { RemoteClusterAdd } from '../../../public/application/sections/remote_cluster_add'; import { createRemoteClustersStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.js b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.js index 331ef24d1d8a1..fc6fa7edda927 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.js +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/edit/remote_clusters_edit.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { RemoteClusterEdit } from '../../../public/application/sections/remote_cluster_edit'; import { createRemoteClustersStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.js b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.js index 6ef0e10b6ae15..ddf7c1a61299f 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.js +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/index.js @@ -4,5 +4,5 @@ * you may not use this file except in compliance with the Elastic License. */ -export { nextTick, getRandomString, findTestSubject } from '../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js b/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js index 5f34728def3d3..83a0f634ab55a 100644 --- a/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js +++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/list/remote_clusters_list.helpers.js @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { registerTestBed, findTestSubject } from '../../../../../test_utils'; +import { registerTestBed, findTestSubject } from '@kbn/test/jest'; import { RemoteClusterList } from '../../../public/application/sections/remote_cluster_list'; import { createRemoteClustersStore } from '../../../public/application/store'; diff --git a/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js b/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js index 6a3bcba21d772..d063a53c3c374 100644 --- a/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js +++ b/x-pack/plugins/remote_clusters/fixtures/remote_cluster.js @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString } from '../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; import { SNIFF_MODE } from '../common/constants'; diff --git a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.test.js b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.test.js index a5c2b355863af..e02ee1f7e012b 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.test.js +++ b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, renderWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, renderWithIntl } from '@kbn/test/jest'; import { findTestSubject, takeMountedSnapshot } from '@elastic/eui/lib/test'; import { RemoteClusterForm } from './remote_cluster_form'; diff --git a/x-pack/plugins/reporting/public/components/buttons/report_info_button.test.tsx b/x-pack/plugins/reporting/public/components/buttons/report_info_button.test.tsx index 028a8e960040a..5de520d2a6386 100644 --- a/x-pack/plugins/reporting/public/components/buttons/report_info_button.test.tsx +++ b/x-pack/plugins/reporting/public/components/buttons/report_info_button.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ReportInfoButton } from './report_info_button'; jest.mock('../../lib/reporting_api_client'); diff --git a/x-pack/plugins/reporting/public/components/report_listing.test.tsx b/x-pack/plugins/reporting/public/components/report_listing.test.tsx index cacae943687e1..c8e192814f806 100644 --- a/x-pack/plugins/reporting/public/components/report_listing.test.tsx +++ b/x-pack/plugins/reporting/public/components/report_listing.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { Observable } from 'rxjs'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ILicense } from '../../../licensing/public'; import { ReportingAPIClient } from '../lib/reporting_api_client'; diff --git a/x-pack/plugins/rollup/fixtures/job.js b/x-pack/plugins/rollup/fixtures/job.js index edcc99f7cae1b..e9fdae66c003f 100644 --- a/x-pack/plugins/rollup/fixtures/job.js +++ b/x-pack/plugins/rollup/fixtures/job.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString } from '../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; const initialValues = { dateHistogramField: 'timestamp', diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js index 3ac2ee5f5aadb..12c00c0ad6b44 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/detail_panel/detail_panel.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { getJob } from '../../../../../fixtures'; import { rollupJobsStore } from '../../../store'; import { DetailPanel } from './detail_panel'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js index ea70bdb3fbc41..91cd9e573e744 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_list.test.js @@ -5,7 +5,7 @@ */ import React from 'react'; -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { rollupJobsStore } from '../../store'; import { JobList } from './job_list'; diff --git a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js index 462742bee978f..a7171a8b1960c 100644 --- a/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js +++ b/x-pack/plugins/rollup/public/crud_app/sections/job_list/job_table/job_table.test.js @@ -6,7 +6,7 @@ import { Pager } from '@elastic/eui'; -import { registerTestBed } from '../../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { getJobs, jobCount } from '../../../../../fixtures'; import { rollupJobsStore } from '../../../store'; import { JobTable } from './job_table'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js index 4a5b67e687d85..238e11b65b574 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/index.js @@ -8,7 +8,7 @@ import { setup as jobCreateSetup } from './job_create.helpers'; import { setup as jobListSetup } from './job_list.helpers'; import { setup as jobCloneSetup } from './job_clone.helpers'; -export { nextTick, getRandomString, findTestSubject } from '../../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject } from '@kbn/test/jest'; export { mockHttpRequest } from './setup_environment'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js index d0abb223a3cfc..5d850cb88bf51 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_clone.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { createRollupJobsStore } from '../../../crud_app/store'; import { JobCreate } from '../../../crud_app/sections'; import { JOB_TO_CLONE } from './constants'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js index b991fe4c45eae..3d26eea32012b 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_create.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { rollupJobsStore } from '../../../crud_app/store'; import { JobCreate } from '../../../crud_app/sections'; diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js index f05b7046de344..3d924ca1838f1 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/job_list.helpers.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { registerRouter } from '../../../crud_app/services'; import { createRollupJobsStore } from '../../../crud_app/store'; import { JobList } from '../../../crud_app/sections/job_list'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx index e945c6a28a46b..49bd4c746dd0f 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/empty_tree_placeholder/empty_tree_placeholder.test.tsx @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { EmptyTreePlaceHolder } from '.'; describe('EmptyTreePlaceholder', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx index f539baadd5052..1d273b4dc4289 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/highlight_details_flyout/highlight_details_flyout.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { HighlightDetailsFlyout, Props } from '.'; describe('Highlight Details Flyout', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts b/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts index 93465d112681f..26837631fbfa9 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/license_warning_notice/license_warning_notice.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { LicenseWarningNotice } from './license_warning_notice'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx index d540bfe0ed98b..1605f3c16e9b0 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_loading_placeholder/profile_loading_placeholder.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { ProfileLoadingPlaceholder } from '.'; describe('Profile Loading Placeholder', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx index e0d24c11ca5ed..89d0b885bb20f 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_query_editor/editor/editor.test.tsx @@ -6,7 +6,7 @@ import 'brace'; import 'brace/mode/json'; -import { registerTestBed } from '../../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { Editor, Props } from './editor'; describe('Editor Component', () => { diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx index 64f77e8b4e52c..a5787a6f3ba38 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/__jest__/profile_tree.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { searchResponse } from './fixtures/search_response'; import { ProfileTree, Props } from '../profile_tree'; diff --git a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts index 575dbd68f0c97..aff12f7bd18d4 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts +++ b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs/searchprofiler_tabs.test.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed } from '../../../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { SearchProfilerTabs, Props } from './searchprofiler_tabs'; diff --git a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx index b677f6a1fe8bb..19517b0b6f8f8 100644 --- a/x-pack/plugins/security/public/account_management/account_management_page.test.tsx +++ b/x-pack/plugins/security/public/account_management/account_management_page.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { AuthenticatedUser } from '../../common/model'; import { AccountManagementPage } from './account_management_page'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx index 478b1513697a0..dcd53ffed2fe6 100644 --- a/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/access_agreement/access_agreement_page.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import ReactMarkdown from 'react-markdown'; import { EuiLoadingContent } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { coreMock } from '../../../../../../src/core/public/mocks'; import { AccessAgreementPage } from './access_agreement_page'; diff --git a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx index 946c58a1c8e99..642b1e67abe52 100644 --- a/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/components/authentication_state_page/authentication_state_page.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AuthenticationStatePage } from './authentication_state_page'; import React from 'react'; diff --git a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx index b6dd06595ae7f..e6d170122751e 100644 --- a/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/components/login_form/login_form.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import ReactMarkdown from 'react-markdown'; import { act } from '@testing-library/react'; import { EuiButton, EuiCallOut, EuiIcon } from '@elastic/eui'; -import { mountWithIntl, nextTick, shallowWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { LoginForm, PageMode } from './login_form'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx index 5370c981f2b65..467b2a7ff9906 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { act } from '@testing-library/react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { LoginState } from '../../../common/login_state'; import { LoginPage } from './login_page'; import { coreMock } from '../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx index 1fc8824eeff3a..4170ec1178c8d 100644 --- a/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/overwritten_session/overwritten_session_page.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiButton } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { OverwrittenSessionPage } from './overwritten_session_page'; import { coreMock } from '../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx index 192d554bdc873..c58cb12f03a19 100644 --- a/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/api_keys/api_keys_grid/api_keys_grid_page.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ReactWrapper } from 'enzyme'; import { EuiCallOut } from '@elastic/eui'; diff --git a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx index 72fc3a1213521..c5582d3526242 100644 --- a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx +++ b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box.test.tsx @@ -5,11 +5,11 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { RoleComboBox } from '.'; import { EuiComboBox } from '@elastic/eui'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; describe('RoleComboBox', () => { it('renders the provided list of roles via EuiComboBox options', () => { diff --git a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box_option.test.tsx b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box_option.test.tsx index c1ac381ba9994..b24a48145b461 100644 --- a/x-pack/plugins/security/public/management/role_combo_box/role_combo_box_option.test.tsx +++ b/x-pack/plugins/security/public/management/role_combo_box/role_combo_box_option.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { RoleComboBoxOption } from './role_combo_box_option'; describe('RoleComboBoxOption', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx index 76c02158cc223..2d76b25a450a0 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/delete_provider/delete_provider.test.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { EuiConfirmModal } from '@elastic/eui'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { RoleMapping } from '../../../../../common/model'; import { DeleteProvider } from '.'; diff --git a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx index 300f6ca0e1f72..89d2e838e8e39 100644 --- a/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/components/section_loading/section_loading.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { SectionLoading } from '.'; describe('SectionLoading', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx index aff8ed12bceb6..c7c40cea63e2e 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/edit_role_mapping_page.test.tsx @@ -6,13 +6,13 @@ import React from 'react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import 'test_utils/stub_web_worker'; +import '@kbn/test/target/jest/utils/stub_web_worker'; import { EditRoleMappingPage } from '.'; import { NoCompatibleRealms, SectionLoading, PermissionDenied } from '../components'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx index aaf223f5a8dcb..dbd034ff3f764 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/mapping_info_panel/mapping_info_panel.test.tsx @@ -6,8 +6,8 @@ import React from 'react'; import type { PublicMethodsOf } from '@kbn/utility-types'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { Role, RoleMapping } from '../../../../../common/model'; import { RolesAPIClient } from '../../../roles'; import { DocumentationLinksService } from '../../documentation_links'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx index 230664f6fc997..19697863451c1 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/add_role_template_button.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { AddRoleTemplateButton } from './add_role_template_button'; describe('AddRoleTemplateButton', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx index 29c5acdb1dda4..34590d2953c7c 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_selector.test.tsx @@ -5,8 +5,8 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiComboBox } from '@elastic/eui'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { RoleSelector } from './role_selector'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx index 6d4af97e12def..3ba998f8ef4ab 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/role_selector/role_template_editor.test.tsx @@ -5,9 +5,9 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { RoleTemplateEditor } from './role_template_editor'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; describe('RoleTemplateEditor', () => { it('allows inline templates to be edited', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx index d1411bd9bf2b9..627abd6782084 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/add_rule_button.test.tsx @@ -6,8 +6,8 @@ import React from 'react'; import { AddRuleButton } from './add_rule_button'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { FieldRule, AllRule } from '../../model'; describe('AddRuleButton', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx index 5374f4625336d..84c269decc57a 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/field_rule_editor.test.tsx @@ -6,9 +6,9 @@ import React from 'react'; import { FieldRuleEditor } from './field_rule_editor'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { FieldRule } from '../../model'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; function assertField(wrapper: ReactWrapper, index: number, field: string) { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx index c5b3ea433adaa..bae41b31cdcc1 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/json_rule_editor.test.tsx @@ -10,11 +10,11 @@ import 'brace/mode/json'; // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import 'test_utils/stub_web_worker'; +import '@kbn/test/target/jest/utils/stub_web_worker'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { JSONRuleEditor } from './json_rule_editor'; import { EuiCodeEditor } from '@elastic/eui'; import { AllRule, AnyRule, FieldRule, ExceptAnyRule, ExceptAllRule } from '../../model'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx index b9c650cc1f77a..ac31900b11a67 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_editor_panel.test.tsx @@ -5,16 +5,16 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, findTestSubject } from '@kbn/test/jest'; import { RuleEditorPanel } from '.'; import { VisualRuleEditor } from './visual_rule_editor'; import { JSONRuleEditor } from './json_rule_editor'; -import { findTestSubject } from 'test_utils/find_test_subject'; // brace/ace uses the Worker class, which is not currently provided by JSDOM. // This is not required for the tests to pass, but it rather suppresses lengthy // warnings in the console which adds unnecessary noise to the test output. -import 'test_utils/stub_web_worker'; +import '@kbn/test/target/jest/utils/stub_web_worker'; + import { AllRule, FieldRule } from '../../model'; import { EuiErrorBoundary } from '@elastic/eui'; import { DocumentationLinksService } from '../../documentation_links'; diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx index 48eb1380bd08f..3983702f66ac4 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/rule_group_editor.test.tsx @@ -6,12 +6,12 @@ import React from 'react'; import { RuleGroupEditor } from './rule_group_editor'; -import { shallowWithIntl, mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl, nextTick } from '@kbn/test/jest'; import { AllRule, FieldRule, AnyRule, ExceptAnyRule } from '../../model'; import { FieldRuleEditor } from './field_rule_editor'; import { AddRuleButton } from './add_rule_button'; import { EuiContextMenuItem } from '@elastic/eui'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; describe('RuleGroupEditor', () => { it('renders an empty group', () => { diff --git a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx index 7ec723853863a..43df5a47045d6 100644 --- a/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/edit_role_mapping/rule_editor_panel/visual_rule_editor.test.tsx @@ -5,9 +5,9 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { VisualRuleEditor } from './visual_rule_editor'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { AnyRule, AllRule, FieldRule, ExceptAnyRule, ExceptAllRule } from '../../model'; import { RuleGroupEditor } from './rule_group_editor'; import { FieldRuleEditor } from './field_rule_editor'; diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx index 727d7bf56e9e2..a8001c1b775ea 100644 --- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_grid/role_mappings_grid_page.test.tsx @@ -6,11 +6,11 @@ import React from 'react'; import { CoreStart, ScopedHistory } from 'kibana/public'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { RoleMappingsGridPage } from '.'; import { SectionLoading, PermissionDenied, NoCompatibleRealms } from '../components'; import { EmptyPrompt } from './empty_prompt'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiLink } from '@elastic/eui'; import { act } from '@testing-library/react'; import { DocumentationLinksService } from '../documentation_links'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx index b1e23cb43983e..951cf3b022f83 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/collapsible_panel/collapsible_panel.test.tsx @@ -6,7 +6,7 @@ import { EuiLink } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { CollapsiblePanel } from './collapsible_panel'; test('it renders without blowing up', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx index f4af935be6648..e7809835deac8 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/delete_role_button.test.tsx @@ -6,7 +6,7 @@ import { EuiButtonEmpty, EuiConfirmModal } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { DeleteRoleButton } from './delete_role_button'; test('it renders without crashing', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index e6daa15fe7e6e..b86fa1f175e96 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -7,7 +7,7 @@ import { ReactWrapper } from 'enzyme'; import React from 'react'; import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { Capabilities } from 'src/core/public'; import { KibanaFeature } from '../../../../../features/public'; import { Role } from '../../../../common/model'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx index 6912146b39e39..448fde808603b 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/cluster_privileges.test.tsx @@ -8,7 +8,7 @@ import { shallow } from 'enzyme'; import React from 'react'; import { Role } from '../../../../../../common/model'; import { ClusterPrivileges } from './cluster_privileges'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; test('it renders without crashing', () => { const role: Role = { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx index 7bca221682867..316822f7db024 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/elasticsearch_privileges.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { DocumentationLinksService } from '../../../documentation_links'; import { RoleValidator } from '../../validate_role'; import { ClusterPrivileges } from './cluster_privileges'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx index 879cd8e2759ab..889b72d0b65dd 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privilege_form.test.tsx @@ -5,7 +5,7 @@ */ import { EuiButtonIcon, EuiTextArea } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { RoleValidator } from '../../validate_role'; import { IndexPrivilegeForm } from './index_privilege_form'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx index 19f718beed4bf..dc54df84e9b71 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/es/index_privileges.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { RoleValidator } from '../../validate_role'; import { IndexPrivilegeForm } from './index_privilege_form'; import { IndexPrivileges } from './index_privileges'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts index 7cfa50f6204fb..09e1c0403a403 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts @@ -8,7 +8,7 @@ import { ReactWrapper } from 'enzyme'; import { EuiCheckbox, EuiCheckboxProps, EuiButtonGroup, EuiButtonGroupProps } from '@elastic/eui'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiAccordion } from '@elastic/eui'; import { SubFeatureForm } from '../sub_feature_form'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx index 002b13609005a..1735809152e99 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table.test.tsx @@ -6,13 +6,13 @@ import React from 'react'; import { FeatureTable } from './feature_table'; import { Role } from '../../../../../../../common/model'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { KibanaFeature, SubFeatureConfig } from '../../../../../../../../features/public'; import { kibanaFeatures, createFeature } from '../../../../__fixtures__/kibana_features'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { getDisplayedFeaturePrivileges } from './__fixtures__'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiAccordion } from '@elastic/eui'; const createRole = (kibana: Role['kibana'] = []): Role => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx index 8897d89a39926..f772e60df1986 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/feature_table_expanded_row.test.tsx @@ -9,9 +9,9 @@ import { Role } from '../../../../../../../common/model'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { FeatureTableExpandedRow } from './feature_table_expanded_row'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { act } from '@testing-library/react'; const createRole = (kibana: Role['kibana'] = []): Role => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx index ced90e24b9c72..eba94338d52d3 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.test.tsx @@ -10,7 +10,7 @@ import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileg import { SecuredSubFeature } from '../../../../model'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { Role } from '../../../../../../../common/model'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SubFeatureForm } from './sub_feature_form'; import { EuiCheckbox, EuiButtonGroup } from '@elastic/eui'; import { act } from '@testing-library/react'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx index 1514677c82457..fd4d8296455a0 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table_cell/feature_table_cell.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { createFeature } from '../../../../__fixtures__/kibana_features'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { FeatureTableCell } from '.'; import { SecuredFeature } from '../../../../model'; import { EuiIconTip } from '@elastic/eui'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts index b920e7b696375..207a91cc3a610 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/__fixtures__/index.ts @@ -8,7 +8,7 @@ import { ReactWrapper } from 'enzyme'; import { EuiTableRow } from '@elastic/eui'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { Role, RoleKibanaPrivilege } from '../../../../../../../../common/model'; import { PrivilegeSummaryExpandedRow } from '../privilege_summary_expanded_row'; import { FeatureTableCell } from '../../feature_table_cell'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx index 85144d37ce754..6c9d9057d396a 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary.test.tsx @@ -5,12 +5,12 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; import { RoleKibanaPrivilege } from '../../../../../../../common/model'; import { PrivilegeSummary } from '.'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { PrivilegeSummaryTable } from './privilege_summary_table'; const createRole = (roleKibanaPrivileges: RoleKibanaPrivilege[]) => ({ diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx index 502868a509f91..0750335b0784c 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/privilege_summary_table.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { PrivilegeSummaryTable } from './privilege_summary_table'; import { RoleKibanaPrivilege } from '../../../../../../../common/model'; import { getDisplayedFeaturePrivileges } from './__fixtures__'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx index 3c9d1789fa5ab..4752f7b3a5a17 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/privilege_summary/space_column_header.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SpaceColumnHeader } from './space_column_header'; import { SpacesPopoverList } from '../../../spaces_popover_list'; import { SpaceAvatar } from '../../../../../../../../spaces/public'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx index 8254e2632aa9d..7f22f1df694ad 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/simple_privilege_section/simple_privilege_section.test.tsx @@ -6,7 +6,7 @@ import { EuiButtonGroup, EuiButtonGroupProps, EuiComboBox, EuiSuperSelect } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { Role } from '../../../../../../../common/model'; import { SimplePrivilegeSection } from './simple_privilege_section'; import { UnsupportedSpacePrivilegesWarning } from './unsupported_space_privileges_warning'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx index 155ccf98b9762..35ab151d02670 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_display.test.tsx @@ -6,7 +6,7 @@ import { EuiText } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { PrivilegeDisplay } from './privilege_display'; describe('PrivilegeDisplay', () => { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx index e4dc0606ebf67..3df4b7224f422 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_form.test.tsx @@ -7,13 +7,13 @@ import { Role } from '../../../../../../../common/model'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { kibanaFeatures } from '../../../../__fixtures__/kibana_features'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { PrivilegeSpaceForm } from './privilege_space_form'; import React from 'react'; import { Space } from '../../../../../../../../spaces/public'; import { FeatureTable } from '../feature_table'; import { getDisplayedFeaturePrivileges } from '../feature_table/__fixtures__'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { SpaceSelector } from './space_selector'; import { EuiButtonGroup } from '@elastic/eui'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx index 0242fddc957c9..54caf66c73275 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/privilege_space_table.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { EuiBadge, EuiInMemoryTable } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { PrivilegeSpaceTable } from './privilege_space_table'; import { PrivilegeDisplay } from './privilege_display'; @@ -14,7 +14,7 @@ import { Role, RoleKibanaPrivilege } from '../../../../../../../common/model'; import { createKibanaPrivileges } from '../../../../__fixtures__/kibana_privileges'; import { PrivilegeFormCalculator } from '../privilege_form_calculator'; import { KibanaFeature } from '../../../../../../../../features/public'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; interface TableRow { spaces: string[]; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx index a9bcb5433fcc7..be5c73b0ba965 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/space_aware_privilege_section/space_aware_privilege_section.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { RoleValidator } from '../../../validate_role'; import { PrivilegeSpaceForm } from './privilege_space_form'; import { PrivilegeSpaceTable } from './privilege_space_table'; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx index 9c68a097a890e..895402c2d9409 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/spaces_popover_list/spaces_popover_list.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SpacesPopoverList } from '.'; import { EuiButtonEmpty, diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx index 1ee621f9ba12d..cfb57f8a8a8d5 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx @@ -8,7 +8,7 @@ import { EuiIcon, EuiBasicTable } from '@elastic/eui'; import type { PublicMethodsOf } from '@kbn/utility-types'; import { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { RolesAPIClient } from '../roles_api_client'; import { PermissionDenied } from './permission_denied'; import { RolesGridPage } from './roles_grid_page'; @@ -16,7 +16,7 @@ import { RolesGridPage } from './roles_grid_page'; import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; import { rolesAPIClientMock } from '../index.mock'; import { ReservedBadge, DisabledBadge } from '../../badges'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; const mock403 = () => ({ body: { statusCode: 403 } }); diff --git a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx index 43eb32853cf63..a462b185fb9fd 100644 --- a/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/change_password_form/change_password_form.test.tsx @@ -6,7 +6,7 @@ import { EuiFieldPassword } from '@elastic/eui'; import { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { User } from '../../../../../common/model'; import { ChangePasswordForm } from './change_password_form'; diff --git a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx index e39a4acdaaff9..cfc9d6ba9b366 100644 --- a/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx +++ b/x-pack/plugins/security/public/management/users/components/confirm_delete_users/confirm_delete_users.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ConfirmDeleteUsers } from './confirm_delete_users'; import React from 'react'; diff --git a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx index 40ffc508f086b..5e8c9f2d14a4c 100644 --- a/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/edit_user/edit_user_page.test.tsx @@ -5,7 +5,7 @@ */ import { act } from '@testing-library/react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { EditUserPage } from './edit_user_page'; import React from 'react'; import { User, Role } from '../../../../common/model'; @@ -15,7 +15,7 @@ import { mockAuthenticatedUser } from '../../../../common/model/authenticated_us import { securityMock } from '../../../mocks'; import { rolesAPIClientMock } from '../../roles/index.mock'; import { userAPIClientMock } from '../index.mock'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; const createUser = (username: string, roles = ['idk', 'something']) => { const user: User = { diff --git a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx index 0cc3146172f70..efd6edbe7e697 100644 --- a/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/users/users_grid/users_grid_page.test.tsx @@ -7,14 +7,14 @@ import { LocationDescriptorObject } from 'history'; import { CoreStart, ScopedHistory } from 'kibana/public'; import { User } from '../../../../common/model'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { UsersGridPage } from './users_grid_page'; import React from 'react'; import { ReactWrapper } from 'enzyme'; import { userAPIClientMock } from '../index.mock'; import { coreMock, scopedHistoryMock } from '../../../../../../../src/core/public/mocks'; import { rolesAPIClientMock } from '../../roles/index.mock'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiBasicTable } from '@elastic/eui'; describe('UsersGridPage', () => { diff --git a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx index 1da91e80d062d..4a2b86447b7f7 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx +++ b/x-pack/plugins/security/public/nav_control/nav_control_component.test.tsx @@ -6,11 +6,11 @@ import React from 'react'; import { BehaviorSubject } from 'rxjs'; -import { shallowWithIntl, nextTick, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, nextTick, mountWithIntl } from '@kbn/test/jest'; import { SecurityNavControl } from './nav_control_component'; import { AuthenticatedUser } from '../../common/model'; import { EuiPopover, EuiHeaderSectionItemButton } from '@elastic/eui'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; describe('SecurityNavControl', () => { it(`renders a loading spinner when the user promise hasn't resolved yet.`, async () => { diff --git a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts index 5b9788d67500b..0e5c6e8bd6f2e 100644 --- a/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts +++ b/x-pack/plugins/security/public/nav_control/nav_control_service.test.ts @@ -9,7 +9,7 @@ import { BehaviorSubject } from 'rxjs'; import { ILicense } from '../../../licensing/public'; import { SecurityNavControlService } from '.'; import { SecurityLicenseService } from '../../common/licensing'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { securityMock } from '../mocks'; import { mockAuthenticatedUser } from '../../common/model/authenticated_user.mock'; diff --git a/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx b/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx index bb4116420f15d..69eff1b6d31ee 100644 --- a/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx +++ b/x-pack/plugins/security/public/session/session_idle_timeout_warning.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { SessionIdleTimeoutWarning } from './session_idle_timeout_warning'; describe('SessionIdleTimeoutWarning', () => { diff --git a/x-pack/plugins/security/public/session/session_timeout.test.tsx b/x-pack/plugins/security/public/session/session_timeout.test.tsx index c49cd8cd4ed9c..1fad9a1c9f365 100644 --- a/x-pack/plugins/security/public/session/session_timeout.test.tsx +++ b/x-pack/plugins/security/public/session/session_timeout.test.tsx @@ -8,7 +8,7 @@ import { coreMock } from 'src/core/public/mocks'; import BroadcastChannel from 'broadcast-channel'; import { SessionTimeout } from './session_timeout'; import { createSessionExpiredMock } from './session_expired.mock'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; jest.useFakeTimers(); diff --git a/x-pack/plugins/security/server/authorization/authorization_service.test.ts b/x-pack/plugins/security/server/authorization/authorization_service.test.ts index 33abc22fdf096..01a3a60355019 100644 --- a/x-pack/plugins/security/server/authorization/authorization_service.test.ts +++ b/x-pack/plugins/security/server/authorization/authorization_service.test.ts @@ -22,7 +22,7 @@ import { authorizationModeFactory } from './mode'; import { privilegesFactory } from './privileges'; import { AuthorizationService } from '.'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { coreMock, elasticsearchServiceMock, diff --git a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts index 073b0b6225478..812e3e3d17f99 100644 --- a/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts +++ b/x-pack/plugins/security/server/elasticsearch/elasticsearch_service.test.ts @@ -20,7 +20,7 @@ import { loggingSystemMock, } from '../../../../../src/core/server/mocks'; import { licenseMock } from '../../common/licensing/index.mock'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; describe('ElasticsearchService', () => { let service: ElasticsearchService; diff --git a/x-pack/plugins/security/server/session_management/session_management_service.test.ts b/x-pack/plugins/security/server/session_management/session_management_service.test.ts index 155cc0bdd58ff..08d4c491d1556 100644 --- a/x-pack/plugins/security/server/session_management/session_management_service.test.ts +++ b/x-pack/plugins/security/server/session_management/session_management_service.test.ts @@ -14,7 +14,7 @@ import { import { Session } from './session'; import { SessionIndex } from './session_index'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { coreMock, elasticsearchServiceMock, diff --git a/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx b/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx index fc1d30907ab09..3920c53e3dc22 100644 --- a/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/empty_value/empty_value.test.tsx @@ -8,7 +8,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { mount, shallow } from 'enzyme'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { defaultToEmptyTag, diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx index 9c86c502a7648..0659ce8eb227a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/error_callout.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { coreMock } from '../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx index 6927ecec788fb..ff2181f21d362 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/viewer/exceptions_utility.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; import { ExceptionsViewerUtility } from './exceptions_utility'; diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx index e6d34b5e432ac..2ae5b1d20c3c3 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx @@ -6,7 +6,7 @@ import { mount, shallow, ShallowWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { encodeIpv6 } from '../../lib/helpers'; import { useUiSetting$ } from '../../lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx index cbd2fdf235ce5..bbf7b91514aeb 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_popover.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { MlPopover } from './ml_popover'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/index.test.tsx index 8aebc8519bcb7..161671ed730f3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/index.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ThemeProvider } from 'styled-components'; import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_card_header.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_card_header.test.tsx index bc46c238c5ae8..4fbb7ce3f46eb 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_card_header.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_card_header.test.tsx @@ -6,7 +6,7 @@ import moment from 'moment-timezone'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import '../../../../common/mock/formatted_relative'; import * as i18n from '../translations'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_created.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_created.test.tsx index 7b51a9eaa1a2d..92d334a059ae9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_created.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/notes/note_card/note_created.test.tsx @@ -6,7 +6,7 @@ import moment from 'moment-timezone'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import '../../../../common/mock/formatted_relative'; import { NoteCreated } from './note_created'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/notes/note_cards/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/notes/note_cards/index.test.tsx index 54a074bb2adb7..731ff020457a2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/notes/note_cards/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/notes/note_cards/index.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ThemeProvider } from 'styled-components'; import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx index aeca4641c3169..5d71814f23fe9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/delete_timeline_modal.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DeleteTimelineModal } from './delete_timeline_modal'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx index 9acf0c829f321..86aec7d8dac17 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/delete_timeline_modal/index.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DeleteTimelineModalOverlay } from '.'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx index cb0eba910c342..d791e6ebe4366 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.test.tsx @@ -7,7 +7,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep } from 'lodash/fp'; import moment from 'moment'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/note_preview.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/note_preview.test.tsx index feabe46edfa82..484b3e5a60015 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/note_preview.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/note_preview.test.tsx @@ -5,7 +5,7 @@ */ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx index 07f22bd47a9dd..7a927e2f11749 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; import { waitFor } from '@testing-library/react'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx index 2744e0b42efce..d6214056c65dd 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_body.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx index 18c2e4cff16bf..65e962072eef7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/search_row/index.test.tsx @@ -6,7 +6,7 @@ import { EuiFilterButtonProps } from '@elastic/eui'; import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx index 52b7a4293e847..336b8ebec2bb1 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.test.tsx @@ -7,7 +7,7 @@ import { EuiButtonIconProps } from '@elastic/eui'; import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx index 18270a30eb0e1..c467154a3de68 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/common_columns.test.tsx @@ -9,7 +9,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep, omit } from 'lodash/fp'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import '../../../../common/mock/match_media'; import '../../../../common/mock/formatted_relative'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx index 0f2b3cdea4eec..a64521406f082 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/extended_columns.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx index 6e3f0037003b1..f3b0c2999a62c 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/icon_header_columns.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep, omit } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx index 649e38865f907..d96a3d504f487 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/index.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { cloneDeep } from 'lodash/fp'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx index da4b804528a0f..78a1d7b17a201 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/title_row/index.test.tsx @@ -6,7 +6,7 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { EuiButtonProps } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ThemeProvider } from 'styled-components'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/index.test.tsx index cdedca23e85af..a6740a0cdb0f3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/index.test.tsx @@ -21,7 +21,7 @@ import { createStore, State } from '../../../../common/store'; import { useThrottledResizeObserver } from '../../../../common/components/utils'; import { Properties, showDescriptionThreshold, showNotesThreshold } from '.'; import { setInsertTimeline } from '../../../store/timeline/actions'; -export { nextTick } from '../../../../../../../test_utils'; +export { nextTick } from '@kbn/test/jest'; import { waitFor } from '@testing-library/react'; jest.mock('../../../../common/components/link_to'); diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts index a8e8117d85f5f..1b23bfcf51024 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts @@ -5,13 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { - registerTestBed, - findTestSubject, - TestBed, - TestBedConfig, - nextTick, -} from '../../../../../test_utils'; +import { registerTestBed, findTestSubject, TestBed, TestBedConfig, delay } from '@kbn/test/jest'; import { SnapshotRestoreHome } from '../../../public/application/sections/home/home'; import { BASE_PATH } from '../../../public/application/constants'; import { WithAppDependencies } from './setup_environment'; @@ -65,7 +59,7 @@ export const setup = async (): Promise => { await act(async () => { const { href } = repositoryLink.props(); router.navigateTo(href!); - await nextTick(10); + await delay(10); component.update(); }); }; @@ -89,7 +83,7 @@ export const setup = async (): Promise => { await act(async () => { const { href } = snapshotLink.props(); router.navigateTo(href!); - await nextTick(100); + await delay(100); component.update(); }); }; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts index 69d1423f5f8fb..8660edc26df3a 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/index.ts @@ -11,7 +11,7 @@ import { setup as policyAddSetup } from './policy_add.helpers'; import { setup as policyEditSetup } from './policy_edit.helpers'; import { setup as restoreSnapshotSetup } from './restore_snapshot.helpers'; -export { nextTick, getRandomString, findTestSubject, TestBed } from '../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject, TestBed, delay } from '@kbn/test/jest'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts index e8528889eb231..69fdf7fa2aa6c 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { PolicyAdd } from '../../../public/application/sections/policy_add'; import { formSetup, PolicyFormTestSubjects } from './policy_form.helpers'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts index f009afbb2eacc..69f0391d53374 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { PolicyEdit } from '../../../public/application/sections/policy_edit'; import { WithAppDependencies } from './setup_environment'; import { POLICY_NAME } from './constant'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts index ab2963223f678..5f0e321b66e6e 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_form.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TestBed, SetupFunc } from '../../../../../test_utils'; +import { TestBed, SetupFunc } from '@kbn/test/jest'; export interface PolicyFormTestBed extends TestBed { actions: { diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts index fa4421988740b..cedab7c3581b9 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed } from '../../../../../test_utils'; +import { registerTestBed, TestBed } from '@kbn/test/jest'; import { RepositoryType } from '../../../common/types'; import { RepositoryAdd } from '../../../public/application/sections/repository_add'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts index 043b21270cc8d..110c6f0f2cdf3 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBedConfig } from '@kbn/test/jest'; import { RepositoryEdit } from '../../../public/application/sections/repository_edit'; import { WithAppDependencies } from './setup_environment'; import { REPOSITORY_NAME } from './constant'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts index cfe3027b6d43f..a1b1129dd4b15 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { RestoreSnapshot } from '../../../public/application/sections/restore_snapshot'; import { WithAppDependencies } from './setup_environment'; diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/home.test.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/home.test.ts index 6021ab2a42c90..50a117f8b9885 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/home.test.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/home.test.ts @@ -12,6 +12,7 @@ import { setupEnvironment, pageHelpers, nextTick, + delay, getRandomString, findTestSubject, } from './helpers'; @@ -397,7 +398,7 @@ describe('', () => { await act(async () => { testBed.actions.selectTab('snapshots'); - await nextTick(100); + await delay(100); testBed.component.update(); }); }); @@ -426,7 +427,7 @@ describe('', () => { await act(async () => { testBed.actions.selectTab('snapshots'); - await nextTick(2000); + await delay(2000); testBed.component.update(); }); }); @@ -466,7 +467,7 @@ describe('', () => { await act(async () => { testBed.actions.selectTab('snapshots'); - await nextTick(2000); + await delay(2000); testBed.component.update(); }); }); diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_add.test.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_add.test.ts index e0c9aeffa09e8..593882643af58 100644 --- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_add.test.ts +++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/repository_add.test.ts @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import { INVALID_NAME_CHARS } from '../../public/application/services/validation/validate_repository'; import { getRepository } from '../../test/fixtures'; import { RepositoryType } from '../../common/types'; -import { setupEnvironment, pageHelpers, nextTick } from './helpers'; +import { setupEnvironment, pageHelpers, nextTick, delay } from './helpers'; import { RepositoryAddTestBed } from './helpers/repository_add.helpers'; const { setup } = pageHelpers.repositoryAdd; @@ -176,7 +176,7 @@ describe('', () => { await act(async () => { actions.clickBackButton(); - await nextTick(100); + await delay(100); component.update(); }); }; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts b/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts index a293f505147e4..0f2d6c11db708 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/policy.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString, getRandomNumber } from '../../../../test_utils'; +import { getRandomString, getRandomNumber } from '@kbn/test/jest'; import { SlmPolicy } from '../../common/types'; import { DEFAULT_POLICY_SCHEDULE } from '../../public/application/constants'; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts b/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts index f8b30f3c5d362..6045976180987 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/repository.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString } from '../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; import { RepositoryType } from '../../common/types'; const defaultSettings: any = { chunkSize: '10mb', location: '/tmp/es-backups' }; diff --git a/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts b/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts index e59f4689d9e3f..f31a884f3207c 100644 --- a/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts +++ b/x-pack/plugins/snapshot_restore/test/fixtures/snapshot.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString, getRandomNumber } from '../../../../test_utils'; +import { getRandomString, getRandomNumber } from '@kbn/test/jest'; export const getSnapshot = ({ repository = 'my-repo', diff --git a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx index 7134049c4cf8f..218c04ebfdf83 100644 --- a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx +++ b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_subtitle/advanced_settings_subtitle.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { AdvancedSettingsSubtitle } from './advanced_settings_subtitle'; import { EuiCallOut } from '@elastic/eui'; import { act } from '@testing-library/react'; diff --git a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx index b772ff433abec..3d49d48a987e5 100644 --- a/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx +++ b/x-pack/plugins/spaces/public/advanced_settings/components/advanced_settings_title/advanced_settings_title.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { AdvancedSettingsTitle } from './advanced_settings_title'; import { SpaceAvatar } from '../../../space_avatar'; import { act } from '@testing-library/react'; diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx index 4e49a2da3e534..cf406653990c8 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_mode_control.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { CopyModeControl, CopyModeControlProps } from './copy_mode_control'; describe('CopyModeControl', () => { diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx index f484b738bd222..ac45db40a3810 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.test.tsx @@ -5,12 +5,12 @@ */ import React from 'react'; import Boom from '@hapi/boom'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { CopySavedObjectsToSpaceFlyout } from './copy_to_space_flyout'; import { CopyToSpaceForm } from './copy_to_space_form'; import { EuiLoadingSpinner, EuiEmptyPrompt } from '@elastic/eui'; import { Space } from '../../../common/model/space'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { SelectableSpacesControl } from './selectable_spaces_control'; import { act } from '@testing-library/react'; import { ProcessingCopyToSpace } from './processing_copy_to_space'; diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx index 7da265d8f9958..f2d5009cb9f44 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/resolve_all_conflicts.test.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { ReactWrapper } from 'enzyme'; import { act } from '@testing-library/react'; -import { shallowWithIntl, mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { shallowWithIntl, mountWithIntl, nextTick } from '@kbn/test/jest'; +import { findTestSubject } from '@kbn/test/jest'; import { ResolveAllConflicts, ResolveAllConflictsProps } from './resolve_all_conflicts'; import { SummarizedCopyToSpaceResult } from '..'; import { ImportRetry } from '../types'; diff --git a/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx index 331435b54edb7..68801bfbb2ec8 100644 --- a/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx +++ b/x-pack/plugins/spaces/public/management/components/confirm_delete_modal/confirm_delete_modal.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { ConfirmDeleteModal } from './confirm_delete_modal'; import { spacesManagerMock } from '../../../spaces_manager/mocks'; import { SpacesManager } from '../../../spaces_manager'; diff --git a/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx index a2b4c008ac175..3d614cbc10d20 100644 --- a/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx +++ b/x-pack/plugins/spaces/public/management/components/unauthorized_prompt/unauthorized_prompt.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { UnauthorizedPrompt } from './unauthorized_prompt'; describe('UnauthorizedPrompt', () => { diff --git a/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx index 4623378c8cee2..017363fe3da11 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/confirm_alter_active_space_modal/confirm_alter_active_space_modal.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ConfirmAlterActiveSpaceModal } from './confirm_alter_active_space_modal'; describe('ConfirmAlterActiveSpaceModal', () => { diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx index dc20a375ada1e..bfdef5171fc08 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space_avatar.test.tsx @@ -6,7 +6,7 @@ // @ts-ignore import { EuiColorPicker, EuiFieldText, EuiLink } from '@elastic/eui'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { CustomizeSpaceAvatar } from './customize_space_avatar'; const space = { diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx index 221dd0febe85a..0de6952b03278 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/space_identifier.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { SpaceValidator } from '../../lib'; import { SpaceIdentifier } from './space_identifier'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx index fbb2a3d07a293..61a769b618dd7 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/delete_spaces_button.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { DeleteSpacesButton } from './delete_spaces_button'; import { spacesManagerMock } from '../../spaces_manager/mocks'; import { SpacesManager } from '../../spaces_manager'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx index 093c4fb02428b..aa47e439af95f 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/enabled_features/enabled_features.test.tsx @@ -5,11 +5,11 @@ */ import React from 'react'; -import { mountWithIntl, nextTick, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick, shallowWithIntl } from '@kbn/test/jest'; import { EnabledFeatures } from './enabled_features'; import { KibanaFeatureConfig } from '../../../../../features/public'; import { DEFAULT_APP_CATEGORIES } from '../../../../../../../src/core/public'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { EuiCheckboxProps } from '@elastic/eui'; const features: KibanaFeatureConfig[] = [ diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx index 270cf862ccbd9..57c53a256772c 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.test.tsx @@ -8,7 +8,7 @@ import { EuiButton, EuiCheckboxProps } from '@elastic/eui'; import { ReactWrapper } from 'enzyme'; import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ConfirmAlterActiveSpaceModal } from './confirm_alter_active_space_modal'; import { ManageSpacePage } from './manage_space_page'; import { spacesManagerMock } from '../../spaces_manager/mocks'; diff --git a/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx index d9ad63c30adde..51885c5559bae 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/reserved_space_badge.test.tsx @@ -6,7 +6,7 @@ import { EuiBadge } from '@elastic/eui'; import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ReservedSpaceBadge } from './reserved_space_badge'; const reservedSpace = { diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx index 576881398a63c..37c54ea7b72aa 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { SectionPanel } from './section_panel'; test('it renders without blowing up', () => { diff --git a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx index 34942221e53ee..606bb5cfbdcc9 100644 --- a/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_grid/spaces_grid_pages.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl, shallowWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl, nextTick } from '@kbn/test/jest'; import { SpaceAvatar } from '../../space_avatar'; import { spacesManagerMock } from '../../spaces_manager/mocks'; import { SpacesManager } from '../../spaces_manager'; diff --git a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx index 009b6aa89d089..0f09b638a1d0b 100644 --- a/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx +++ b/x-pack/plugins/spaces/public/nav_control/components/manage_spaces_button.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ManageSpacesButton } from './manage_spaces_button'; describe('ManageSpacesButton', () => { diff --git a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx index 5de7fcf69b363..f1465a0648f56 100644 --- a/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx +++ b/x-pack/plugins/spaces/public/nav_control/nav_control_popover.test.tsx @@ -12,7 +12,7 @@ import { spacesManagerMock } from '../spaces_manager/mocks'; import { SpacesManager } from '../spaces_manager'; import { NavControlPopover } from './nav_control_popover'; import { EuiHeaderSectionItemButton } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; describe('NavControlPopover', () => { it('renders without crashing', () => { diff --git a/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout.test.tsx b/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout.test.tsx index 29571a17a19bd..2f4188f1e6ed8 100644 --- a/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout.test.tsx +++ b/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout.test.tsx @@ -5,12 +5,12 @@ */ import React from 'react'; import Boom from '@hapi/boom'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { ShareSavedObjectsToSpaceFlyout } from './share_to_space_flyout'; import { ShareToSpaceForm } from './share_to_space_form'; import { EuiLoadingSpinner, EuiSelectable } from '@elastic/eui'; import { Space } from '../../../common/model/space'; -import { findTestSubject } from 'test_utils/find_test_subject'; +import { findTestSubject } from '@kbn/test/jest'; import { SelectableSpacesControl } from './selectable_spaces_control'; import { act } from '@testing-library/react'; import { spacesManagerMock } from '../../spaces_manager/mocks'; diff --git a/x-pack/plugins/spaces/public/share_saved_objects_to_space/share_saved_objects_to_space_column.test.tsx b/x-pack/plugins/spaces/public/share_saved_objects_to_space/share_saved_objects_to_space_column.test.tsx index 041728a3eac0d..b5ec4349eca12 100644 --- a/x-pack/plugins/spaces/public/share_saved_objects_to_space/share_saved_objects_to_space_column.test.tsx +++ b/x-pack/plugins/spaces/public/share_saved_objects_to_space/share_saved_objects_to_space_column.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { SpacesManager } from '../spaces_manager'; import { spacesManagerMock } from '../spaces_manager/mocks'; import { ShareToSpaceSavedObjectsManagementColumn } from './share_saved_objects_to_space_column'; diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx index 112a8a9a0a685..8ecc8e8200e47 100644 --- a/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx +++ b/x-pack/plugins/spaces/public/space_selector/space_selector.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { Space } from '../../common/model/space'; import { SpaceSelector } from './space_selector'; import { spacesManagerMock } from '../spaces_manager/mocks'; diff --git a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts index 7f005e37d96e9..42f3d766adf85 100644 --- a/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts +++ b/x-pack/plugins/spaces/public/spaces_manager/spaces_manager.test.ts @@ -6,7 +6,7 @@ import { SpacesManager } from '.'; import { coreMock } from 'src/core/public/mocks'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; describe('SpacesManager', () => { describe('#constructor', () => { diff --git a/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts b/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts index 047dadb446289..25c5a6019b34a 100644 --- a/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts +++ b/x-pack/plugins/spaces/server/default_space/default_space_service.test.ts @@ -21,7 +21,7 @@ import { coreMock, loggingSystemMock } from 'src/core/server/mocks'; import { licensingMock } from '../../../licensing/server/mocks'; import { SpacesLicenseService } from '../../common/licensing'; import { ILicense } from '../../../licensing/server'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { first } from 'rxjs/operators'; const advanceRetry = async (initializeCount: number) => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx index 2ef887d0627cc..4fe76b9ff3c2c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { EmailActionConnector } from '../types'; import EmailActionConnectorFields from './email_connector'; import { DocLinksStart } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx index ed7b9a19d9541..1198fc26df80d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; import EmailParamsFields from './email_params'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx index f5f14cb041335..721cb18e1f360 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { act } from 'react-dom/test-utils'; import { EsIndexActionConnector } from '../types'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx index 0e4215e503275..00ec687304427 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import ParamsFields from './es_index_params'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx index 6d055f4fdb9f2..1bcb528bbd6c7 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DocLinksStart } from 'kibana/public'; import JiraConnectorFields from './jira_connectors'; import { JiraActionConnector } from './types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_params.test.tsx index 0990baa30eb15..671a575695d69 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/jira/jira_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import JiraParamsFields from './jira_params'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx index 18978be7b4680..afd7c429805ac 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { act } from 'react-dom/test-utils'; import { PagerDutyActionConnector } from '.././types'; import PagerDutyActionConnectorFields from './pagerduty_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx index ea947a159b893..6236d7a751e00 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { EventActionOptions, SeverityActionOptions } from '.././types'; import PagerDutyParamsFields from './pagerduty_params'; import { DocLinksStart } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx index 6dede85736fcd..23eebcb4ac017 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DocLinksStart } from 'kibana/public'; import ResilientConnectorFields from './resilient_connectors'; import { ResilientActionConnector } from './types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_params.test.tsx index a04e213e04872..b12307e1fdd16 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/resilient/resilient_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import ResilientParamsFields from './resilient_params'; import { DocLinksStart } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx index 407cd70d4ad4c..e8429a54b618c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ServerLogLevelOptions } from '.././types'; import ServerLogParamsFields from './server_log_params'; import { DocLinksStart } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx index b666db4024b12..8840045d6b726 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { DocLinksStart } from 'kibana/public'; import ServiceNowConnectorFields from './servicenow_connectors'; import { ServiceNowActionConnector } from './types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.test.tsx index b4559e2e05b1e..88f76c760bdcf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import ServiceNowParamsFields from './servicenow_params'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx index f87c2ad99fb4f..54ed912d63599 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { act } from '@testing-library/react'; import { SlackActionConnector } from '../types'; import SlackActionFields from './slack_connectors'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx index c580424c05b95..cf35677721225 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import SlackParamsFields from './slack_params'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx index 4c5e78670f0c4..a6a06287b73f3 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { WebhookActionConnector } from '../types'; import WebhookActionConnectorFields from './webhook_connectors'; import { DocLinksStart } from 'kibana/public'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx index a4cb36cab76b6..7dafea8a99e87 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_params.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import WebhookParamsFields from './webhook_params'; import { DocLinksStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx index d19dc3d303479..80cebeb055721 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx @@ -7,7 +7,7 @@ import * as React from 'react'; import { RouteComponentProps, Router } from 'react-router-dom'; import { createMemoryHistory, createLocation } from 'history'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import TriggersActionsUIHome, { MatchParams } from './home'; import { AppContextProvider } from './app_context'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx index cf83062b5781e..cc42c6296e7b3 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { ValidationResult, UserConfiguredActionConnector } from '../../../types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx index 94452e70e6bfa..c760d9128ccbd 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_form.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React, { Fragment, lazy } from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { act } from 'react-dom/test-utils'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx index 2fe068536f4a1..8102b4d393a19 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { ActionsConnectorsContextProvider } from '../../context/actions_connectors_context'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx index 551bcf658e87f..68d5d1e7d9573 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import ConnectorAddFlyout from './connector_add_flyout'; import { ActionsConnectorsContextProvider } from '../../context/actions_connectors_context'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx index 71a3936ed5055..0d634729002eb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_modal.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { ConnectorAddModal } from './connector_add_modal'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx index ab58b2430fa1a..5833c3a9a37bf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_edit_flyout.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { ActionsConnectorsContextProvider } from '../../context/actions_connectors_context'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx index 482bccb5517f1..f4a1aca7f8f24 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.test.tsx @@ -12,7 +12,7 @@ import { ActionConnector, ValidationResult } from '../../../types'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; import { ActionsConnectorsContextProvider } from '../../context/actions_connectors_context'; import { EuiFormRow, EuiFieldText, EuiText, EuiLink, EuiForm, EuiSelect } from '@elastic/eui'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; const mockedActionParamsFields = lazy(async () => ({ default() { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx index e946e881def10..65d5389078880 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { ActionsConnectorsList } from './actions_connectors_list'; import { coreMock, scopedHistoryMock } from '../../../../../../../../src/core/public/mocks'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx index 4b5f8596501e1..aae0c6ea7e9e4 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { act } from 'react-dom/test-utils'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFormLabel } from '@elastic/eui'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx index 31c61f0bba768..77941d5c2bca1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import * as React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { act } from 'react-dom/test-utils'; import { coreMock } from '../../../../../../../src/core/public/mocks'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx index 493b870a1a6d5..6b5f0a31d345c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import React, { Fragment } from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { actionTypeRegistryMock } from '../../action_type_registry.mock'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx index c434ca9d21402..611846cf4a521 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.test.tsx @@ -5,7 +5,7 @@ */ import * as React from 'react'; -import { mountWithIntl, nextTick } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; import { coreMock, scopedHistoryMock } from '../../../../../../../../src/core/public/mocks'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; diff --git a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx index 73efba6929b71..c8d2b10274cd0 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/expression_items/threshold.test.tsx @@ -5,7 +5,7 @@ */ import * as React from 'react'; import { shallow } from 'enzyme'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { ThresholdExpression } from './threshold'; describe('threshold expression', () => { diff --git a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts index 99971c42e5512..fde21b18f2593 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_action.test.ts @@ -18,7 +18,7 @@ import { HELLO_WORLD_EMBEDDABLE, } from '../../../../examples/embeddable_examples/public'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; import { ReactElement } from 'react'; const createOpenModalMock = () => { diff --git a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts index a839079137905..addc969913fce 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/custom_time_range_badge.test.ts @@ -11,7 +11,7 @@ import { mount } from 'enzyme'; import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers'; import { CustomTimeRangeBadge } from './custom_time_range_badge'; import { ReactElement } from 'react'; -import { nextTick } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; test('Removing custom time range from badge resets embeddable back to container time', async () => { const container = new TimeRangeContainer( diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.stories.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.stories.tsx index a909d2a27f454..570882bcf9ce1 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.stories.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.stories.tsx @@ -7,10 +7,10 @@ import * as React from 'react'; import { EuiFlyout } from '@elastic/eui'; import { storiesOf } from '@storybook/react'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { createFlyoutManageDrilldowns } from './connected_flyout_manage_drilldowns'; import { mockActionFactories } from '../../../components/action_wizard/test_data'; import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; -import { StubBrowserStorage } from '../../../../../../../src/test_utils/public/stub_browser_storage'; import { mockDynamicActionManager } from './test_data'; const FlyoutManageDrilldowns = createFlyoutManageDrilldowns({ diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx index bef6834ed4c47..eec3696a5a8cc 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx @@ -12,7 +12,7 @@ import { mockSupportedTriggers, mockActionFactories, } from '../../../components/action_wizard/test_data'; -import { StubBrowserStorage } from '../../../../../../../src/test_utils/public/stub_browser_storage'; +import { StubBrowserStorage } from '@kbn/test/jest'; import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; import { mockDynamicActionManager } from './test_data'; import { TEST_SUBJ_DRILLDOWN_ITEM } from '../list_manage_drilldowns'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs.test.tsx index 09ca30a854f6f..463c0c9d016b3 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { httpServiceMock } from 'src/core/public/mocks'; import { UpgradeAssistantTabs } from './tabs'; import { LoadingState } from './types'; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/grouped.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/grouped.test.tsx index affeeb84f35d7..6bdb5df036224 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/grouped.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/grouped.test.tsx @@ -6,7 +6,7 @@ import { range } from 'lodash'; import React from 'react'; -import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { EuiBadge, EuiPagination } from '@elastic/eui'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.test.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.test.tsx index 25e3842291ff5..1c9a079bcf1eb 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/tabs/checkup/deprecations/index_table.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { IndexDeprecationTableProps, IndexDeprecationTableUI } from './index_table'; diff --git a/x-pack/plugins/uptime/public/components/common/__tests__/location_link.test.tsx b/x-pack/plugins/uptime/public/components/common/__tests__/location_link.test.tsx index c84e9d12cc4ca..b2220da9789fc 100644 --- a/x-pack/plugins/uptime/public/components/common/__tests__/location_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/__tests__/location_link.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { LocationLink } from '../location_link'; diff --git a/x-pack/plugins/uptime/public/components/common/__tests__/monitor_page_link.test.tsx b/x-pack/plugins/uptime/public/components/common/__tests__/monitor_page_link.test.tsx index 36ebeb6615648..31d126f183393 100644 --- a/x-pack/plugins/uptime/public/components/common/__tests__/monitor_page_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/__tests__/monitor_page_link.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { MonitorPageLink } from '../monitor_page_link'; describe('MonitorPageLink component', () => { diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_empty_state.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_empty_state.test.tsx index 2e25dddc0b4ed..8f78e640a988a 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_empty_state.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_empty_state.test.tsx @@ -5,7 +5,7 @@ */ import { ChartEmptyState } from '../chart_empty_state'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_wrapper.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_wrapper.test.tsx index 39d530d90db42..2f11707bb3ab9 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_wrapper.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/chart_wrapper.test.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { EuiSpacer } from '@elastic/eui'; import { mount } from 'enzyme'; -import { nextTick } from 'test_utils/enzyme_helpers'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { nextTick } from '@kbn/test/jest'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ChartWrapper } from '../chart_wrapper'; import { SnapshotHeading } from '../../../overview/snapshot/snapshot_heading'; import { DonutChart } from '../donut_chart'; diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart.test.tsx index 31939c3dfdb56..56789b8e7374e 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart.test.tsx @@ -5,7 +5,7 @@ */ import { DonutChart } from '../donut_chart'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; describe('DonutChart component', () => { diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend.test.tsx index fd10706ff101b..1b71b87884fb8 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend.test.tsx @@ -5,7 +5,7 @@ */ import { DonutChartLegend } from '../donut_chart_legend'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; describe('DonutChartLegend', () => { diff --git a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend_row.test.tsx b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend_row.test.tsx index 49e887cc8f96c..868409ef831a8 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/__tests__/donut_chart_legend_row.test.tsx @@ -5,7 +5,7 @@ */ import { DonutChartLegendRow } from '../donut_chart_legend_row'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; describe('DonutChartLegendRow', () => { diff --git a/x-pack/plugins/uptime/public/components/common/higher_order/__tests__/responsive_wrapper.test.tsx b/x-pack/plugins/uptime/public/components/common/higher_order/__tests__/responsive_wrapper.test.tsx index ae265ef1bb0c6..e5e2de8e6260e 100644 --- a/x-pack/plugins/uptime/public/components/common/higher_order/__tests__/responsive_wrapper.test.tsx +++ b/x-pack/plugins/uptime/public/components/common/higher_order/__tests__/responsive_wrapper.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { withResponsiveWrapper } from '../responsive_wrapper'; interface Prop { diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/confirm_delete.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/confirm_delete.test.tsx index 465369547d286..b598cb72ec21b 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/confirm_delete.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/confirm_delete.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ConfirmJobDeletion } from '../confirm_delete'; describe('ML Confirm Job Delete', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/license_info.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/license_info.test.tsx index 55ca4d453d061..b2c700beaf343 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/license_info.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/license_info.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { ShowLicenseInfo } from '../license_info'; import * as redux from 'react-redux'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/ml_flyout.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/ml_flyout.test.tsx index 4795042ed845f..f838ca63ef5f1 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/ml_flyout.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/ml_flyout.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { MLFlyoutView } from '../ml_flyout'; import { UptimeSettingsContext } from '../../../../contexts'; import { CLIENT_DEFAULTS } from '../../../../../common/constants'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/doc_link_body.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/doc_link_body.test.tsx index a29f647a22613..f8895f44ea084 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/doc_link_body.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/doc_link_body.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { DocLinkForBody } from '../doc_link_body'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/expanded_row.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/expanded_row.test.tsx index 85d1362ed3766..8a5b8b942e016 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/expanded_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/expanded_row.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { mountWithIntl, renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { PingListExpandedRowComponent } from '../expanded_row'; import { Ping } from '../../../../../common/runtime_types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_headers.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_headers.test.tsx index 86394a0a4d841..240a71e95b0ed 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_headers.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_headers.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { PingHeaders } from '../headers'; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_list.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_list.test.tsx index 8de4b89b7880d..db8012dbf0675 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/__tests__/ping_list.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { PingListComponent, rowShouldExpand, toggleDetails } from '../ping_list'; import { Ping, PingsResponse } from '../../../../../common/runtime_types'; import { ExpandedRowMap } from '../../../overview/monitor_list/types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/status_by_location.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/status_by_location.test.tsx index b171a8bedb8a7..5017a132d18e6 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/status_by_location.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/__test__/status_by_location.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { MonitorLocation } from '../../../../../common/runtime_types'; import { StatusByLocations } from '../index'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/availability_reporting.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/availability_reporting.test.tsx index 7a8ba3fd32cd9..d98f25df23dd9 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/availability_reporting.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/availability_reporting.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { AvailabilityReporting } from '../availability_reporting'; import { StatusTag } from '../location_status_tags'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/location_status_tags.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/location_status_tags.test.tsx index d4aae6b022d9c..72919ff3c41bf 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/location_status_tags.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/location_status_tags.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import moment from 'moment'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { MonitorLocation } from '../../../../../../common/runtime_types/monitor'; import { LocationStatusTags } from '../index'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/tag_label.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/tag_label.test.tsx index 8e46196ec3ab7..a44aa5db24867 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/tag_label.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/availability_reporting/__tests__/tag_label.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { TagLabel } from '../tag_label'; describe('TagLabel component', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/__tests__/location_availability.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/__tests__/location_availability.test.tsx index 39c487bc3e151..c3af1e30911c5 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/__tests__/location_availability.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_availability/__tests__/location_availability.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { LocationAvailability } from '../location_availability'; import { MonitorLocations } from '../../../../../../common/runtime_types'; import { LocationMissingWarning } from '../../location_map/location_missing'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_map.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_map.test.tsx index 39346ad645c00..8b8b8c4cd87f9 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_map.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_map.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { LocationMap } from '../location_map'; import { LocationPoint } from '../embeddables/embedded_map'; diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_missing.test.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_missing.test.tsx index 66e3b5952a3dc..2371034ef3288 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_missing.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/location_map/__tests__/location_missing.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { LocationMissingWarning } from '../location_missing'; describe('LocationMissingWarning component', () => { diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/browser_expanded_row.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/browser_expanded_row.test.tsx index 07c3afdf50eea..e4e4e62d754be 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/browser_expanded_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/browser_expanded_row.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { BrowserExpandedRowComponent } from '../browser_expanded_row'; import { Ping } from '../../../../../common/runtime_types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_event.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_event.test.tsx index ad905076a06cd..8146c0b2d0e78 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_event.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_event.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ConsoleEvent } from '../console_event'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_output_event_list.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_output_event_list.test.tsx index 776fd0a5fb94d..2b09d15571940 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_output_event_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/console_output_event_list.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ConsoleOutputEventList } from '../console_output_event_list'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/empty_journey.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/empty_journey.test.tsx index 0157229b3c212..793819e8b29e8 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/empty_journey.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/empty_journey.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { EmptyJourney } from '../empty_journey'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_journey.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_journey.test.tsx index 9fec9439b3ad5..d6f422b5c7094 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_journey.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_journey.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ExecutedJourney } from '../executed_journey'; import { Ping } from '../../../../../common/runtime_types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_step.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_step.test.tsx index e3a8430cfa888..fb7394c4c92c6 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_step.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/executed_step.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { ExecutedStep } from '../executed_step'; import { Ping } from '../../../../../common/runtime_types'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/status_badge.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/status_badge.test.tsx index 1171c24ad899c..72ab53cd9667b 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/status_badge.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/status_badge.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { StatusBadge } from '../status_badge'; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/step_screenshot_display.test.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/step_screenshot_display.test.tsx index 9d94514aa48c5..735e79f565797 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/step_screenshot_display.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/__tests__/step_screenshot_display.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import React from 'react'; import { StepScreenshotDisplay } from '../step_screenshot_display'; diff --git a/x-pack/plugins/uptime/public/components/overview/__tests__/parsing_error_callout.test.tsx b/x-pack/plugins/uptime/public/components/overview/__tests__/parsing_error_callout.test.tsx index 01204c33b79d5..bd52c33de2c58 100644 --- a/x-pack/plugins/uptime/public/components/overview/__tests__/parsing_error_callout.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/__tests__/parsing_error_callout.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { ParsingErrorCallout } from '../parsing_error_callout'; describe('OverviewPageParsingErrorCallout', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot.test.tsx b/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot.test.tsx index cfcab673dcb35..06114ba9d962f 100644 --- a/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { Snapshot } from '../../../../common/runtime_types'; import { SnapshotComponent } from '../snapshot/snapshot'; diff --git a/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot_heading.test.tsx b/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot_heading.test.tsx index 805c116ef538a..061bccbdfed51 100644 --- a/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot_heading.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/__tests__/snapshot_heading.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { SnapshotHeading } from '../snapshot/snapshot_heading'; diff --git a/x-pack/plugins/uptime/public/components/overview/__tests__/synthetics_callout.test.tsx b/x-pack/plugins/uptime/public/components/overview/__tests__/synthetics_callout.test.tsx index 88bae4c72b686..cf67ef70d63b9 100644 --- a/x-pack/plugins/uptime/public/components/overview/__tests__/synthetics_callout.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/__tests__/synthetics_callout.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { SyntheticsCallout } from '../synthetics_callout'; diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/add_filter_btn.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/add_filter_btn.test.tsx index ac465eca4c5e5..e8ac7cd4898ed 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/add_filter_btn.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/add_filter_btn.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { AddFilterButton } from '../add_filter_btn'; import { EuiButtonEmpty, EuiContextMenuItem } from '@elastic/eui'; diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_field_number.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_field_number.test.tsx index e2564992c76d2..669d0ae391467 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_field_number.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_field_number.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; import { AlertFieldNumber, handleAlertFieldNumberChange } from '../alert_field_number'; describe('AlertFieldNumber', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_monitor_status.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_monitor_status.test.tsx index f26da59238b20..1b742f04b0126 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_monitor_status.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/alert_monitor_status.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { AlertMonitorStatusComponent, AlertMonitorStatusProps } from '../alert_monitor_status'; describe('alert monitor status component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/old_alert_callout.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/old_alert_callout.test.tsx index 2942a5e503573..26cebba1a715e 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/old_alert_callout.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/__tests__/old_alert_callout.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { OldAlertCallOut } from '../old_alert_call_out'; describe('OldAlertCallOut', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/down_number_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/down_number_select.test.tsx index 31503252a8990..26908afa4dca2 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/down_number_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/down_number_select.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { DownNoExpressionSelect } from '../down_number_select'; describe('DownNoExpressionSelect component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/filters_expression_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/filters_expression_select.test.tsx index e41dfea82c2fb..9d57021d02702 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/filters_expression_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/filters_expression_select.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FiltersExpressionsSelect } from '../filters_expression_select'; describe('filters expression select component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/time_expression_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/time_expression_select.test.tsx index d5ac82136710e..157602f717f47 100644 --- a/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/time_expression_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/alerts/monitor_expressions/__tests__/time_expression_select.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { TimeExpressionSelect } from '../time_expression_select'; describe('TimeExpressionSelect component', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/data_or_index_missing.test.tsx b/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/data_or_index_missing.test.tsx index 333802962fd3e..37ddb34fa6c54 100644 --- a/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/data_or_index_missing.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/empty_state/__tests__/data_or_index_missing.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { FormattedMessage } from '@kbn/i18n/react'; import { DataOrIndexMissing } from '../data_or_index_missing'; diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/__tests__/filter_popover.test.tsx b/x-pack/plugins/uptime/public/components/overview/filter_group/__tests__/filter_popover.test.tsx index 7fbc9ad733b0e..465ed3bdae51a 100644 --- a/x-pack/plugins/uptime/public/components/overview/filter_group/__tests__/filter_popover.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/filter_group/__tests__/filter_popover.test.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { FilterPopoverProps, FilterPopover } from '../filter_popover'; import { UptimeFilterButton } from '../uptime_filter_button'; import { EuiFilterSelectItem } from '@elastic/eui'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_page_size_select.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_page_size_select.test.tsx index 0642712d951fe..38dc0ccbda5c4 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_page_size_select.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_page_size_select.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { MonitorListPageSizeSelectComponent } from '../monitor_list_page_size_select'; -import { mountWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl } from '@kbn/test/jest'; describe('MonitorListPageSizeSelect', () => { it('updates the state when selection changes', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx index 9696ecc2c237b..cc91f9ccc20a6 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import moment from 'moment'; -import { renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { getLocationStatus, MonitorListStatusColumn } from '../monitor_list_status_column'; import { Ping } from '../../../../../common/runtime_types'; import { STATUS } from '../../../../../common/constants'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx index df9f1febd40c3..3e7860e4e6ab4 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { MonitorSummary, makePing } from '../../../../../../common/runtime_types'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import { IntegrationGroup, extractSummaryValues } from '../actions_popover/integration_group'; describe('IntegrationGroup', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_link.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_link.test.tsx index 8ee83bc38957b..88f49f87881e0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_link.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_link.test.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { IntegrationLink } from '../actions_popover/integration_link'; -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; describe('IntegrationLink component', () => { it('renders without errors', () => { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_list.test.tsx index c0143828dc69d..da518a9f27164 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_list.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import moment from 'moment'; import { MonitorStatusList } from '../monitor_status_list'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_row.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_row.test.tsx index 0353d0197f7f7..e8c9c2d687bb3 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_row.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_status_row.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl } from '@kbn/test/jest'; import React from 'react'; import { MonitorStatusRow } from '../monitor_status_row'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/most_recent_error.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/most_recent_error.test.tsx index 173809b2d7f73..e0b4c0dbd78f7 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/most_recent_error.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/most_recent_error.test.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { shallowWithIntl, renderWithIntl } from 'test_utils/enzyme_helpers'; +import { shallowWithIntl, renderWithIntl } from '@kbn/test/jest'; import React from 'react'; import moment from 'moment'; import { BrowserRouter as Router } from 'react-router-dom'; diff --git a/x-pack/plugins/uptime/public/lib/helper/helper_with_router.tsx b/x-pack/plugins/uptime/public/lib/helper/helper_with_router.tsx index 5219fb3242539..132552ef61a69 100644 --- a/x-pack/plugins/uptime/public/lib/helper/helper_with_router.tsx +++ b/x-pack/plugins/uptime/public/lib/helper/helper_with_router.tsx @@ -9,7 +9,7 @@ import React, { ReactElement } from 'react'; import { Router } from 'react-router-dom'; import { MemoryHistory } from 'history/createMemoryHistory'; import { createMemoryHistory } from 'history'; -import { mountWithIntl, renderWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; +import { mountWithIntl, renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; import { AppState } from '../../state'; import { MountWithReduxProvider } from './helper_with_redux'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts index 7c5ec0917494a..a39affd7c37c3 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts @@ -10,7 +10,7 @@ import { setup as watchCreateJsonSetup } from './watch_create_json.helpers'; import { setup as watchCreateThresholdSetup } from './watch_create_threshold.helpers'; import { setup as watchEditSetup } from './watch_edit.helpers'; -export { nextTick, getRandomString, findTestSubject, TestBed } from '../../../../../test_utils'; +export { nextTick, getRandomString, findTestSubject, TestBed } from '@kbn/test/jest'; export { wrapBodyResponse, unwrapBodyResponse } from './body_response'; export { setupEnvironment } from './setup_environment'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts index caef4b378cf0a..2134268b096f2 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts @@ -3,8 +3,8 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { withAppContext } from './app_context.mock'; -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts index c76f31e744f8d..5d41fe5c53aac 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES, WATCH_TYPES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts index 5e6dbd0a40bfb..ca9fcdbebd490 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; +import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit'; import { registerRouter } from '../../../public/application/lib/navigation'; import { ROUTES } from '../../../common/constants'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts index ca5d962e4dd21..f5a9adc95f43c 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts @@ -6,13 +6,7 @@ import { act } from 'react-dom/test-utils'; -import { - registerTestBed, - findTestSubject, - TestBed, - TestBedConfig, - nextTick, -} from '../../../../../test_utils'; +import { registerTestBed, findTestSubject, TestBed, TestBedConfig, nextTick } from '@kbn/test/jest'; import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list'; import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants'; import { withAppContext } from './app_context.mock'; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts index b869e55aa3464..803b65ca8fff6 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts @@ -6,13 +6,7 @@ import { act } from 'react-dom/test-utils'; -import { - registerTestBed, - findTestSubject, - TestBed, - TestBedConfig, - nextTick, -} from '../../../../../test_utils'; +import { registerTestBed, findTestSubject, TestBed, TestBedConfig, delay } from '@kbn/test/jest'; import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status'; import { ROUTES } from '../../../common/constants'; import { WATCH_ID } from './constants'; @@ -94,7 +88,7 @@ export const setup = async (): Promise => { await act(async () => { button.simulate('click'); - await nextTick(100); + await delay(100); component.update(); }); }; diff --git a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts index c35bbcb171a30..b22074e4060eb 100644 --- a/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts +++ b/x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts @@ -12,7 +12,7 @@ import { WatchEditTestBed } from './helpers/watch_edit.helpers'; import { WATCH } from './helpers/constants'; import defaultWatchJson from '../../public/application/models/watch/default_watch.json'; import { getWatch } from '../../test/fixtures'; -import { getRandomString } from '../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); diff --git a/x-pack/plugins/watcher/test/fixtures/watch.ts b/x-pack/plugins/watcher/test/fixtures/watch.ts index 3342ebc149770..74e071c4c1327 100644 --- a/x-pack/plugins/watcher/test/fixtures/watch.ts +++ b/x-pack/plugins/watcher/test/fixtures/watch.ts @@ -5,7 +5,7 @@ */ import { Moment } from 'moment'; -import { getRandomString } from '../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; interface Watch { id: string; diff --git a/x-pack/plugins/watcher/test/fixtures/watch_history.ts b/x-pack/plugins/watcher/test/fixtures/watch_history.ts index b8f725aa84a18..7db4c64967de0 100644 --- a/x-pack/plugins/watcher/test/fixtures/watch_history.ts +++ b/x-pack/plugins/watcher/test/fixtures/watch_history.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { getRandomString } from '../../../../test_utils'; +import { getRandomString } from '@kbn/test/jest'; interface WatchHistory { startTime: string; diff --git a/x-pack/test_utils/README.md b/x-pack/test_utils/README.md index a6ca1a5d86866..ee36f13e2f6d0 100644 --- a/x-pack/test_utils/README.md +++ b/x-pack/test_utils/README.md @@ -28,7 +28,7 @@ You receive in return a function that you need to call to mount the component in ```ts // remote_clusters_list.helpers.ts -import { registerTestBed } from '../../../../test_utils'; +import { registerTestBed } from '@kbn/test/jest'; import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; import { remoteClustersStore } from '../../app/store'; import routing from '../../app/services/routing'; diff --git a/x-pack/test_utils/find_test_subject.ts b/x-pack/test_utils/find_test_subject.ts deleted file mode 100644 index 6cfe38e991646..0000000000000 --- a/x-pack/test_utils/find_test_subject.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { ReactWrapper } from 'enzyme'; - -type Matcher = '=' | '~=' | '|=' | '^=' | '$=' | '*='; - -const MATCHERS: Matcher[] = [ - '=', // Exact match - '~=', // Exists in a space-separated list - '|=', // Begins with substring, followed by '-' - '^=', // Begins with substring - '$=', // Ends with substring - '*=', -]; - -/** - * Find node which matches a specific test subject selector. Returns ReactWrappers around DOM element, - * https://github.com/airbnb/enzyme/tree/master/docs/api/ReactWrapper. - * Common use cases include calling simulate or getDOMNode on the returned ReactWrapper. - * - * The ~= matcher looks for the value in space-separated list, allowing support for multiple data-test-subj - * values on a single element. See https://www.w3.org/TR/selectors-3/#attribute-selectors for more - * info on the other possible matchers. - * - * @param reactWrapper The React wrapper to search in - * @param testSubjectSelector The data test subject selector - * @param matcher optional matcher - */ -export const findTestSubject = ( - reactWrapper: ReactWrapper, - testSubjectSelector: T, - matcher: Matcher = '~=' -) => { - if (!MATCHERS.includes(matcher)) { - throw new Error( - 'Matcher ' - .concat(matcher, ' not found in list of allowed matchers: ') - .concat(MATCHERS.join(' ')) - ); - } - - const testSubject = reactWrapper.find(`[data-test-subj${matcher}"${testSubjectSelector}"]`); - // Restores Enzyme 2's find behavior, which was to only return ReactWrappers around DOM elements. - // Enzyme 3 returns ReactWrappers around both DOM elements and React components. - // https://github.com/airbnb/enzyme/issues/1174 - - return testSubject.hostNodes(); -}; diff --git a/x-pack/test_utils/index.ts b/x-pack/test_utils/index.ts index 57c96dfccc05c..5d0042bdaef14 100644 --- a/x-pack/test_utils/index.ts +++ b/x-pack/test_utils/index.ts @@ -4,7 +4,5 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './testbed'; export * from './lib'; -export { findTestSubject } from './find_test_subject'; export { getConfigSchema } from './get_config_schema'; diff --git a/x-pack/test_utils/jest/config.integration.js b/x-pack/test_utils/jest/config.integration.js index 16e05ea46e308..4ec1711eb6fca 100644 --- a/x-pack/test_utils/jest/config.integration.js +++ b/x-pack/test_utils/jest/config.integration.js @@ -24,5 +24,5 @@ export default { { reportName: 'Jest Integration Tests' }, ], ], - setupFilesAfterEnv: ['/../src/dev/jest/setup/after_env.integration.js'], + setupFilesAfterEnv: ['/../packages/kbn-test/target/jest/setup/after_env.integration.js'], }; diff --git a/x-pack/test_utils/jest/config.js b/x-pack/test_utils/jest/config.js index fcd50717d3441..7d4f6b713da27 100644 --- a/x-pack/test_utils/jest/config.js +++ b/x-pack/test_utils/jest/config.js @@ -18,13 +18,13 @@ export default { collectCoverageFrom: ['legacy/plugins/**/*.js', 'legacy/common/**/*.js', 'legacy/server/**/*.js'], moduleNameMapper: { '\\.(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', + '/packages/kbn-test/target/jest/mocks/file_mock.js', + '\\.(css|less|scss)$': '/../packages/kbn-test/target/jest/mocks/style_mock.js', }, setupFiles: [ - '/../src/dev/jest/setup/babel_polyfill.js', - '/../src/dev/jest/setup/polyfills.js', - '/../src/dev/jest/setup/enzyme.js', + '/../packages/kbn-test/target/jest/setup/babel_polyfill.js', + '/../packages/kbn-test/target/jest/setup/polyfills.js', + '/../packages/kbn-test/target/jest/setup/enzyme.js', ], coverageDirectory: '/../target/kibana-coverage/jest', coverageReporters: ['html'], @@ -39,7 +39,7 @@ export default { ], testRunner: 'jest-circus/runner', transform: { - '^.+\\.(js|tsx?)$': '/../src/dev/jest/babel_transform.js', + '^.+\\.(js|tsx?)$': '/../packages/kbn-test/target/jest/babel_transform.js', '^.+\\.txt?$': 'jest-raw-loader', '^.+\\.html?$': 'jest-raw-loader', }, diff --git a/x-pack/test_utils/redux_helpers.tsx b/x-pack/test_utils/redux_helpers.tsx deleted file mode 100644 index d67c7b02148b5..0000000000000 --- a/x-pack/test_utils/redux_helpers.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { ComponentType } from 'react'; -import { Provider } from 'react-redux'; - -export const WithStore = (store: any) => (WrappedComponent: ComponentType) => (props: any) => ( - - - -); diff --git a/x-pack/test_utils/router_helpers.tsx b/x-pack/test_utils/router_helpers.tsx deleted file mode 100644 index f2099e1eb7c91..0000000000000 --- a/x-pack/test_utils/router_helpers.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { Component, ComponentType } from 'react'; -import { MemoryRouter, Route, withRouter } from 'react-router-dom'; -import * as H from 'history'; - -export const WithMemoryRouter = (initialEntries: string[] = ['/'], initialIndex: number = 0) => ( - WrappedComponent: ComponentType -) => (props: any) => ( - - - -); - -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( - class extends Component { - componentDidMount() { - const { match, location, history } = this.props; - const router = { route: { match, location }, history }; - onRouter(router); - } - - render() { - return ; - } - } - ); - - return (props: any) => ( - } - /> - ); -}; - -interface Router { - history: Partial; - route: { - location: H.Location; - }; -} - -export const reactRouterMock: Router = { - history: { - push: () => {}, - createHref: (location) => location.pathname!, - location: { - pathname: '', - search: '', - state: '', - hash: '', - }, - }, - route: { - location: { - pathname: '', - search: '', - state: '', - hash: '', - }, - }, -}; diff --git a/x-pack/test_utils/stub_web_worker.ts b/x-pack/test_utils/stub_web_worker.ts deleted file mode 100644 index 10d0ee6517384..0000000000000 --- a/x-pack/test_utils/stub_web_worker.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -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/x-pack/test_utils/testbed/index.ts b/x-pack/test_utils/testbed/index.ts deleted file mode 100644 index 70b055afd254d..0000000000000 --- a/x-pack/test_utils/testbed/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { registerTestBed } from './testbed'; -export { TestBed, TestBedConfig, SetupFunc, UnwrapPromise } from './types'; diff --git a/x-pack/test_utils/testbed/mount_component.tsx b/x-pack/test_utils/testbed/mount_component.tsx deleted file mode 100644 index 7b166684bc7ef..0000000000000 --- a/x-pack/test_utils/testbed/mount_component.tsx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { ComponentType } from 'react'; -import { Store } from 'redux'; -import { ReactWrapper } from 'enzyme'; -import { act } from 'react-dom/test-utils'; - -import { mountWithIntl } from '../enzyme_helpers'; -import { WithMemoryRouter, WithRoute } from '../router_helpers'; -import { WithStore } from '../redux_helpers'; -import { MemoryRouterConfig } from './types'; - -interface Config { - Component: ComponentType; - memoryRouter: MemoryRouterConfig; - store: Store | null; - props: any; - onRouter: (router: any) => void; -} - -const getCompFromConfig = ({ Component, memoryRouter, store, onRouter }: Config): ComponentType => { - const wrapWithRouter = memoryRouter.wrapComponent !== false; - - let Comp: ComponentType = store !== null ? WithStore(store)(Component) : Component; - - if (wrapWithRouter) { - const { componentRoutePath, initialEntries, initialIndex } = memoryRouter!; - - // Wrap the componenet with a MemoryRouter and attach it to a react-router - Comp = WithMemoryRouter( - initialEntries, - initialIndex - )(WithRoute(componentRoutePath, onRouter)(Comp)); - } - - return Comp; -}; - -export const mountComponentSync = (config: Config): ReactWrapper => { - const Comp = getCompFromConfig(config); - return mountWithIntl(); -}; - -export const mountComponentAsync = async (config: Config): Promise => { - const Comp = getCompFromConfig(config); - - let component: ReactWrapper; - - await act(async () => { - component = mountWithIntl(); - }); - - // @ts-ignore - return component.update(); -}; - -export const getJSXComponentWithProps = (Component: ComponentType, props: any) => ( - -); diff --git a/x-pack/test_utils/testbed/types.ts b/x-pack/test_utils/testbed/types.ts deleted file mode 100644 index e2b6693ce77aa..0000000000000 --- a/x-pack/test_utils/testbed/types.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Store } from 'redux'; -import { ReactWrapper } from 'enzyme'; - -export type SetupFunc = (props?: any) => TestBed | Promise>; - -export interface EuiTableMetaData { - /** Array of rows of the table. Each row exposes its reactWrapper and its columns */ - rows: Array<{ - reactWrapper: ReactWrapper; - columns: Array<{ - reactWrapper: ReactWrapper; - value: string; - }>; - }>; - /** A 2 dimensional array of rows & columns containing - * the text content of each cell of the table */ - tableCellsValues: string[][]; -} - -export interface TestBed { - /** The comonent under test */ - component: ReactWrapper; - /** - * Pass it a `data-test-subj` and it will return true if it exists or false if it does not exist. - * - * @param testSubject The data test subject to look for (can be a nested path. e.g. "detailPanel.mySection"). - * @param count The number of times the subject needs to appear in order to return "true" - */ - exists: (testSubject: T, count?: number) => boolean; - /** - * Pass it a `data-test-subj` and it will return an Enzyme reactWrapper of the node. - * You can target a nested test subject by separating it with a dot ('.'); - * - * @param testSubject The data test subject to look for - * - * @example - * - ```typescript - find('nameInput'); - // or more specific, - // "nameInput" is a child of "myForm" - find('myForm.nameInput'); - ``` - */ - find: (testSubject: T, reactWrapper?: ReactWrapper) => ReactWrapper; - /** - * Update the props of the mounted component - * - * @param updatedProps The updated prop object - */ - setProps: (updatedProps: any) => void; - /** - * Helper to wait until an element appears in the DOM as hooks updates cycles are tricky. - * Useful when loading a component that fetches a resource from the server - * 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. - * - * In some cases, changing an input value triggers an HTTP request to validate - * the field. Even if we return immediately the response on the mock server we - * still need to wait until the next tick before the DOM updates. - * Setting isAsync to "true" takes care of that. - * - * @param input The form input. Can either be a data-test-subj or a reactWrapper (can be a nested path. e.g. "myForm.myInput"). - * @param value The value to set - * @param isAsync If set to true will return a Promise that resolves on the next "tick" - */ - setInputValue: ( - input: T | ReactWrapper, - value: string, - isAsync?: boolean - ) => Promise | void; - /** - * Set the value of a or a mocked - * For the you need to mock it like this - * - ```typescript - jest.mock('@elastic/eui', () => { - const original = jest.requireActual('@elastic/eui'); - - return { - ...original, - EuiSuperSelect: (props: any) => ( - { - props.onChange(e.target.value); - }} - /> - ), - }; - }); - ``` - * @param select The form select. Can either be a data-test-subj or a reactWrapper (can be a nested path. e.g. "myForm.myInput"). - * @param value The value to set - * @param doUpdateComponent Call component.update() after changing the select value - */ - setSelectValue: (select: T | ReactWrapper, value: string, doUpdateComponent?: boolean) => void; - /** - * Select or unselect a form checkbox. - * - * @param dataTestSubject The test subject of the checkbox (can be a nested path. e.g. "myForm.mySelect"). - * @param isChecked Defines if the checkobx is active or not - */ - selectCheckBox: (checkboxTestSubject: T, isChecked?: boolean) => void; - /** - * Toggle the EuiSwitch - * - * @param switchTestSubject The test subject of the EuiSwitch (can be a nested path. e.g. "myForm.mySwitch"). - */ - toggleEuiSwitch: (switchTestSubject: T, isChecked?: boolean) => void; - /** - * The EUI ComboBox is a special input as it needs the ENTER key to be pressed - * in order to register the value set. This helpers automatically does that. - * - * @param comboBoxTestSubject The data test subject of the EuiComboBox (can be a nested path. e.g. "myForm.myComboBox"). - * @param value The value to set - */ - setComboBoxValue: (comboBoxTestSubject: T, value: string) => void; - /** - * Get a list of the form error messages that are visible in the DOM. - */ - getErrorsMessages: () => string[]; - }; - table: { - getMetaData: (tableTestSubject: T) => EuiTableMetaData; - }; - router: { - /** - * Navigate to another React router - */ - navigateTo: (url: string) => void; - }; -} - -export interface TestBedConfig { - /** The default props to pass to the mounted component. */ - defaultProps?: Record; - /** Configuration object for the react-router `MemoryRouter. */ - memoryRouter?: MemoryRouterConfig; - /** An optional redux store. You can also provide a function that returns a store. */ - store?: (() => Store) | Store | null; - /* Mount the component asynchronously. When using "hooked" components with _useEffect()_ calls, you need to set this to "true". */ - doMountAsync?: boolean; -} - -export interface MemoryRouterConfig { - /** Flag to add or not the `MemoryRouter`. If set to `false`, there won't be any router and the component won't be wrapped on a ``. */ - wrapComponent?: boolean; - /** The React Router **initial entries** setting ([see documentation](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/MemoryRouter.md)) */ - initialEntries?: string[]; - /** 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 | string[]; - /** A callBack that will be called with the React Router instance once mounted */ - onRouter?: (router: any) => void; -} - -/** - * Utility type: extracts returned type from a Promise. - */ -export type UnwrapPromise = T extends Promise ? P : T; From cee11cce0f5bf94d0404be01f19383b27bad4023 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Wed, 11 Nov 2020 21:43:02 -0800 Subject: [PATCH 2/5] Removes rest of x-pack/test_utils Signed-off-by: Tyler Smalley --- x-pack/test_utils/README.md | 332 ------------------ .../test_subjects_finder/background.js | 27 -- .../test_subjects_finder/images/kibana128.png | Bin 2658 -> 0 bytes .../test_subjects_finder/images/kibana16.png | Bin 2658 -> 0 bytes .../test_subjects_finder/images/kibana32.png | Bin 2658 -> 0 bytes .../test_subjects_finder/images/kibana48.png | Bin 2658 -> 0 bytes .../test_subjects_finder/images/kibana64.png | Bin 2658 -> 0 bytes .../test_subjects_finder/manifest.json | 26 -- .../test_subjects_finder/popup.html | 49 --- .../test_subjects_finder/popup.js | 104 ------ .../start_tracking_test_subjects.js | 164 --------- .../stop_tracking_test_subjects.js | 11 - .../test_subjects_finder/style.css | 110 ------ x-pack/test_utils/get_config_schema.ts | 17 - x-pack/test_utils/index.ts | 8 - x-pack/test_utils/jest/config.integration.js | 28 -- x-pack/test_utils/jest/config.js | 49 --- x-pack/test_utils/kbn_server_config.ts | 34 -- x-pack/test_utils/lib/index.ts | 7 - x-pack/test_utils/lib/utils.ts | 18 - 20 files changed, 984 deletions(-) delete mode 100644 x-pack/test_utils/README.md delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/background.js delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana128.png delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana16.png delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana32.png delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana48.png delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana64.png delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/manifest.json delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/popup.html delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/popup.js delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/start_tracking_test_subjects.js delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/stop_tracking_test_subjects.js delete mode 100644 x-pack/test_utils/chrome_extension/test_subjects_finder/style.css delete mode 100644 x-pack/test_utils/get_config_schema.ts delete mode 100644 x-pack/test_utils/index.ts delete mode 100644 x-pack/test_utils/jest/config.integration.js delete mode 100644 x-pack/test_utils/jest/config.js delete mode 100644 x-pack/test_utils/kbn_server_config.ts delete mode 100644 x-pack/test_utils/lib/index.ts delete mode 100644 x-pack/test_utils/lib/utils.ts diff --git a/x-pack/test_utils/README.md b/x-pack/test_utils/README.md deleted file mode 100644 index ee36f13e2f6d0..0000000000000 --- a/x-pack/test_utils/README.md +++ /dev/null @@ -1,332 +0,0 @@ -# Testbed utils - -The Testbed is a small library to help testing React components. It is most useful when testing application "sections" (or pages) in **integration** -than when unit testing single components in isolation. - -## Motivation - -The Elasticsearch UI team built this to support client-side integration testing. When testing complete "pages" we get to test -our application in a way that is closer to how a user would interact with it in a browser. It also gives us more confidence in -our tests and avoids testing implementation details. - -We test everything up to the HTTP Requests made from the client to the Node.js API server. Those requests need to be mocked. This means that with a good -**API integration test** coverage of those endpoints, we can reduce the functional tests to a minimum. - -With this in mind, we needed a way to easily mount a component on a React Router `` (this component could possibily have _child_ routes and -need access to the browser URL parameters and query params). In order to solve that, the Testbed wraps the component around a `MemoryRouter`. - -On the other side, the majority of our current applications use Redux as state management so we needed a simple way to wrap our component under test -inside a redux store provider. - -## How to use it - -At the top of your test file (you only need to declare it once), register a new Testbed by providing a React Component and an optional configuration object. -You receive in return a function that you need to call to mount the component in your test. - -**Example 1** - -```ts -// remote_clusters_list.helpers.ts - -import { registerTestBed } from '@kbn/test/jest'; -import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; -import { remoteClustersStore } from '../../app/store'; -import routing from '../../app/services/routing'; - -const config = { - memoryRouter: { - onRouter(router) { - routing.registerRouter(router); // send the router instance to the routing service - }, - initialEntries: ['/some-resource-name'], // the Router initial URL - componentRoutePath: '/:name' // the Component path - }, - store: remoteClusterStore -}; - -export const setup = registerTestBed(RemoteClusterList, config); -``` - -Once you have registered a TestBed, you can call the `setup()` function to mount the component in your tests. You will get an object -back with a set of utility methods to test the component (refer to the documentation below for a complete list of the methods available). - -```ts -// remote_cluster.test.ts - -import { setup } from './remote_clusters_list.helpers.ts'; - -describe('', () => { - test('it should have a table with 3 rows', () => { - const { component, exists, find } = setup(); - - // component is an Enzyme reactWrapper - console.log(component.debug()); - - expect(exists('remoteClusterTable')).toBe(true); - expect(find('remoteClusterTable.row').length).toBe(3); - }); -}); -``` - -## Test subjects - -The Testbed utils are meant to be used with test subjects. Test subjects are elements that are tagged specifically for selecting from tests. Use test subjects over CSS selectors when possible. - -```html -
-
-``` - -```ts -find('containerButton').simulate('click'); -``` - -If you need to access a CSS selector, target first the closest test subject. - -```ts -const text = find('containerButton').find('.link--active').text(); -``` - -## Typescript - -If you use Typescript, you can provide a string union type for your test subjects and you will get **autocomplete** on the test subjects in your test. To automate finding all the subjects on the page, use the Chrome extension below. - -```ts -type TestSubjects = 'indicesTable' | 'createIndexButton' | 'pageTitle'; - -export const setup = registerTestBed(MyComponent); -``` - -## Best practices - -In order to prevent flakiness in component integration tests, please consider the following best practices: - -- **Use** `jest.useFakeTimers()`. - - The code under a test might be using `setTimeout()` calls. This is bad for deterministic tests. In order to avoid it, we need to use mocked timers from jest. For that we declare at the top of each component integration test the following: -​ - ```js - beforeAll(() => { - jest.useFakeTimers(); - }); - ​ - afterAll(() => { - jest.useRealTimers(); - }); - ``` - -- **Do not use** using `nextTick()`, `waitFor`, or `waitForFunc` helpers in tests. These helpers use `setTimeout` underneath and add latency in the tests, especially on CI where a timeout (even of a few ms) can trigger a timeout error. These helpers will eventually be deprecated once existing tests has been updated. - -- **Do not declare** `component.update()` inside `act()`. Each `act()` call should contain a chunk of actions that updates the internal state(s). The `component.update()` that re-renders the internal DOM needs to be called outside, before asserting against the updated DOM. - -- Be **synchronous** as much as possible. -​ - Hooks are delicate when it comes to state updates. Sometimes calling `act()` synchronously works, sometimes it doesn't. The reasoning behind this isn't clear yet. The best approach is to try synchronously first and if it fails, because of an `act()` error, then use the async version. - - ```js - // First try this - act(() => { - find('someTestSubject').simulate('click'); - }); - component.update(); - ​ - // If there is a "missing `act()` error", then change it to - await act(async () => { - find('someTestSubject').simulate('click'); - }); - component.update(); - ``` - -## Chrome extension - -There is a small Chrome extension that you can install in order to track the test subjects on the current page. As it is meant to be used -during development, the extension is only active when navigating to a `localhost` URL. - -You will find the "Test subjects finder" extension in the `x-pack/test_utils/chrome_extension` folder. - -### Install the extension - -- open the "extensions" window in Chrome -- activate the "Developer mode" (top right corner) -- drag and drop the `test_subjects_finder` folder on the window. - -You can specify a DOM node (the tree "root") from which the test subjects will be found. If you don't specify any, the document `` will be used. The output format can either be `Typescript` (to export a string union type) or `List`. - -### Output - -Once you start tracking the test subjects on the page, the output will be printed in the **Chrome dev console**. - -## API - -## `registerTestBed(Component [, testBedConfig])` - -Instantiate a new TestBed to test a React component. The arguments it receives are - -- `Component` (the React component to test) -- `testBedConfig` (optional). An optional Testbed configuration object. - -**@returns** A function to instantiate and mount the component. - -### `testBedConfig` - -The `testBedConfig` has the following properties (all **optional**) - -- `defaultProps` The default props to pass to the mounted component. Those props can be overriden when calling the `setup([props])` callback -- `memoryRouter` Configuration object for the react-router `MemoryRouter` with the following properties - - `wrapComponent` Flag to provide or not a `MemoryRouter`. If set to `false`, there won't be any router and the component won't be added on a ``. (default: `true`) - - `initialEntries` The React Router **initial entries** setting. (default: `['/']`. [see doc](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/MemoryRouter.md)) - - `initialIndex` The React Router **initial index** setting (default: `0`) - - `componentRoutePath` The route **path** for the mounted component (default: `"/"`) - - `onRouter` A callback that will be called with the React Router instance when the component is mounted -- `store` A redux store. You can also provide a function that returns a store. (default: `null`) - - -## `setup([props])` - -When registering a Testbed, you receive in return a setup function. This function accepts one optional argument: - -- `props` (optional) Props to pass to the mounted component. - -```js -describe('', () => { - test('it should be green', () => { - // Will mount - const { component } = setup({ color: 'green' }); - ... - }); -}); -``` - -**@returns** An object with the following **properties** and **helpers** for testing - -#### `component` - -The mounted component. It is an enzyme **reactWrapper**. - -#### `exists(testSubject)` - -Pass it a `data-test-subj` and it will return true if it exists or false if it does not exist. You can provide a nested path to access the -test subject by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). - -```js -const { exists } = setup(); -expect(exists('myTestSubject')).toBe(true); -``` - -#### `find(testDataSubject)` - -Pass it a `data-test-subj` and it will return an Enzyme reactWrapper of the node. You can provide a nested path to access the -test subject by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). - -```js -const { find } = setup(); - -const someNode = find('myTestSubject'); -expect(someNode.text()).toBe('hello'); -``` - -#### `setProps(props)` - -Update the props passed to a component. - -**Important**: This method can only be used on a Component that is _not_ wrapped by a ``. - -```js -... - -const { setup } = registerTestBed(RemoteClusterList); - -describe('', () => { - - test('it should work', () => { - const { exists, find, setProps } = setup(); - // test logic... - - // update the props of the component - setProps({ color: 'yellow' }); - ... - }); -}); -``` - -#### `table` - -An object with the following methods: - -##### `getMetaData(testSubject)` - -Parse an EUI table and return metadata information about its rows and columns. You can provide a nested path to access the -test subject by separating the parent and child with a dot (e.g. `mySection.myTable`). It returns an object with two properties: - -- `tableCellsValues` a two dimensional array of rows + columns with the text content of each cell of the table -- `rows` an array of row objects. A row object has the following two properties: - - `reactWrapper` the Enzyme react wrapper of the `tr` element. - - `columns` an array of columns objects. A column object has two properties: - - `reactWrapper` the Enzyme react wrapper for the table row `td` - - `value` the text content of the table cell - -```html - - - - - - - - - -
Row 0, column 0Row 0, column 1
Row 1, column 0Row 1, column 1
-``` - -```js -const { table: { getMetaData } } = setup(); -const { tableCellsValues } = getMetaData('myTable'); - -expect(tableCellsValues).toEqual([ - ['Row 0, column 0'], ['Row 0, column 1'], - ['Row 1, column 0'], ['Row 1, column 1'], -]); -``` - -#### `form` - -An object with the following methods: - -##### `setInputValue(input, value, isAsync)` - -Set the value of a form input. The input can either be a test subject (a string) or an Enzyme react wrapper. If you specify a test subject, -you can provide a nested path to access it by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). - -`isAsync`: flag that will return a Promise that resolves on the next "tick". This is useful if updating the input triggers -an async operation (like a HTTP request) and we need it to resolve so the DOM gets updated (default: `false`). - -```js -await form.setInputValue('myInput', 'some value', true); -``` - -##### `selectCheckBox(testSubject)` - -Select a form checkbox. - -##### `toggleEuiSwitch(testSubject)` - -Toggle an Eui Switch. - -##### `setComboBoxValue(testSubject, value)` - -The EUI `` component is special in the sense that it needs the keyboard ENTER key to be pressed -in order to register the value provided. This helper takes care of that. - -##### `getErrorsMessages()` - -Find all the DOM nodes with the `.euiFormErrorText` css class from EUI and return an Array with its text content. - -#### `router` - -An object with the following methods: - -##### `navigateTo(url)` - -If you need to navigate to a different route inside your test and you are not using the `` component from `react-router` -in your component, you need to use the `router.navigateTo()` method from the testBed in order to trigger the route change on the `MemoryRouter`. diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/background.js b/x-pack/test_utils/chrome_extension/test_subjects_finder/background.js deleted file mode 100644 index c57ba4458e646..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/background.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -/* eslint-disable no-undef */ -chrome.runtime.onInstalled.addListener(function () { - chrome.storage.sync.set({ outputType: 'typescript' }); - - chrome.declarativeContent.onPageChanged.removeRules(undefined, () => { - // Only activate the plugin on localhost - chrome.declarativeContent.onPageChanged.addRules([ - { - conditions: [ - new chrome.declarativeContent.PageStateMatcher({ - pageUrl: { hostEquals: 'localhost' }, - }), - new chrome.declarativeContent.PageStateMatcher({ - pageUrl: { hostEquals: 'kibana-dev' }, - }), - ], - actions: [new chrome.declarativeContent.ShowPageAction()], - }, - ]); - }); -}); diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana128.png b/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana128.png deleted file mode 100644 index d88ec6d8b4e4284637f718e417ec23e4e17843fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2658 zcmV-o3Z3A|#Y-T-M8%V9kM5B1gt@8OK*4Zu+?R~XvaT^qdBz_5N4djsTZGt&)2!0&s;-m%Dx z-Z`EQ`Bt?z09Uz;aYS^a({wJnq;}UoB%^o(NYu*+OGIPsE!@zxYv{0a1aAPTg6{FB z(ZZ^p`rwF0Yi|Gz6&-Sz7VhY-5AM)v=?$QzqyruTZSAcMZP9Gy4WOx}MJ@t8+FKji zsNKRFKwD88d_)JjPaN$tqgy7l>AeB86;S1N6jix=*^`*n3{0NwyLRMp}n9K(cJ z-1E$)KWkB*&*KeXOIaZ=f&N=Dm7sfg({F`TbHcp=Y^uxV=0&@lcHRIS)huJU(Jp5! zZvc*JHZepG_e4X3He0-%+Z(`@(uw-ep6;=ut8DzaH(PsefJ7T(zi2AjMaK=McGn5} z-QMcp4d7DkS$b(jyPTzX18`JR#ArsloUyzCII8JkRHI$aSl$2})s!&W(Jp5!Zvc*J z8W_S4dZNJxG^ivT-T)Hy*jU*~UUu6VfZhO_Y9`^DigqswBqw>3v`Jdy4UkkRl{&l8 zE@wn<0FG)LjDu*GGnO|1N41m~SJ7_Dv8Kws0XV9q#1NTvY2VsS*@9i}4ZxNz8PLW_ z-ejGVRe1v>(}`7O>m)C0m{~yH0Get}<8mMEa+cx^z)|f2n5?2*&QiPqII7Ko$uipI zEX5muquMN(tfO7dQoI2;s?CU@7FuSd)?2%3V_ksA8$d~EmnV6ZM)v;*(h^c~Nt4zL zTps@f;3{_xm!D{tvlMRtj%sHyIg55VOYsKas5XVkU$o0viZ=j9wVXz~oTYdJq*v{< zF{aP0l=F(b0WP3gk)mC10FDB4VF<@MOviQ73z@aY(&Y0`fLYYc^GRNB08IsEPiGQXrrb2B+y^V$Gqi*~&MQYcWyXg9_3&y~*0 zCqP-FU2lLS3RwL9oh0q^Rx{6@0OdHzt7)S7V}KH!q~3^+S6SdTxnp4C44iw8Nkk2u|#{(Ng-}r>+~yLSZkRB zR7wMgPx3Z)T@Oq?3u8Lx7Mxx|t8F=MTJu-!jd8_SIs=F=Y1$iIjTRjQOi!{+pyQ}i z)?n$t^U3P-RaGhjh@;&-PreJ4ju&C@!BpEsI0=~b=pU%1!sVd2Oa_oeyN3>SVC*%lkSe;jyu-FEWp5z^^twIZR7*kQ!_5XBc zBZ7fP?QrX`7T5s7Xt!Cv7HGwP?k&)fat0Qn7JysOUmdpALr7dq14yIY{lo9YDf1GH zxm>7U68HoRRk5u4Op;>PHH9;PINIGm+=bJXg8)9}Ol+c4s8p6?*}y($Jrg!6m;r>* zZY)YOY5)il>Z4aicoQ&7&_D2^9;uwESO#d(=AQb{_u0#CMvnpb5*sfEzKY4#C$N0& zQ8|?kLtzXcKFQmRz71fDj%)%JqL*R1u164z3s}^k1u=l|lBUtx29VjIrka$9P(y#X zR!XCR&%FV}(e7xy57Zg~OoxVGdK|PFL6!gGOlgo@8$cZGHioYODhFY(P)RRMn)uJd z&tX~h1x?blT)8!XINE(~_hmSF>LnPwFRdsJ>;I04i>}3r6>m7~IjvP*4IqnlpMQJ- z#uw~^!KbqlHhEvFBdCVS>vb#hX@C}ndg_DQSxY4{Xx8g6Sk1y`0x}yA4E!>S*10o) z_#|(m_Are3Y8GO$d&bAj+uN_klGU%VIheql89*5AHlq7ru#Krj*05a&!U5Mq4M_!wFIo?;Llvo)wQ1Bj#D_!u`){O;Z*w#3LO?=}SC{kCRvVu1K0Z~G(` zb?q8D%v#7)w0rVpN5{BXBU%KFW3qLnt#gD93?MwodnmdXC+GlRK5kLuyi@-aL3p=~ zA*~xgd`VLy+6{x1HWptf&K9n~P2myknXMW?9PPgShA!=u7mv@%8^;z6AdGfrzoDym zTcO$&{Bn!hM=bF1>h@{Z zu!+BaC-DtkY8n)YXg`9mPjg^Z1Bg%Zjy(MlR3_tN(!H9CEEQJ;AH~w}Pg-lzG=S_R zFZYHnEhP%Wqk9LDngK-7uKb3s!fc;-(D(qU>ADm_Fd^pB_$4d;9l%Gs8e5Tq!_aM5 zR{eDf#H^*_C&0g}KYOINHnfpFOf&i+fN!wz^AormLHK!%rHc(98p75MU812104AD5 zC-rJvRGpmxtl!X8fQ=N5NOvNr#@}Ti`eb7O7dLc?WGMt#^Q!cLr!S+d(HrV9XN9z#cnI0r5EjhX%;} zhOY8?hv*OJuZr$FbYp-hh;ya-1~~k9Cth1H3gEMxfjow#zz~9vb*a|>0Ls(gy?f>t QoB#j-07*qoM6N<$f>`+azyJUM diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana16.png b/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana16.png deleted file mode 100644 index d88ec6d8b4e4284637f718e417ec23e4e17843fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2658 zcmV-o3Z3A|#Y-T-M8%V9kM5B1gt@8OK*4Zu+?R~XvaT^qdBz_5N4djsTZGt&)2!0&s;-m%Dx z-Z`EQ`Bt?z09Uz;aYS^a({wJnq;}UoB%^o(NYu*+OGIPsE!@zxYv{0a1aAPTg6{FB z(ZZ^p`rwF0Yi|Gz6&-Sz7VhY-5AM)v=?$QzqyruTZSAcMZP9Gy4WOx}MJ@t8+FKji zsNKRFKwD88d_)JjPaN$tqgy7l>AeB86;S1N6jix=*^`*n3{0NwyLRMp}n9K(cJ z-1E$)KWkB*&*KeXOIaZ=f&N=Dm7sfg({F`TbHcp=Y^uxV=0&@lcHRIS)huJU(Jp5! zZvc*JHZepG_e4X3He0-%+Z(`@(uw-ep6;=ut8DzaH(PsefJ7T(zi2AjMaK=McGn5} z-QMcp4d7DkS$b(jyPTzX18`JR#ArsloUyzCII8JkRHI$aSl$2})s!&W(Jp5!Zvc*J z8W_S4dZNJxG^ivT-T)Hy*jU*~UUu6VfZhO_Y9`^DigqswBqw>3v`Jdy4UkkRl{&l8 zE@wn<0FG)LjDu*GGnO|1N41m~SJ7_Dv8Kws0XV9q#1NTvY2VsS*@9i}4ZxNz8PLW_ z-ejGVRe1v>(}`7O>m)C0m{~yH0Get}<8mMEa+cx^z)|f2n5?2*&QiPqII7Ko$uipI zEX5muquMN(tfO7dQoI2;s?CU@7FuSd)?2%3V_ksA8$d~EmnV6ZM)v;*(h^c~Nt4zL zTps@f;3{_xm!D{tvlMRtj%sHyIg55VOYsKas5XVkU$o0viZ=j9wVXz~oTYdJq*v{< zF{aP0l=F(b0WP3gk)mC10FDB4VF<@MOviQ73z@aY(&Y0`fLYYc^GRNB08IsEPiGQXrrb2B+y^V$Gqi*~&MQYcWyXg9_3&y~*0 zCqP-FU2lLS3RwL9oh0q^Rx{6@0OdHzt7)S7V}KH!q~3^+S6SdTxnp4C44iw8Nkk2u|#{(Ng-}r>+~yLSZkRB zR7wMgPx3Z)T@Oq?3u8Lx7Mxx|t8F=MTJu-!jd8_SIs=F=Y1$iIjTRjQOi!{+pyQ}i z)?n$t^U3P-RaGhjh@;&-PreJ4ju&C@!BpEsI0=~b=pU%1!sVd2Oa_oeyN3>SVC*%lkSe;jyu-FEWp5z^^twIZR7*kQ!_5XBc zBZ7fP?QrX`7T5s7Xt!Cv7HGwP?k&)fat0Qn7JysOUmdpALr7dq14yIY{lo9YDf1GH zxm>7U68HoRRk5u4Op;>PHH9;PINIGm+=bJXg8)9}Ol+c4s8p6?*}y($Jrg!6m;r>* zZY)YOY5)il>Z4aicoQ&7&_D2^9;uwESO#d(=AQb{_u0#CMvnpb5*sfEzKY4#C$N0& zQ8|?kLtzXcKFQmRz71fDj%)%JqL*R1u164z3s}^k1u=l|lBUtx29VjIrka$9P(y#X zR!XCR&%FV}(e7xy57Zg~OoxVGdK|PFL6!gGOlgo@8$cZGHioYODhFY(P)RRMn)uJd z&tX~h1x?blT)8!XINE(~_hmSF>LnPwFRdsJ>;I04i>}3r6>m7~IjvP*4IqnlpMQJ- z#uw~^!KbqlHhEvFBdCVS>vb#hX@C}ndg_DQSxY4{Xx8g6Sk1y`0x}yA4E!>S*10o) z_#|(m_Are3Y8GO$d&bAj+uN_klGU%VIheql89*5AHlq7ru#Krj*05a&!U5Mq4M_!wFIo?;Llvo)wQ1Bj#D_!u`){O;Z*w#3LO?=}SC{kCRvVu1K0Z~G(` zb?q8D%v#7)w0rVpN5{BXBU%KFW3qLnt#gD93?MwodnmdXC+GlRK5kLuyi@-aL3p=~ zA*~xgd`VLy+6{x1HWptf&K9n~P2myknXMW?9PPgShA!=u7mv@%8^;z6AdGfrzoDym zTcO$&{Bn!hM=bF1>h@{Z zu!+BaC-DtkY8n)YXg`9mPjg^Z1Bg%Zjy(MlR3_tN(!H9CEEQJ;AH~w}Pg-lzG=S_R zFZYHnEhP%Wqk9LDngK-7uKb3s!fc;-(D(qU>ADm_Fd^pB_$4d;9l%Gs8e5Tq!_aM5 zR{eDf#H^*_C&0g}KYOINHnfpFOf&i+fN!wz^AormLHK!%rHc(98p75MU812104AD5 zC-rJvRGpmxtl!X8fQ=N5NOvNr#@}Ti`eb7O7dLc?WGMt#^Q!cLr!S+d(HrV9XN9z#cnI0r5EjhX%;} zhOY8?hv*OJuZr$FbYp-hh;ya-1~~k9Cth1H3gEMxfjow#zz~9vb*a|>0Ls(gy?f>t QoB#j-07*qoM6N<$f>`+azyJUM diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana32.png b/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana32.png deleted file mode 100644 index d88ec6d8b4e4284637f718e417ec23e4e17843fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2658 zcmV-o3Z3A|#Y-T-M8%V9kM5B1gt@8OK*4Zu+?R~XvaT^qdBz_5N4djsTZGt&)2!0&s;-m%Dx z-Z`EQ`Bt?z09Uz;aYS^a({wJnq;}UoB%^o(NYu*+OGIPsE!@zxYv{0a1aAPTg6{FB z(ZZ^p`rwF0Yi|Gz6&-Sz7VhY-5AM)v=?$QzqyruTZSAcMZP9Gy4WOx}MJ@t8+FKji zsNKRFKwD88d_)JjPaN$tqgy7l>AeB86;S1N6jix=*^`*n3{0NwyLRMp}n9K(cJ z-1E$)KWkB*&*KeXOIaZ=f&N=Dm7sfg({F`TbHcp=Y^uxV=0&@lcHRIS)huJU(Jp5! zZvc*JHZepG_e4X3He0-%+Z(`@(uw-ep6;=ut8DzaH(PsefJ7T(zi2AjMaK=McGn5} z-QMcp4d7DkS$b(jyPTzX18`JR#ArsloUyzCII8JkRHI$aSl$2})s!&W(Jp5!Zvc*J z8W_S4dZNJxG^ivT-T)Hy*jU*~UUu6VfZhO_Y9`^DigqswBqw>3v`Jdy4UkkRl{&l8 zE@wn<0FG)LjDu*GGnO|1N41m~SJ7_Dv8Kws0XV9q#1NTvY2VsS*@9i}4ZxNz8PLW_ z-ejGVRe1v>(}`7O>m)C0m{~yH0Get}<8mMEa+cx^z)|f2n5?2*&QiPqII7Ko$uipI zEX5muquMN(tfO7dQoI2;s?CU@7FuSd)?2%3V_ksA8$d~EmnV6ZM)v;*(h^c~Nt4zL zTps@f;3{_xm!D{tvlMRtj%sHyIg55VOYsKas5XVkU$o0viZ=j9wVXz~oTYdJq*v{< zF{aP0l=F(b0WP3gk)mC10FDB4VF<@MOviQ73z@aY(&Y0`fLYYc^GRNB08IsEPiGQXrrb2B+y^V$Gqi*~&MQYcWyXg9_3&y~*0 zCqP-FU2lLS3RwL9oh0q^Rx{6@0OdHzt7)S7V}KH!q~3^+S6SdTxnp4C44iw8Nkk2u|#{(Ng-}r>+~yLSZkRB zR7wMgPx3Z)T@Oq?3u8Lx7Mxx|t8F=MTJu-!jd8_SIs=F=Y1$iIjTRjQOi!{+pyQ}i z)?n$t^U3P-RaGhjh@;&-PreJ4ju&C@!BpEsI0=~b=pU%1!sVd2Oa_oeyN3>SVC*%lkSe;jyu-FEWp5z^^twIZR7*kQ!_5XBc zBZ7fP?QrX`7T5s7Xt!Cv7HGwP?k&)fat0Qn7JysOUmdpALr7dq14yIY{lo9YDf1GH zxm>7U68HoRRk5u4Op;>PHH9;PINIGm+=bJXg8)9}Ol+c4s8p6?*}y($Jrg!6m;r>* zZY)YOY5)il>Z4aicoQ&7&_D2^9;uwESO#d(=AQb{_u0#CMvnpb5*sfEzKY4#C$N0& zQ8|?kLtzXcKFQmRz71fDj%)%JqL*R1u164z3s}^k1u=l|lBUtx29VjIrka$9P(y#X zR!XCR&%FV}(e7xy57Zg~OoxVGdK|PFL6!gGOlgo@8$cZGHioYODhFY(P)RRMn)uJd z&tX~h1x?blT)8!XINE(~_hmSF>LnPwFRdsJ>;I04i>}3r6>m7~IjvP*4IqnlpMQJ- z#uw~^!KbqlHhEvFBdCVS>vb#hX@C}ndg_DQSxY4{Xx8g6Sk1y`0x}yA4E!>S*10o) z_#|(m_Are3Y8GO$d&bAj+uN_klGU%VIheql89*5AHlq7ru#Krj*05a&!U5Mq4M_!wFIo?;Llvo)wQ1Bj#D_!u`){O;Z*w#3LO?=}SC{kCRvVu1K0Z~G(` zb?q8D%v#7)w0rVpN5{BXBU%KFW3qLnt#gD93?MwodnmdXC+GlRK5kLuyi@-aL3p=~ zA*~xgd`VLy+6{x1HWptf&K9n~P2myknXMW?9PPgShA!=u7mv@%8^;z6AdGfrzoDym zTcO$&{Bn!hM=bF1>h@{Z zu!+BaC-DtkY8n)YXg`9mPjg^Z1Bg%Zjy(MlR3_tN(!H9CEEQJ;AH~w}Pg-lzG=S_R zFZYHnEhP%Wqk9LDngK-7uKb3s!fc;-(D(qU>ADm_Fd^pB_$4d;9l%Gs8e5Tq!_aM5 zR{eDf#H^*_C&0g}KYOINHnfpFOf&i+fN!wz^AormLHK!%rHc(98p75MU812104AD5 zC-rJvRGpmxtl!X8fQ=N5NOvNr#@}Ti`eb7O7dLc?WGMt#^Q!cLr!S+d(HrV9XN9z#cnI0r5EjhX%;} zhOY8?hv*OJuZr$FbYp-hh;ya-1~~k9Cth1H3gEMxfjow#zz~9vb*a|>0Ls(gy?f>t QoB#j-07*qoM6N<$f>`+azyJUM diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana48.png b/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana48.png deleted file mode 100644 index d88ec6d8b4e4284637f718e417ec23e4e17843fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2658 zcmV-o3Z3A|#Y-T-M8%V9kM5B1gt@8OK*4Zu+?R~XvaT^qdBz_5N4djsTZGt&)2!0&s;-m%Dx z-Z`EQ`Bt?z09Uz;aYS^a({wJnq;}UoB%^o(NYu*+OGIPsE!@zxYv{0a1aAPTg6{FB z(ZZ^p`rwF0Yi|Gz6&-Sz7VhY-5AM)v=?$QzqyruTZSAcMZP9Gy4WOx}MJ@t8+FKji zsNKRFKwD88d_)JjPaN$tqgy7l>AeB86;S1N6jix=*^`*n3{0NwyLRMp}n9K(cJ z-1E$)KWkB*&*KeXOIaZ=f&N=Dm7sfg({F`TbHcp=Y^uxV=0&@lcHRIS)huJU(Jp5! zZvc*JHZepG_e4X3He0-%+Z(`@(uw-ep6;=ut8DzaH(PsefJ7T(zi2AjMaK=McGn5} z-QMcp4d7DkS$b(jyPTzX18`JR#ArsloUyzCII8JkRHI$aSl$2})s!&W(Jp5!Zvc*J z8W_S4dZNJxG^ivT-T)Hy*jU*~UUu6VfZhO_Y9`^DigqswBqw>3v`Jdy4UkkRl{&l8 zE@wn<0FG)LjDu*GGnO|1N41m~SJ7_Dv8Kws0XV9q#1NTvY2VsS*@9i}4ZxNz8PLW_ z-ejGVRe1v>(}`7O>m)C0m{~yH0Get}<8mMEa+cx^z)|f2n5?2*&QiPqII7Ko$uipI zEX5muquMN(tfO7dQoI2;s?CU@7FuSd)?2%3V_ksA8$d~EmnV6ZM)v;*(h^c~Nt4zL zTps@f;3{_xm!D{tvlMRtj%sHyIg55VOYsKas5XVkU$o0viZ=j9wVXz~oTYdJq*v{< zF{aP0l=F(b0WP3gk)mC10FDB4VF<@MOviQ73z@aY(&Y0`fLYYc^GRNB08IsEPiGQXrrb2B+y^V$Gqi*~&MQYcWyXg9_3&y~*0 zCqP-FU2lLS3RwL9oh0q^Rx{6@0OdHzt7)S7V}KH!q~3^+S6SdTxnp4C44iw8Nkk2u|#{(Ng-}r>+~yLSZkRB zR7wMgPx3Z)T@Oq?3u8Lx7Mxx|t8F=MTJu-!jd8_SIs=F=Y1$iIjTRjQOi!{+pyQ}i z)?n$t^U3P-RaGhjh@;&-PreJ4ju&C@!BpEsI0=~b=pU%1!sVd2Oa_oeyN3>SVC*%lkSe;jyu-FEWp5z^^twIZR7*kQ!_5XBc zBZ7fP?QrX`7T5s7Xt!Cv7HGwP?k&)fat0Qn7JysOUmdpALr7dq14yIY{lo9YDf1GH zxm>7U68HoRRk5u4Op;>PHH9;PINIGm+=bJXg8)9}Ol+c4s8p6?*}y($Jrg!6m;r>* zZY)YOY5)il>Z4aicoQ&7&_D2^9;uwESO#d(=AQb{_u0#CMvnpb5*sfEzKY4#C$N0& zQ8|?kLtzXcKFQmRz71fDj%)%JqL*R1u164z3s}^k1u=l|lBUtx29VjIrka$9P(y#X zR!XCR&%FV}(e7xy57Zg~OoxVGdK|PFL6!gGOlgo@8$cZGHioYODhFY(P)RRMn)uJd z&tX~h1x?blT)8!XINE(~_hmSF>LnPwFRdsJ>;I04i>}3r6>m7~IjvP*4IqnlpMQJ- z#uw~^!KbqlHhEvFBdCVS>vb#hX@C}ndg_DQSxY4{Xx8g6Sk1y`0x}yA4E!>S*10o) z_#|(m_Are3Y8GO$d&bAj+uN_klGU%VIheql89*5AHlq7ru#Krj*05a&!U5Mq4M_!wFIo?;Llvo)wQ1Bj#D_!u`){O;Z*w#3LO?=}SC{kCRvVu1K0Z~G(` zb?q8D%v#7)w0rVpN5{BXBU%KFW3qLnt#gD93?MwodnmdXC+GlRK5kLuyi@-aL3p=~ zA*~xgd`VLy+6{x1HWptf&K9n~P2myknXMW?9PPgShA!=u7mv@%8^;z6AdGfrzoDym zTcO$&{Bn!hM=bF1>h@{Z zu!+BaC-DtkY8n)YXg`9mPjg^Z1Bg%Zjy(MlR3_tN(!H9CEEQJ;AH~w}Pg-lzG=S_R zFZYHnEhP%Wqk9LDngK-7uKb3s!fc;-(D(qU>ADm_Fd^pB_$4d;9l%Gs8e5Tq!_aM5 zR{eDf#H^*_C&0g}KYOINHnfpFOf&i+fN!wz^AormLHK!%rHc(98p75MU812104AD5 zC-rJvRGpmxtl!X8fQ=N5NOvNr#@}Ti`eb7O7dLc?WGMt#^Q!cLr!S+d(HrV9XN9z#cnI0r5EjhX%;} zhOY8?hv*OJuZr$FbYp-hh;ya-1~~k9Cth1H3gEMxfjow#zz~9vb*a|>0Ls(gy?f>t QoB#j-07*qoM6N<$f>`+azyJUM diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana64.png b/x-pack/test_utils/chrome_extension/test_subjects_finder/images/kibana64.png deleted file mode 100644 index d88ec6d8b4e4284637f718e417ec23e4e17843fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2658 zcmV-o3Z3A|#Y-T-M8%V9kM5B1gt@8OK*4Zu+?R~XvaT^qdBz_5N4djsTZGt&)2!0&s;-m%Dx z-Z`EQ`Bt?z09Uz;aYS^a({wJnq;}UoB%^o(NYu*+OGIPsE!@zxYv{0a1aAPTg6{FB z(ZZ^p`rwF0Yi|Gz6&-Sz7VhY-5AM)v=?$QzqyruTZSAcMZP9Gy4WOx}MJ@t8+FKji zsNKRFKwD88d_)JjPaN$tqgy7l>AeB86;S1N6jix=*^`*n3{0NwyLRMp}n9K(cJ z-1E$)KWkB*&*KeXOIaZ=f&N=Dm7sfg({F`TbHcp=Y^uxV=0&@lcHRIS)huJU(Jp5! zZvc*JHZepG_e4X3He0-%+Z(`@(uw-ep6;=ut8DzaH(PsefJ7T(zi2AjMaK=McGn5} z-QMcp4d7DkS$b(jyPTzX18`JR#ArsloUyzCII8JkRHI$aSl$2})s!&W(Jp5!Zvc*J z8W_S4dZNJxG^ivT-T)Hy*jU*~UUu6VfZhO_Y9`^DigqswBqw>3v`Jdy4UkkRl{&l8 zE@wn<0FG)LjDu*GGnO|1N41m~SJ7_Dv8Kws0XV9q#1NTvY2VsS*@9i}4ZxNz8PLW_ z-ejGVRe1v>(}`7O>m)C0m{~yH0Get}<8mMEa+cx^z)|f2n5?2*&QiPqII7Ko$uipI zEX5muquMN(tfO7dQoI2;s?CU@7FuSd)?2%3V_ksA8$d~EmnV6ZM)v;*(h^c~Nt4zL zTps@f;3{_xm!D{tvlMRtj%sHyIg55VOYsKas5XVkU$o0viZ=j9wVXz~oTYdJq*v{< zF{aP0l=F(b0WP3gk)mC10FDB4VF<@MOviQ73z@aY(&Y0`fLYYc^GRNB08IsEPiGQXrrb2B+y^V$Gqi*~&MQYcWyXg9_3&y~*0 zCqP-FU2lLS3RwL9oh0q^Rx{6@0OdHzt7)S7V}KH!q~3^+S6SdTxnp4C44iw8Nkk2u|#{(Ng-}r>+~yLSZkRB zR7wMgPx3Z)T@Oq?3u8Lx7Mxx|t8F=MTJu-!jd8_SIs=F=Y1$iIjTRjQOi!{+pyQ}i z)?n$t^U3P-RaGhjh@;&-PreJ4ju&C@!BpEsI0=~b=pU%1!sVd2Oa_oeyN3>SVC*%lkSe;jyu-FEWp5z^^twIZR7*kQ!_5XBc zBZ7fP?QrX`7T5s7Xt!Cv7HGwP?k&)fat0Qn7JysOUmdpALr7dq14yIY{lo9YDf1GH zxm>7U68HoRRk5u4Op;>PHH9;PINIGm+=bJXg8)9}Ol+c4s8p6?*}y($Jrg!6m;r>* zZY)YOY5)il>Z4aicoQ&7&_D2^9;uwESO#d(=AQb{_u0#CMvnpb5*sfEzKY4#C$N0& zQ8|?kLtzXcKFQmRz71fDj%)%JqL*R1u164z3s}^k1u=l|lBUtx29VjIrka$9P(y#X zR!XCR&%FV}(e7xy57Zg~OoxVGdK|PFL6!gGOlgo@8$cZGHioYODhFY(P)RRMn)uJd z&tX~h1x?blT)8!XINE(~_hmSF>LnPwFRdsJ>;I04i>}3r6>m7~IjvP*4IqnlpMQJ- z#uw~^!KbqlHhEvFBdCVS>vb#hX@C}ndg_DQSxY4{Xx8g6Sk1y`0x}yA4E!>S*10o) z_#|(m_Are3Y8GO$d&bAj+uN_klGU%VIheql89*5AHlq7ru#Krj*05a&!U5Mq4M_!wFIo?;Llvo)wQ1Bj#D_!u`){O;Z*w#3LO?=}SC{kCRvVu1K0Z~G(` zb?q8D%v#7)w0rVpN5{BXBU%KFW3qLnt#gD93?MwodnmdXC+GlRK5kLuyi@-aL3p=~ zA*~xgd`VLy+6{x1HWptf&K9n~P2myknXMW?9PPgShA!=u7mv@%8^;z6AdGfrzoDym zTcO$&{Bn!hM=bF1>h@{Z zu!+BaC-DtkY8n)YXg`9mPjg^Z1Bg%Zjy(MlR3_tN(!H9CEEQJ;AH~w}Pg-lzG=S_R zFZYHnEhP%Wqk9LDngK-7uKb3s!fc;-(D(qU>ADm_Fd^pB_$4d;9l%Gs8e5Tq!_aM5 zR{eDf#H^*_C&0g}KYOINHnfpFOf&i+fN!wz^AormLHK!%rHc(98p75MU812104AD5 zC-rJvRGpmxtl!X8fQ=N5NOvNr#@}Ti`eb7O7dLc?WGMt#^Q!cLr!S+d(HrV9XN9z#cnI0r5EjhX%;} zhOY8?hv*OJuZr$FbYp-hh;ya-1~~k9Cth1H3gEMxfjow#zz~9vb*a|>0Ls(gy?f>t QoB#j-07*qoM6N<$f>`+azyJUM diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/manifest.json b/x-pack/test_utils/chrome_extension/test_subjects_finder/manifest.json deleted file mode 100644 index a954a281257b0..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/manifest.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "Test subjects finder", - "version": "1.0", - "description": "Read and print the test subjects on the current page.", - "permissions": ["activeTab", "declarativeContent", "storage"], - "background": { - "scripts": ["background.js"], - "persistent": false - }, - "page_action": { - "default_popup": "popup.html", - "default_icon": { - "16": "images/kibana16.png", - "32": "images/kibana32.png", - "48": "images/kibana48.png", - "128": "images/kibana128.png" - } - }, - "icons": { - "16": "images/kibana16.png", - "32": "images/kibana32.png", - "48": "images/kibana48.png", - "128": "images/kibana128.png" - }, - "manifest_version": 2 -} diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.html b/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.html deleted file mode 100644 index a7fd489dcf86c..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - -

Test subjects finder

-
-
-
- - -
- The DOM node you want to start to traverse from. If not specified, the "body" will be used. -
-
- -
- - -
- If you chose "typescript" you will get a Union Type ready to copy and paste in your test file. -
-
- -
- - -
- The dom traversal "depth" to be returned. In most cases 2 level depth is enough to access all your test subjects. - You can always add manually later other depths in your Typescript union string type. -
-
-
- -
- - -
-
- - - - diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.js b/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.js deleted file mode 100644 index 0944038b59370..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/popup.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -/* eslint-disable no-undef */ - -// const trace = (message) => { -// chrome.tabs.executeScript( -// undefined, -// { code: `console.log("${message}")` }, -// ); -// }; - -const isTrackingTestSubjects = () => - new Promise((resolve) => { - chrome.tabs.executeScript( - undefined, - { code: '(() => Boolean(window.__test_utils__ && window.__test_utils__.isTracking))()' }, - ([result]) => { - resolve(result); - } - ); - }); - -const onStartTracking = () => { - document.body.classList.add('is-tracking'); -}; - -const onStopTracking = () => { - document.body.classList.remove('is-tracking'); -}; - -chrome.storage.sync.get( - ['outputType', 'domTreeRoot', 'depth'], - async ({ outputType, domTreeRoot, depth }) => { - const domRootInput = document.getElementById('domRootInput'); - const outputTypeSelect = document.getElementById('outputTypeSelect'); - const depthInput = document.getElementById('depthInput'); - const startTrackButton = document.getElementById('startTrackingButton'); - const stopTrackButton = document.getElementById('stopTrackingButton'); - - const isTracking = await isTrackingTestSubjects(); - - // UI state - if (isTracking) { - document.body.classList.add('is-tracking'); - } else { - document.body.classList.remove('is-tracking'); - } - - // FORM state - if (domTreeRoot) { - domRootInput.value = domTreeRoot; - } - - if (depth) { - depthInput.value = depth; - } - - document.querySelectorAll('#outputTypeSelect option').forEach((node) => { - if (node.value === outputType) { - node.setAttribute('selected', 'selected'); - } - }); - - // FORM events - domRootInput.addEventListener('change', (e) => { - const { value } = e.target; - chrome.storage.sync.set({ domTreeRoot: value }); - }); - - depthInput.addEventListener('change', (e) => { - const { value } = e.target; - if (value) { - chrome.storage.sync.set({ depth: value }); - } - }); - - outputTypeSelect.addEventListener('change', (e) => { - const { value } = e.target; - chrome.storage.sync.set({ outputType: value }); - }); - - startTrackButton.addEventListener('click', () => { - onStartTracking(); - - chrome.tabs.executeScript(undefined, { file: 'start_tracking_test_subjects.js' }); - }); - - stopTrackButton.addEventListener('click', () => { - onStopTracking(); - - chrome.tabs.executeScript(undefined, { file: 'stop_tracking_test_subjects.js' }); - }); - } -); - -chrome.runtime.onMessage.addListener((request) => { - if (request === 'TRACK_SUBJECTS_ERROR') { - onStopTracking(); - } -}); diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/start_tracking_test_subjects.js b/x-pack/test_utils/chrome_extension/test_subjects_finder/start_tracking_test_subjects.js deleted file mode 100644 index 4c2612a2223e5..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/start_tracking_test_subjects.js +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -/* eslint-disable no-undef */ - -(function () { - /** - * Go from ['a', 'b', 'c', 'd', 'e'] - * To ['a.b.c.d.e', 'a.b.c.d', 'a.b.c', 'a.b'] - * @param arr The array to outpu - */ - const outputArray = (arr) => { - const output = []; - let i = 0; - while (i < arr.length - 1) { - const end = i ? i * -1 : undefined; - output.push(arr.slice(0, end).join('.')); - i++; - } - return output; - }; - - const getAllNestedPathsFromArray = (arr, computedArray = []) => { - // Output the array without skipping any item - let output = [...computedArray, ...outputArray(arr)]; - - // We remove the "head" and the "tail" of the array (pos 0 and arr.length -1) - // We go from ['a', 'b', 'c', 'd', 'e'] (5 items) - // To 3 modified arrays - // ['a', 'c', 'd', 'e'] => outputArray() - // ['a', 'd', 'e'] => outputArray() - // ['a', 'e'] => outputArray() - let itemsToSkip = arr.length - 2; - if (itemsToSkip > 0) { - while (itemsToSkip) { - const newArray = [...arr]; - newArray.splice(1, itemsToSkip); - output = [...output, ...outputArray(newArray)]; - itemsToSkip--; - } - } - - if (arr.length > 2) { - // Recursively call the function skipping the first array item - return getAllNestedPathsFromArray(arr.slice(1), output); - } - - return output.sort(); - }; - - chrome.storage.sync.get( - ['domTreeRoot', 'outputType', 'depth'], - ({ domTreeRoot, outputType, depth = 2 }) => { - const datasetKey = 'testSubj'; - - if (domTreeRoot && !document.querySelector(domTreeRoot)) { - // Let our popup extension know about this... - chrome.runtime.sendMessage('TRACK_SUBJECTS_ERROR'); - throw new Error(`DOM node "${domTreeRoot}" not found.`); - } - - const arrayToType = (array) => - array.reduce((string, subject) => { - return string === '' ? `'${subject}'` : `${string}\n | '${subject}'`; - }, ''); - - const arrayToList = (array) => - array.reduce((string, subject) => { - return string === '' ? `'${subject}'` : `${string}\n\'${subject}'`; - }, ''); - - const addTestSubject = (testSubject) => { - const subjectDepth = testSubject.split('.').length; - if (subjectDepth <= parseInt(depth, 10)) { - window.__test_utils__.dataTestSubjects.add(testSubject); - } - }; - - const findTestSubjects = ( - node = domTreeRoot ? document.querySelector(domTreeRoot) : document.querySelector('body'), - path = [] - ) => { - if (!node) { - // We probably navigated outside the initial DOM root - return; - } - const testSubjectOnNode = node.dataset[datasetKey]; - - const updatedPath = testSubjectOnNode ? [...path, testSubjectOnNode] : path; - - if (!node.children.length) { - const pathToString = updatedPath.join('.'); - - if (pathToString) { - // Add the complete nested path ('a.b.c.d') - addTestSubject(pathToString); - // Add each item separately - updatedPath.forEach(addTestSubject); - // Add all the combination ('a.b', 'a.c', 'a.e', ...) - const nestedPaths = getAllNestedPathsFromArray(updatedPath); - nestedPaths.forEach(addTestSubject); - } - - return; - } - - for (let i = 0; i < node.children.length; i++) { - findTestSubjects(node.children[i], updatedPath); - } - }; - - const output = () => { - const { dataTestSubjects } = window.__test_utils__; - const allTestSubjects = Array.from(dataTestSubjects).sort(); - - console.log(`------------- TEST SUBJECTS (${allTestSubjects.length}) ------------- `); - - const content = - outputType === 'list' - ? `${arrayToList(allTestSubjects)}` - : `export type TestSubjects = ${arrayToType(allTestSubjects)}`; - - console.log(content); - }; - - // Handler for the clicks on the document to keep tracking - // new test subjects - const documentClicksHandler = () => { - const { dataTestSubjects } = window.__test_utils__; - const total = dataTestSubjects.size; - - // Wait to be sure that the DOM has updated - setTimeout(() => { - findTestSubjects(); - if (dataTestSubjects.size === total) { - // No new test subject, nothing to output - return; - } - - output(); - }, 500); - }; - - // Add meta data on the window object - window.__test_utils__ = window.__test_utils__ || { - documentClicksHandler, - isTracking: false, - dataTestSubjects: new Set(), - }; - - // Handle "click" event on the document to update our test subjects - if (!window.__test_utils__.isTracking) { - document.addEventListener('click', window.__test_utils__.documentClicksHandler); - window.__test_utils__.isTracking = true; - } - - findTestSubjects(); - output(); - } - ); -})(); diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/stop_tracking_test_subjects.js b/x-pack/test_utils/chrome_extension/test_subjects_finder/stop_tracking_test_subjects.js deleted file mode 100644 index 94875a9d1b8d8..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/stop_tracking_test_subjects.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -if (window.__test_utils__ && window.__test_utils__.isTracking) { - document.removeEventListener('click', window.__test_utils__.documentClicksHandler); - window.__test_utils__.isTracking = false; - window.__test_utils__.dataTestSubjects = new Set(); -} diff --git a/x-pack/test_utils/chrome_extension/test_subjects_finder/style.css b/x-pack/test_utils/chrome_extension/test_subjects_finder/style.css deleted file mode 100644 index 7cf56cf14fcf8..0000000000000 --- a/x-pack/test_utils/chrome_extension/test_subjects_finder/style.css +++ /dev/null @@ -1,110 +0,0 @@ -* { - box-sizing: border-box; -} -body { - padding: 16px; - width: 300px; -} -h1 { - font-size: 1rem; - margin: 0 0 16px; - text-align: center; -} - -.form-control { - margin-bottom: 16px; -} - -.form-control__label { - display: block; - font-weight: 600; - margin-bottom: 4px; -} - -.form-control__input { - width: 100%; - height: 40px; - background-color: #fbfcfd; - background-repeat: no-repeat; - background-size: 0% 100%; - box-shadow: 0 1px 1px -1px rgba(152, 162, 179, 0.2), 0 3px 2px -2px rgba(152, 162, 179, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.1); - transition: background-color 150ms ease-in, background-image 150ms ease-in, background-size 150ms ease-in, -webkit-box-shadow 150ms ease-in; - transition: box-shadow 150ms ease-in, background-color 150ms ease-in, background-image 150ms ease-in, background-size 150ms ease-in; - font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-weight: 400; - letter-spacing: -.005em; - -webkit-text-size-adjust: 100%; - -webkit-font-kerning: normal; - font-kerning: normal; - font-size: 14px; - line-height: 1em; - color: #343741; - border: none; - border-radius: 0; - padding: 12px; - margin-bottom: 4px; -} - -.form-control__helper-text { - font-size: 0.7rem; - color: #666; -} - -.form-control__select { - width: 100%; - padding: 4px; - margin-bottom: 4px; -} - -.form-actions { - border-top: 1px solid #ddd; - padding-top: 24px; - text-align: center; -} - -button { - font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-weight: 400; - letter-spacing: -.005em; - -webkit-text-size-adjust: 100%; - -webkit-font-kerning: normal; - font-kerning: normal; - font-size: 1rem; - line-height: 1.5; - display: inline-block; - -webkit-appearance: none; - appearance: none; - cursor: pointer; - height: 40px; - line-height: 40px; - text-decoration: none; - border: solid 1px transparent; - text-align: center; - transition: all 250ms cubic-bezier(0.34, 1.61, 0.7, 1); - white-space: nowrap; - max-width: 100%; - vertical-align: middle; - box-shadow: 0 2px 2px -1px rgba(152, 162, 179, 0.3); - border-radius: 4px; - min-width: 112px; - background-color: #017D73; - border-color: #017D73; - color: #FFF; - box-shadow: 0 2px 2px -1px rgba(39, 87, 83, 0.3); -} - -.is-tracking .track-config { - display: none; -} - -#stopTrackingButton { - display: none; -} - -.is-tracking #stopTrackingButton { - display: inline; -} - -.is-tracking #startTrackingButton { - display: none; -} diff --git a/x-pack/test_utils/get_config_schema.ts b/x-pack/test_utils/get_config_schema.ts deleted file mode 100644 index cca0bc07a4e91..0000000000000 --- a/x-pack/test_utils/get_config_schema.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import Joi from 'joi'; - -export async function getConfigSchema(pluginProvider: any): Promise { - class Plugin { - constructor(public readonly options: any) {} - } - - const plugin = pluginProvider({ Plugin }); - - return await plugin.options.config(Joi); -} diff --git a/x-pack/test_utils/index.ts b/x-pack/test_utils/index.ts deleted file mode 100644 index 5d0042bdaef14..0000000000000 --- a/x-pack/test_utils/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export * from './lib'; -export { getConfigSchema } from './get_config_schema'; diff --git a/x-pack/test_utils/jest/config.integration.js b/x-pack/test_utils/jest/config.integration.js deleted file mode 100644 index 4ec1711eb6fca..0000000000000 --- a/x-pack/test_utils/jest/config.integration.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../../../src/dev/constants'; -import config from './config'; - -export default { - ...config, - testMatch: [ - `**/${RESERVED_DIR_JEST_INTEGRATION_TESTS}/**/*.test.{js,mjs,ts,tsx}`, - // Tests within `__jest__` directories should be treated as regular unit tests. - `!**/__jest__/${RESERVED_DIR_JEST_INTEGRATION_TESTS}/**/*.test.{js,mjs,ts,tsx}`, - ], - testPathIgnorePatterns: config.testPathIgnorePatterns.filter( - (pattern) => !pattern.includes(RESERVED_DIR_JEST_INTEGRATION_TESTS) - ), - reporters: [ - 'default', - [ - '/../packages/kbn-test/target/jest/junit_reporter', - { reportName: 'Jest Integration Tests' }, - ], - ], - setupFilesAfterEnv: ['/../packages/kbn-test/target/jest/setup/after_env.integration.js'], -}; diff --git a/x-pack/test_utils/jest/config.js b/x-pack/test_utils/jest/config.js deleted file mode 100644 index 7d4f6b713da27..0000000000000 --- a/x-pack/test_utils/jest/config.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { RESERVED_DIR_JEST_INTEGRATION_TESTS } from '../../../src/dev/constants'; - -export default { - rootDir: '../../', - roots: [ - '/plugins', - '/legacy/plugins', - '/legacy/server', - '/legacy/common', - '/test_utils/jest/integration_tests', - ], - collectCoverageFrom: ['legacy/plugins/**/*.js', 'legacy/common/**/*.js', 'legacy/server/**/*.js'], - moduleNameMapper: { - '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - '/packages/kbn-test/target/jest/mocks/file_mock.js', - '\\.(css|less|scss)$': '/../packages/kbn-test/target/jest/mocks/style_mock.js', - }, - setupFiles: [ - '/../packages/kbn-test/target/jest/setup/babel_polyfill.js', - '/../packages/kbn-test/target/jest/setup/polyfills.js', - '/../packages/kbn-test/target/jest/setup/enzyme.js', - ], - coverageDirectory: '/../target/kibana-coverage/jest', - coverageReporters: ['html'], - moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'], - modulePathIgnorePatterns: ['__fixtures__/', 'target/'], - testEnvironment: 'jest-environment-jsdom-thirteen', - testMatch: ['**/*.test.{js,mjs,ts,tsx}'], - testPathIgnorePatterns: [ - '/packages/kbn-ui-framework/(dist|doc_site|generator-kui)/', - '/packages/kbn-pm/dist/', - `${RESERVED_DIR_JEST_INTEGRATION_TESTS}/`, - ], - testRunner: 'jest-circus/runner', - transform: { - '^.+\\.(js|tsx?)$': '/../packages/kbn-test/target/jest/babel_transform.js', - '^.+\\.txt?$': 'jest-raw-loader', - '^.+\\.html?$': 'jest-raw-loader', - }, - transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.js$', 'packages/kbn-pm/dist/index.js'], - snapshotSerializers: ['/../node_modules/enzyme-to-json/serializer'], - reporters: ['default', '/../packages/kbn-test/target/jest/junit_reporter'], -}; diff --git a/x-pack/test_utils/kbn_server_config.ts b/x-pack/test_utils/kbn_server_config.ts deleted file mode 100644 index 3cac6ed5df014..0000000000000 --- a/x-pack/test_utils/kbn_server_config.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { resolve } from 'path'; - -type Licenses = 'oss' | 'basic' | 'gold' | 'trial'; - -export const TestKbnServerConfig = { - kbn: { - plugins: { paths: [resolve(__dirname, '../../x-pack')] }, - xpack: { - monitoring: { - tests: { - cloud_detector: { - enabled: false, - }, - }, - }, - }, - }, - es: { - license: 'trial' as Licenses, - }, - users: [ - { - username: 'kibana_admin', - password: 'x-pack-test-password', - roles: ['kibana_admin'], - }, - ], -}; diff --git a/x-pack/test_utils/lib/index.ts b/x-pack/test_utils/lib/index.ts deleted file mode 100644 index 07120636f09cf..0000000000000 --- a/x-pack/test_utils/lib/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { nextTick, getRandomString, getRandomNumber } from './utils'; diff --git a/x-pack/test_utils/lib/utils.ts b/x-pack/test_utils/lib/utils.ts deleted file mode 100644 index 0765a4cd88476..0000000000000 --- a/x-pack/test_utils/lib/utils.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -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); - -export const getRandomString = (options = {}) => - `${chance.string({ pool: CHARS_POOL, ...options })}-${Date.now()}`; From 9f0e49d9ce25063edb594c56ff9a8c406a14cdfb Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Thu, 12 Nov 2020 14:10:47 -0800 Subject: [PATCH 3/5] Adds testbed README Signed-off-by: Tyler Smalley --- .../kbn-test/src/jest/utils/testbed/README.md | 313 ++++++++++++++++++ 1 file changed, 313 insertions(+) create mode 100644 packages/kbn-test/src/jest/utils/testbed/README.md diff --git a/packages/kbn-test/src/jest/utils/testbed/README.md b/packages/kbn-test/src/jest/utils/testbed/README.md new file mode 100644 index 0000000000000..5a05ba3750d3c --- /dev/null +++ b/packages/kbn-test/src/jest/utils/testbed/README.md @@ -0,0 +1,313 @@ +# Testbed utils + +The Testbed is a small library to help testing React components. It is most useful when testing application "sections" (or pages) in **integration** +than when unit testing single components in isolation. + +## Motivation + +The Elasticsearch UI team built this to support client-side integration testing. When testing complete "pages" we get to test +our application in a way that is closer to how a user would interact with it in a browser. It also gives us more confidence in +our tests and avoids testing implementation details. + +We test everything up to the HTTP Requests made from the client to the Node.js API server. Those requests need to be mocked. This means that with a good +**API integration test** coverage of those endpoints, we can reduce the functional tests to a minimum. + +With this in mind, we needed a way to easily mount a component on a React Router `` (this component could possibily have _child_ routes and +need access to the browser URL parameters and query params). In order to solve that, the Testbed wraps the component around a `MemoryRouter`. + +On the other side, the majority of our current applications use Redux as state management so we needed a simple way to wrap our component under test +inside a redux store provider. + +## How to use it + +At the top of your test file (you only need to declare it once), register a new Testbed by providing a React Component and an optional configuration object. +You receive in return a function that you need to call to mount the component in your test. + +**Example 1** + +```ts +// remote_clusters_list.helpers.ts + +import { registerTestBed } from '../../../../test_utils'; +import { RemoteClusterList } from '../../app/sections/remote_cluster_list'; +import { remoteClustersStore } from '../../app/store'; +import routing from '../../app/services/routing'; + +const config = { + memoryRouter: { + onRouter(router) { + routing.registerRouter(router); // send the router instance to the routing service + }, + initialEntries: ['/some-resource-name'], // the Router initial URL + componentRoutePath: '/:name' // the Component path + }, + store: remoteClusterStore +}; + +export const setup = registerTestBed(RemoteClusterList, config); +``` + +Once you have registered a TestBed, you can call the `setup()` function to mount the component in your tests. You will get an object +back with a set of utility methods to test the component (refer to the documentation below for a complete list of the methods available). + +```ts +// remote_cluster.test.ts + +import { setup } from './remote_clusters_list.helpers.ts'; + +describe('', () => { + test('it should have a table with 3 rows', () => { + const { component, exists, find } = setup(); + + // component is an Enzyme reactWrapper + console.log(component.debug()); + + expect(exists('remoteClusterTable')).toBe(true); + expect(find('remoteClusterTable.row').length).toBe(3); + }); +}); +``` + +## Test subjects + +The Testbed utils are meant to be used with test subjects. Test subjects are elements that are tagged specifically for selecting from tests. Use test subjects over CSS selectors when possible. + +```html +
+
+``` + +```ts +find('containerButton').simulate('click'); +``` + +If you need to access a CSS selector, target first the closest test subject. + +```ts +const text = find('containerButton').find('.link--active').text(); +``` + +## Typescript + +If you use Typescript, you can provide a string union type for your test subjects and you will get **autocomplete** on the test subjects in your test. To automate finding all the subjects on the page, use the Chrome extension below. + +```ts +type TestSubjects = 'indicesTable' | 'createIndexButton' | 'pageTitle'; + +export const setup = registerTestBed(MyComponent); +``` + +## Best practices + +In order to prevent flakiness in component integration tests, please consider the following best practices: + +- **Use** `jest.useFakeTimers()`. + + The code under a test might be using `setTimeout()` calls. This is bad for deterministic tests. In order to avoid it, we need to use mocked timers from jest. For that we declare at the top of each component integration test the following: +​ + ```js + beforeAll(() => { + jest.useFakeTimers(); + }); + ​ + afterAll(() => { + jest.useRealTimers(); + }); + ``` + +- **Do not use** using `nextTick()`, `waitFor`, or `waitForFunc` helpers in tests. These helpers use `setTimeout` underneath and add latency in the tests, especially on CI where a timeout (even of a few ms) can trigger a timeout error. These helpers will eventually be deprecated once existing tests has been updated. + +- **Do not declare** `component.update()` inside `act()`. Each `act()` call should contain a chunk of actions that updates the internal state(s). The `component.update()` that re-renders the internal DOM needs to be called outside, before asserting against the updated DOM. + +- Be **synchronous** as much as possible. +​ + Hooks are delicate when it comes to state updates. Sometimes calling `act()` synchronously works, sometimes it doesn't. The reasoning behind this isn't clear yet. The best approach is to try synchronously first and if it fails, because of an `act()` error, then use the async version. + + ```js + // First try this + act(() => { + find('someTestSubject').simulate('click'); + }); + component.update(); + ​ + // If there is a "missing `act()` error", then change it to + await act(async () => { + find('someTestSubject').simulate('click'); + }); + component.update(); + ``` + +## API + +## `registerTestBed(Component [, testBedConfig])` + +Instantiate a new TestBed to test a React component. The arguments it receives are + +- `Component` (the React component to test) +- `testBedConfig` (optional). An optional Testbed configuration object. + +**@returns** A function to instantiate and mount the component. + +### `testBedConfig` + +The `testBedConfig` has the following properties (all **optional**) + +- `defaultProps` The default props to pass to the mounted component. Those props can be overriden when calling the `setup([props])` callback +- `memoryRouter` Configuration object for the react-router `MemoryRouter` with the following properties + - `wrapComponent` Flag to provide or not a `MemoryRouter`. If set to `false`, there won't be any router and the component won't be added on a ``. (default: `true`) + - `initialEntries` The React Router **initial entries** setting. (default: `['/']`. [see doc](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/MemoryRouter.md)) + - `initialIndex` The React Router **initial index** setting (default: `0`) + - `componentRoutePath` The route **path** for the mounted component (default: `"/"`) + - `onRouter` A callback that will be called with the React Router instance when the component is mounted +- `store` A redux store. You can also provide a function that returns a store. (default: `null`) + + +## `setup([props])` + +When registering a Testbed, you receive in return a setup function. This function accepts one optional argument: + +- `props` (optional) Props to pass to the mounted component. + +```js +describe('', () => { + test('it should be green', () => { + // Will mount + const { component } = setup({ color: 'green' }); + ... + }); +}); +``` + +**@returns** An object with the following **properties** and **helpers** for testing + +#### `component` + +The mounted component. It is an enzyme **reactWrapper**. + +#### `exists(testSubject)` + +Pass it a `data-test-subj` and it will return true if it exists or false if it does not exist. You can provide a nested path to access the +test subject by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). + +```js +const { exists } = setup(); +expect(exists('myTestSubject')).toBe(true); +``` + +#### `find(testDataSubject)` + +Pass it a `data-test-subj` and it will return an Enzyme reactWrapper of the node. You can provide a nested path to access the +test subject by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). + +```js +const { find } = setup(); + +const someNode = find('myTestSubject'); +expect(someNode.text()).toBe('hello'); +``` + +#### `setProps(props)` + +Update the props passed to a component. + +**Important**: This method can only be used on a Component that is _not_ wrapped by a ``. + +```js +... + +const { setup } = registerTestBed(RemoteClusterList); + +describe('', () => { + + test('it should work', () => { + const { exists, find, setProps } = setup(); + // test logic... + + // update the props of the component + setProps({ color: 'yellow' }); + ... + }); +}); +``` + +#### `table` + +An object with the following methods: + +##### `getMetaData(testSubject)` + +Parse an EUI table and return metadata information about its rows and columns. You can provide a nested path to access the +test subject by separating the parent and child with a dot (e.g. `mySection.myTable`). It returns an object with two properties: + +- `tableCellsValues` a two dimensional array of rows + columns with the text content of each cell of the table +- `rows` an array of row objects. A row object has the following two properties: + - `reactWrapper` the Enzyme react wrapper of the `tr` element. + - `columns` an array of columns objects. A column object has two properties: + - `reactWrapper` the Enzyme react wrapper for the table row `td` + - `value` the text content of the table cell + +```html + + + + + + + + + +
Row 0, column 0Row 0, column 1
Row 1, column 0Row 1, column 1
+``` + +```js +const { table: { getMetaData } } = setup(); +const { tableCellsValues } = getMetaData('myTable'); + +expect(tableCellsValues).toEqual([ + ['Row 0, column 0'], ['Row 0, column 1'], + ['Row 1, column 0'], ['Row 1, column 1'], +]); +``` + +#### `form` + +An object with the following methods: + +##### `setInputValue(input, value, isAsync)` + +Set the value of a form input. The input can either be a test subject (a string) or an Enzyme react wrapper. If you specify a test subject, +you can provide a nested path to access it by separating the parent and child with a dot (e.g. `myForm.followerIndexName`). + +`isAsync`: flag that will return a Promise that resolves on the next "tick". This is useful if updating the input triggers +an async operation (like a HTTP request) and we need it to resolve so the DOM gets updated (default: `false`). + +```js +await form.setInputValue('myInput', 'some value', true); +``` + +##### `selectCheckBox(testSubject)` + +Select a form checkbox. + +##### `toggleEuiSwitch(testSubject)` + +Toggle an Eui Switch. + +##### `setComboBoxValue(testSubject, value)` + +The EUI `` component is special in the sense that it needs the keyboard ENTER key to be pressed +in order to register the value provided. This helper takes care of that. + +##### `getErrorsMessages()` + +Find all the DOM nodes with the `.euiFormErrorText` css class from EUI and return an Array with its text content. + +#### `router` + +An object with the following methods: + +##### `navigateTo(url)` + +If you need to navigate to a different route inside your test and you are not using the `` component from `react-router` +in your component, you need to use the `router.navigateTo()` method from the testBed in order to trigger the route change on the `MemoryRouter`. From 47c6d4c1e0027f410e3fafa95e1dd30ba6223617 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Thu, 12 Nov 2020 14:21:45 -0800 Subject: [PATCH 4/5] Revert newline Signed-off-by: Tyler Smalley --- packages/kbn-test/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-test/package.json b/packages/kbn-test/package.json index ecf59f942d0f2..a64acdaefdc88 100644 --- a/packages/kbn-test/package.json +++ b/packages/kbn-test/package.json @@ -23,4 +23,4 @@ "@kbn/expect": "link:../kbn-expect", "@kbn/utils": "link:../kbn-utils" } -} +} \ No newline at end of file From e02d309436ca77cfcb2035807b85b3230c6726f2 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Thu, 12 Nov 2020 14:23:21 -0800 Subject: [PATCH 5/5] Revert newline Signed-off-by: Tyler Smalley --- packages/kbn-es-archiver/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-es-archiver/package.json b/packages/kbn-es-archiver/package.json index 28e9ce1ffef36..3cd07668635f1 100644 --- a/packages/kbn-es-archiver/package.json +++ b/packages/kbn-es-archiver/package.json @@ -14,4 +14,4 @@ "@kbn/dev-utils": "link:../kbn-dev-utils", "@kbn/test": "link:../kbn-test" } -} +} \ No newline at end of file