-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlatPickr component does not render correctly in vitest tests, may be because of UMD build #283
Comments
Well you can see my test cases in this repo |
Looks like we already generates esm build. |
Hi, I'd like to re-open this issue because I'm seeing the same behaviour with this package after moving to
This appears to be because vitest is importing the UMD module from the "main": "dist/index.umd.js", As a UMD module, the default export is an object, with a According to an issue comment, Adding
|
This allows consumers to import the ESM or UMD build depending on the project type. Fixes #283
Please test with version 11.0.4 and let me know |
Upgrading to |
I'm submitting a ... (check one with "x")
Tell about your platform
Current behavior
Everything works fine when running the package normally, but when testing using vitest 0.34.2 a warning is logged saying "Component is missing template or render function." and the component does not seem to function correctly.
Expected behavior
The component should be mounted normally in vitest tests and not log any warning.
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/github-6m2gtt
run the
pnpm test:unit
command to see the warning.I previously opened an issue with Vue Test Utils thinking that the problem was in that package, but one of the maintainers found that the problem seems to be in the UMD build of vue-flatpickr-component (which vitest uses). This is why the bug only occurs in tests, since running the server in vite normally uses the ESM build.
vuejs/test-utils#2182
The text was updated successfully, but these errors were encountered: