Skip to content

Fix tests which are failing in @vue/test-utils 1.x due to stubs

Illya Klymov requested to merge xanf-missing-props-on-stubs into master

What does this MR do?

See &4255 (closed) for details Related issue: #240756 (closed)

@vue/test-utils 1.x introduce several changes, which affects our codebase This MR addresses two of them, both stubs related:

  • when using .props() or .attributes(), props definition is obtained from stub and not from original component.

For us this means that in 1.x some calls needs to be either switched from .props() to .attributes() when we're querying own stubs (since we're not declaring props on stubs) or props definition needs to be copied from original component (VTU does this internally when defining own stubs for shallowMount)

  • In 1.x all slots and scoped slots of component are rendered by default. For scoped slots that means that no scope is passed to them, so in some tests we need to do some more stubbing, to ensure we're not trying to render components with incomplete slot data (this is the case for GlFilteredSearch component, where it's stub tries to render #view scoped slot by NOT PASSING any value there, so destructuring fails

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Illya Klymov

Merge request reports

Loading