Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug: Props detection broken with jest since 2.4.2 (works in 2.4.1) #561

Copy link
Copy link
Open
@sawmurai

Description

@sawmurai
Issue body actions

Describe the bug
Since upgrading from 2.4.1 props are no longer properly detected if the component is imported from a SFC. Please see the reproducer linked below.

The following error is shown if I run the tests:

❯ jest
 FAIL  src/components/HelloWorld.spec.ts
  ● Test suite failed to run

    src/components/HelloWorld.spec.ts:13:26 - error TS2339: Property 'msg' does not exist on type '{ key?: string | number | symbol | undefined; ref?: VNodeRef | undefined; ref_for?: boolean | undefined; ref_key?: string | undefined; onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[] | undefined; ... 6 more ...; style?: unknown; } & Partial<...> & Omit<...>'.

    13   expect(wrapper.props().msg).toBe('Hello world');
                                ~~~

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.625 s
Ran all test suites.

To Reproduce

https://stackblitz.com/edit/vitejs-vite-wdomed?file=src%2Fcomponents%2FHelloWorld.spec.ts

Expected behavior
Prop is still detected, or at least "ignored".

Related information:

System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
npmPackages:
@vue/test-utils: ^2.4.5 => 2.4.5
jest: ^29.7.0 => 29.7.0
vue: ^3.4.21 => 3.4.21

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.