-
Notifications
You must be signed in to change notification settings - Fork 22
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
Istanbul coverage interference #37
Comments
I found out additional info... when I put some object into binded attribut <div :some="{ prop: true }"> result in template is <div :some="[object Object]"> which is good also for snapshots as it does not change. <div :some="() => { return true; }"> results in (when using coverage) <div :some="function () {
/* istanbul ignore next */
cov_coc3bbk03.f[36]++;
cov_coc3bbk03.s[147]++;
return true;
}"> same result for referenced functions <div :some="someFunction"> and that is isolated behaviour which breaks those snapshot tests |
By default, this issue is resolved in v3.16.0+ of my fork of Jest-Serializer-Vue (among many other features). You should read the comments in this issue: tjw-lint#71 My fork, and instructions on how to replace |
You can also optionally enable a setting to replace all inline functions with a placeholder, as of v3.17.0 of Jest-Serializer-Vue-TJW. Your screenshot snapshot would look more like this: <h6>user.profile.title</h6>
<wp-input-stub value="" restrict="0-9A-Za-z\-\." path="user.personalInformation.login" required="true" name="username" label="user.login.label" autocomplete="username" debounce="300" rules="[function]"> I don't use inline functions, so if you try out either feature ( |
First of all, thank you for your contribution.
I am using jest snapshot for snapshoting template state of Vue component - SFC (single file component) and instanbul comments get into template and so it breaks snapshots. I think it is Vue loader or something which replaces controller functions references in templates with their implementation. Maybe serializer would removesuch javascript code from templates? 🙏 🤷
template source look like this:
Thank you for any help 🙏
The text was updated successfully, but these errors were encountered: