Skip to content

vm should automatically unwrap refs to match vue/test-utils behavior #1404

@ytoshiki

Description

@ytoshiki

Describe the feature

Problem

Currently, vm in mountSuspended() does not automatically unwrap refs, which is inconsistent with vue/test-utils:

// Current behavior (inconsistent)
const component = await mountSuspended(SomeComponent)
console.log(component.vm.someRef) // Returns ref object, not the value
console.log(component.vm.someRef.value) // Need to manually access .value

// Expected behavior (vue/test-utils)
const wrapper = mount(SomeComponent)
console.log(wrapper.vm.someRef) // Returns unwrapped value

Expected Behavior

wrapper.vm should automatically unwrap refs to match vue/test-utils:

const component = await mountSuspended(SomeComponent)
expect(component.vm.someRef).toBe('thing') // Should work directly
component.vm.someRef = 'new thing' // Should update ref.value
expect(component.vm.someRef).toBe('new thing') // Should reflect changes

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions