Resolve "Improve stubs mocking for @vue/test-utils v2"
What does this MR do and why?
This MR introduces improved stubs for Vue.js 3 compat mode
How to set up and validate locally
- apply following patch. This patch does two things
- disables
console.log/console.error
throws. This is temporary workaround while Fix incorrect console handling in Jest tests (#396779) is being implemented - disables fresh ai test which goes infinite loop
💣
- disables
let mutationHandlerMock;
let subscriptionHandlerMock;
-describe('AiGenie', () => {
+describe.skip('AiGenie', () => {
let wrapper;
const containerId = 'container';
const language = 'vue';
diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js
index 4e341b2bb2f6..00e7fe86b2a5 100644
--- a/spec/frontend/environment.js
+++ b/spec/frontend/environment.js
@@ -23,7 +23,7 @@ class CustomEnvironment extends TestEnvironment {
const { error: originalErrorFn } = context.console;
Object.assign(context.console, {
- error(...args) {
+ disable_error(...args) {
if (
args?.[0]?.includes('[Vue warn]: Missing required prop') ||
args?.[0]?.includes('[Vue warn]: Invalid prop')
@@ -38,7 +38,7 @@ class CustomEnvironment extends TestEnvironment {
);
},
- warn(...args) {
+ disable_warn(...args) {
if (args?.[0]?.includes('The updateQuery callback for fetchMore is deprecated')) {
return;
}
- run
VUE_VERSION=3 yarn jest --maxWorkers 6 2>&1 | egrep "^(FAIL|PASS)" | awk '{ print $2 " " $1 }' | sort -u > /tmp/before-fix
onmaster
(this will generate baseline - tests before fixing stubs behaviour) - switch to this branch
- run
VUE_VERSION=3 yarn jest --maxWorkers 6 2>&1 | egrep "^(FAIL|PASS)" | awk '{ print $2 " " $1 }' | sort -u > /tmp/after-fix
(this will generate report after fixes) - run
diff /tmp/before-fix /tmp/after-fix
to observe fixes
Actual report
ee/spec/frontend/ai/tanuki_bot/store/mutations_spec.js PASS
ee/spec/frontend/ai/utils_spec.js PASS
ee/spec/frontend/analytics/analytics_dashboards/components/analytics_dashboard_spec.js PASS
-ee/spec/frontend/analytics/analytics_dashboards/components/analytics_visualization_designer_spec.js FAIL
+ee/spec/frontend/analytics/analytics_dashboards/components/analytics_visualization_designer_spec.js PASS
ee/spec/frontend/analytics/analytics_dashboards/components/dashboards_list_spec.js FAIL
ee/spec/frontend/analytics/analytics_dashboards/components/data_sources/cube_analytics_spec.js PASS
ee/spec/frontend/analytics/analytics_dashboards/components/list/dashboard_list_item_spec.js PASS
@@ -230,7 +230,7 @@
ee/spec/frontend/audit_events/components/audit_events_stream_spec.js PASS
ee/spec/frontend/audit_events/components/audit_events_table_spec.js PASS
ee/spec/frontend/audit_events/components/date_range_buttons_spec.js PASS
-ee/spec/frontend/audit_events/components/date_range_field_spec.js FAIL
+ee/spec/frontend/audit_events/components/date_range_field_spec.js PASS
ee/spec/frontend/audit_events/components/sorting_field_spec.js PASS
ee/spec/frontend/audit_events/components/stream/stream_destination_editor_spec.js PASS
ee/spec/frontend/audit_events/components/stream/stream_empty_state_spec.js FAIL
@@ -271,7 +271,7 @@
ee/spec/frontend/boards/components/board_content_spec.js FAIL
ee/spec/frontend/boards/components/board_filtered_search_spec.js PASS
ee/spec/frontend/boards/components/board_form_spec.js PASS
-ee/spec/frontend/boards/components/board_list_header_spec.js FAIL
+ee/spec/frontend/boards/components/board_list_header_spec.js PASS
ee/spec/frontend/boards/components/board_list_spec.js PASS
ee/spec/frontend/boards/components/board_new_epic_spec.js PASS
ee/spec/frontend/boards/components/board_scope_spec.js PASS
@@ -298,7 +298,7 @@
ee/spec/frontend/boards/stores/mutations_spec.js PASS
ee/spec/frontend/boards/stores/state_spec.js PASS
ee/spec/frontend/burndown_chart/burn_chart_data_spec.js PASS
-ee/spec/frontend/burndown_chart/components/burn_charts_spec.js FAIL
+ee/spec/frontend/burndown_chart/components/burn_charts_spec.js PASS
ee/spec/frontend/burndown_chart/components/burndown_chart_spec.js PASS
ee/spec/frontend/burndown_chart/components/burnup_chart_spec.js PASS
ee/spec/frontend/burndown_chart/components/open_timebox_summary_spec.js PASS
@@ -642,7 +642,7 @@
ee/spec/frontend/oncall_schedule/delete_schedule_modal_spec.js FAIL
ee/spec/frontend/oncall_schedule/oncall_schedule_spec.js FAIL
ee/spec/frontend/oncall_schedule/oncall_schedule_wrapper_spec.js PASS
-ee/spec/frontend/oncall_schedule/rotations/components/add_edit_rotation_form_spec.js FAIL
+ee/spec/frontend/oncall_schedule/rotations/components/add_edit_rotation_form_spec.js PASS
ee/spec/frontend/oncall_schedule/rotations/components/add_edit_rotation_modal_spec.js FAIL
ee/spec/frontend/oncall_schedule/rotations/components/delete_rotation_modal_spec.js FAIL
ee/spec/frontend/oncall_schedule/rotations/components/rotation_assignee_spec.js PASS
@@ -1379,7 +1379,7 @@
spec/frontend/analytics/cycle_analytics/utils_spec.js PASS
spec/frontend/analytics/devops_reports/components/service_ping_disabled_spec.js PASS
spec/frontend/analytics/product_analytics/components/activity_chart_spec.js PASS
-spec/frontend/analytics/shared/components/daterange_spec.js FAIL
+spec/frontend/analytics/shared/components/daterange_spec.js PASS
spec/frontend/analytics/shared/components/metric_popover_spec.js PASS
spec/frontend/analytics/shared/components/metric_tile_spec.js PASS
spec/frontend/analytics/shared/components/projects_dropdown_filter_spec.js FAIL
@@ -1497,7 +1497,7 @@
spec/frontend/boards/components/board_new_issue_spec.js PASS
spec/frontend/boards/components/board_new_item_spec.js PASS
spec/frontend/boards/components/board_settings_sidebar_spec.js PASS
-spec/frontend/boards/components/board_top_bar_spec.js PASS
+spec/frontend/boards/components/board_top_bar_spec.js FAIL
spec/frontend/boards/components/boards_selector_spec.js PASS
spec/frontend/boards/components/config_toggle_spec.js PASS
spec/frontend/boards/components/issue_board_filtered_search_spec.js PASS
@@ -1508,7 +1508,7 @@
spec/frontend/boards/components/sidebar/board_editable_item_spec.js PASS
spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js PASS
spec/frontend/boards/components/sidebar/board_sidebar_title_spec.js PASS
-spec/frontend/boards/components/toggle_focus_spec.js FAIL
+spec/frontend/boards/components/toggle_focus_spec.js PASS
spec/frontend/boards/project_select_spec.js FAIL
spec/frontend/boards/stores/actions_spec.js FAIL
spec/frontend/boards/stores/getters_spec.js PASS
@@ -2461,7 +2461,7 @@
spec/frontend/jobs/components/job/sidebar_detail_row_spec.js PASS
spec/frontend/jobs/components/job/sidebar_header_spec.js PASS
spec/frontend/jobs/components/job/sidebar_spec.js PASS
-spec/frontend/jobs/components/job/stages_dropdown_spec.js FAIL
+spec/frontend/jobs/components/job/stages_dropdown_spec.js PASS
spec/frontend/jobs/components/job/stuck_block_spec.js PASS
spec/frontend/jobs/components/job/trigger_block_spec.js PASS
spec/frontend/jobs/components/job/unmet_prerequisites_block_spec.js PASS
@@ -2733,7 +2733,7 @@
spec/frontend/notes/components/noteable_note_spec.js PASS
spec/frontend/notes/components/notes_activity_header_spec.js FAIL
spec/frontend/notes/components/notes_app_spec.js FAIL
-spec/frontend/notes/components/timeline_toggle_spec.js FAIL
+spec/frontend/notes/components/timeline_toggle_spec.js PASS
spec/frontend/notes/components/toggle_replies_widget_spec.js PASS
spec/frontend/notes/mixins/discussion_navigation_spec.js PASS
spec/frontend/notes/stores/actions_spec.js PASS
@@ -2925,7 +2925,7 @@
spec/frontend/pipeline_wizard/components/input_wrapper_spec.js PASS
spec/frontend/pipeline_wizard/components/step_nav_spec.js PASS
spec/frontend/pipeline_wizard/components/step_spec.js FAIL
-spec/frontend/pipeline_wizard/components/widgets/checklist_spec.js FAIL
+spec/frontend/pipeline_wizard/components/widgets/checklist_spec.js PASS
spec/frontend/pipeline_wizard/components/widgets/list_spec.js PASS
spec/frontend/pipeline_wizard/components/widgets/text_spec.js PASS
spec/frontend/pipeline_wizard/components/widgets_spec.js PASS
Metric | Before | After |
---|---|---|
Tests failed | 3946 |
|
Suites failed | 933 |
|
Tests passed | 42081 |
|
Suites passed | 2835 |
|
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Closes #408993 (closed)
Edited by Illya Klymov