Skip to content

Typescript definition for stubs doesnn't allow false #1330

Closed
@Robjam

Description

@Robjam

Version

1.0.0-beta.29

Reproduction link

https://github.com/Robjam/vue-test-utils-typescript-example/tree/repro/stub-false-typescript

Steps to reproduce

vue create with unit tests and typescript
in helloworld.spec.ts shallowmount add:

    const wrapper = shallowMount(HelloWorld, {
      stubs: {
        transition: false
      }
    });

shallowMount encounters a type error as Stubs type (https://github.com/vuejs/vue-test-utils/blob/v1.0.0-beta.29/packages/test-utils/types/index.d.ts#L30) does not allow false.

What is expected?

that boolean is an acceptable type.

What is actually happening?

Typescript fails to compile.


It appears this is addressed in commit, but not yet released.

Workaround is to add // @ts-ignore to line before shallowMount foregoing all type checks on mount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions