A bandaid for Istanbul
Breaking changes to API
- None. Added new
removeIstanbulComments
setting to API which is enabled by default.
Breaking changes to snapshots
Previously, inline functions like this:
<div :title="function () { return true; }">
Would produce a snapshot with flags injected into it by Istanbul, if you were running Jest with --coverage
.
<div title="function () {
/* istanbul ignore next *\/
cov_1lmjj6lxv1.f[3]++;
cov_1lmjj6lxv1.s[15]++;
return true;
}">
The random looking part of cov_1lmjj6lxv1.f[3]++;
would change depending on the machine it was running on, breaking snapshot usability.
We now remove these inserted comments by default:
<div title="function () {
- /* istanbul ignore next *\/
- cov_1lmjj6lxv1.f[3]++;
- cov_1lmjj6lxv1.s[15]++;
return true;
}">
IMPORTANT NOTE: Since Istanbul modifies the DOM when Jest is ran with it, and does not when it is ran with --coverage=false
, your snapshots that include inline functions will always fail when --coverage
is not used (or --coverage=false
is used). To learn more, and a potential workaround, see Issue #71.
PERFORMANCE NOTE: If you are not using inline functions and therefore not effected by this, you can change the removeIstanbulComments
setting to false for potentially faster test runs.
Special thanks to @cameron-martin and @luckylooke for finding and reporting the Istanbul issue.
New Features
- None
Bug fixes
- None, unless you count putting a bandaid over Istanbul's bug.
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
- Updated docs