Stop specs from emitting events components never emit
What does this MR do and why?
Specs were emitting events on stubs (via stubComponent() and shallowMount) that the stubbed component neither declares nor emits. This went unnoticed because stubs did not carry the real component's emits option, so nothing rejected the call. This surfaced while investigating !253493 (closed), which fixes that by making stubs carry the real emits.
Specs switched to the event the component really emits
| Spec / stub | Was emitting | Now emits | Why |
|---|---|---|---|
role_form_spec.jsPermissionsSelector |
update:permissions |
change |
change is the component's v-model event |
create_sync_form_spec.jsServerFormGroup, GroupCnFormGroup |
ldapmain, group1, ldapalt |
input with that value |
the value was passed as the event name |
kubernetes_overview_spec.jsKubernetesTabs |
show-resource-details |
select-item |
the parent listens for select-item to open the drawer |
dast_site_profiles_list_spec.jsProfilesList |
input |
delete-profile |
listener-forwarding test needs an event the list emits |
editor_wrapper_spec.jsScanExecutionPolicyEditor |
error |
error on ScanResultPolicyEditor |
only the approval (scan result) editor emits error |
wizard_spec.jsEmailVerification |
set-verification-state |
same event on PhoneVerification |
only the phone step emits it |
Emits removed because nothing emits or listens for the event
| Spec / stub | Event | What changed |
|---|---|---|
create_work_item_modal_spec.jsCreateWorkItem |
cancel |
test removed; the real event confirm-cancel is already covered |
list_spec.jsPersistedSearch |
filter-submit |
emit removed from the doSearch helper |
editor_component_spec.jsActionSection |
set-ref |
two emits removed |
mr_widget_ready_to_merge_spec.jsMergeTrainRestartTrainConfirmationDialog |
show |
emit removed |
References
The double-fired tracking event found while fixing the frequent items specs is handled separately in !253514 (merged).
Part of the cleanup work tracked in !253493 (closed). That MR's Vue 3 Jest job is where these failures were found.
Screenshots or screen recordings
Not applicable.
How to set up and validate locally
Run the changed specs on both Vue 2 and Vue 3:
yarn jest spec/frontend/work_items/components/create_work_item_modal_spec.js spec/frontend/environments/environment_details/components/kubernetes/kubernetes_overview_spec.js spec/frontend/packages_and_registries/container_registry/explorer/pages/list_spec.js ee/spec/frontend/roles_and_permissions ee/spec/frontend/security_orchestration/components/policy_editor ee/spec/frontend/security_configuration/dast_profiles ee/spec/frontend/users/identity_verification ee/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.jsThen the same paths with VUE_VERSION=3 set.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.