-
Notifications
You must be signed in to change notification settings - Fork 241
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
Vue 3 defineProps and defineEmits having issues #3305
Comments
Hi @justgrumpy thanks for opening this issue.
Yes, it does. You can see it in your error message:
The variable The problem seems to be that The only good solution (I can think of) for these kinds of problems is a feature called "ignore-plugins" described in #3229. We could create a specific As a workaround, you can insert a stryker disable comment <script setup>
import { ref } from 'vue'
+// Stryker disable next-line all: Don't mutate compiler macros
defineProps({
msg: String
})
const count = ref(0)
</script> Does that work for you? |
This does work for me. I was unaware of the ability to disable Stryker for a specific line of code. This appears to be a feature added with 5.4? An ignore-plugin would also be very convenient to eliminate so many comments. If there are several components, comments will be needed in each
|
Yes, it was added in 5.4. We're rapidly evolving currently, focusing on user experience and performance. Following @stryker_mutator on Twitter helps with keeping up to date. Our release notes should also be quite readable. About once a year, we also write a blog article with some bigger changes here: https://stryker-mutator.io/blog I'm first focussing on improving support for native ESM (see #2922), after that I want to focus on ignore plugins. Let's keep this issue open as a reminder. You can actually improve your use case a lot using this: // Stryker disable all: Don't mutate compiler macros
defineProps({
msg: { type: String, required: true },
anotherProp: { type: String, required: false }
})
// Stryker restore all See https://stryker-mutator.io/docs/stryker-js/disable-mutants/#using-a--stryker-disable-comment for the docs |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Thanks, but we want to keep this open. We shouldn't ignore the ignore plugin use case |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Summary
I am having issues using Stryker with the Vue 3
<script setup>
for Composition API inside Single File Components (SFCs). Specifically I am having issues withdefineProps
anddefineEmits
, https://v3.vuejs.org/api/sfc-script-setup.html#defineprops-and-defineemits. I get an error like the following:The app works normally and the Jest tests run fine. I assume that Stryker in mutating is doing something to reference locally declared variables causing this error???
A full sample application with the problem can be found here, https://github.com/justgrumpy/my-vue-app.
Stryker config
Test runner config
Stryker environment
Test runner environment
babel.config.js
jest.config.js
Your Environment
Add stryker.log
stryker.log
The text was updated successfully, but these errors were encountered: