Giter VIP home page Giter VIP logo

Comments (7)

sawmurai avatar sawmurai commented on August 17, 2024 1

You are right of course :) I'll update the issue.

from vue-jest.

cexbrayat avatar cexbrayat commented on August 17, 2024

Hi @sawmurai

Thanks for the repro.
I think the regression occurred between v2.4.1 and v2.4.2 no? Because v2.4.2 was the release with vuejs/test-utils@1db42c8 which changed the props() type.

from vue-jest.

cexbrayat avatar cexbrayat commented on August 17, 2024

@johnsoncodehk would you mind taking a look at why vuejs/test-utils@1db42c8 introduced this regression? How should we type props() to avoid that?

cc @alecgibson as well, as the original author of this change

from vue-jest.

alecgibson avatar alecgibson commented on August 17, 2024

Weirdly if I download this repro and run locally in VS Code, it seems fine:

Screenshot 2024-03-20 at 14 33 53

npm run build also works fine

from vue-jest.

alecgibson avatar alecgibson commented on August 17, 2024

It even correctly flags bad props:

Screenshot 2024-03-20 at 14 35 50

and fails npm run build:

❯ npm run build

> [email protected] build
> vue-tsc && vite build

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

14   expect(wrapper.props().foo).toBe('Hello world');
                            ~~~


Found 1 error in src/components/HelloWorld.spec.ts:14

from vue-jest.

alecgibson avatar alecgibson commented on August 17, 2024

Oh I see, npm run build passes, but running jest fails. This feels like a jest misconfiguration, or an issue with the @vue/vue3-jest transformer or its configuration

Edit: or the ts-jest transformer could also be the issue

from vue-jest.

cexbrayat avatar cexbrayat commented on August 17, 2024

Thanks for looking into it @alecgibson !
I'll transfer to the vue-jest repo then, as it does feel like a Jest specific issue 👍

from vue-jest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.