Replies: 1 comment 2 replies
-
Hi Joe, thank you for opening a discussion. VTU does not use mixins if your code doesn't, so you should not get this warning. I suspect the component you're trying to test is using a mixin? If you think this is an issue with VTU, you can open an issue with a minimal reproduction and we'll take a look. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use mocha and vue test utils to test a Vue3 proof of concept app. Initially I was getting a feature flag warning that said this:
Feature flag __VUE_OPTIONS_API__ is not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
I'm not sure if this is coming from webpack or what?
So I added this to my webpack config file to explicitly set it to not allow usage of the Options API:
new WebpackPlugin.DefinePlugin({ __VUE_OPTIONS_API__: false, } ),
That makes the Feature flag warning go away, but when I do that, and use the vue test utils mount() method to mount my app, I get these warnings:
[Vue warn]: Mixins are only available in builds supporting Options API [Vue warn]: Property "count" was accessed during render but is not defined on instance. at <AppStart name="Alex" ref="VTU_COMPONENT" > at <VTUROOT>
They go away if I comment out the mount() method call. So, I'm guessing vue test utils is using mixins and the Options API.
We don't want to allow our code to use the Options API so not sure how to handle this? I would expect since this version of vue test utils is specifically for Vue3 that it would use the Composition API?
Any guidance would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions