Releases: tjw-lint/jest-serializer-vue-tjw
Improved arrow function detection in snapshots
Breaking changes to API
- None
Breaking changes to snapshots
- Some snapshots may change around inline functions.
- If you updated Vue and your comments stopped being on their own lines, now they should be restore back to the previous style.
New Features
- Improved support for arrow functions when rendered in the markup.
Special thanks to: @korya.
Bug fixes
- None
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
Code Changes:
- v3.19.0...v3.20.0
- v3.18.0...v3.20.0
- v3.17.0...v3.20.0
- v3.16.0...v3.20.0
- v3.15.0...v3.20.0
- v3.14.0...v3.20.0
- v3.13.0...v3.20.0
- v3.12.0...v3.20.0
- v3.11.0...v3.20.0
- v3.10.0...v3.20.0
- v3.9.0...v3.20.0
- v3.8.0...v3.20.0
- v3.7.0...v3.20.0
- v3.6.0...v3.20.0
- v3.5.0...v3.20.0
- v3.4.0...v3.20.0
- v3.3.0...v3.20.0
- v3.2.0...v3.20.0
- v3.1.0...v3.20.0
- v3.0.0...v3.20.0
Allow settings to be stored in package.json
Breaking changes to API
- None
Breaking changes to snapshots
- None
New Features
- You can store your settings in your
package.json
now if you don't want to use thevue.config.js
.
Special thanks to: @dschreij and @ataias.
Bug fixes
- None
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
- Updated docs
- Renamed
master
branch tomain
- Deleted coveralls/travis stuff
- Improved GHA stuff
- Added an automated coverage comment after each CI run
- CI now runs on Node 16, still runs on Node 8.3, 10, 12, and 14 also
Code Changes:
- v3.18.0...v3.19.0
- v3.17.0...v3.19.0
- v3.16.0...v3.19.0
- v3.15.0...v3.19.0
- v3.14.0...v3.19.0
- v3.13.0...v3.19.0
- v3.12.0...v3.19.0
- v3.11.0...v3.19.0
- v3.10.0...v3.19.0
- v3.9.0...v3.19.0
- v3.8.0...v3.19.0
- v3.7.0...v3.19.0
- v3.6.0...v3.19.0
- v3.5.0...v3.19.0
- v3.4.0...v3.19.0
- v3.3.0...v3.19.0
- v3.2.0...v3.19.0
- v3.1.0...v3.19.0
- v3.0.0...v3.19.0
Sorting Attributes is enabled by default
Breaking changes to API
- None, though some may want to opt out of a new default by setting
sortAttributes
to false,
Breaking changes to snapshots
Attributes are now sorted by default.
-<div title="Good job" id="my-alert" class="success alert">
+<div class="success alert" id="my-alert" title="Good job">
Good job
</div>
New Features
- Sorting attributes. This helps simplify diffs. Without sorting, a snapshot change could occur from just re-arranging the attributes, which could be very noisy, making it harder to see the more important changes of attributes missing or being added unintentionally.
Bug fixes
- None
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
- Updated docs
Code Changes:
- v3.17.0...v3.18.0
- v3.16.0...v3.18.0
- v3.15.0...v3.18.0
- v3.14.0...v3.18.0
- v3.13.0...v3.18.0
- v3.12.0...v3.18.0
- v3.11.0...v3.18.0
- v3.10.0...v3.18.0
- v3.9.0...v3.18.0
- v3.8.0...v3.18.0
- v3.7.0...v3.18.0
- v3.6.0...v3.18.0
- v3.5.0...v3.18.0
- v3.4.0...v3.18.0
- v3.3.0...v3.18.0
- v3.2.0...v3.18.0
- v3.1.0...v3.18.0
- v3.0.0...v3.18.0
New API setting to clear Inline Functions from snapshots
Breaking changes to API
- None.
Breaking changes to snapshots
- None.
If you set clearInlineFunctions
to true (false by default), then you will see diffs like this:
-<div something="function () {
- /* more function code */
- return true;
-}">
+<div something="[function]">
Special thanks to @cameron-martin and @luckylooke for finding and reporting the Istanbul issue.
New Features
- New API setting to replace inline functions with a placeholder
[function]
. Disabled by default. - PERFORMANCE NOTE: I rearranged some code so that we do fewer transforms between static text and Cheerio objects for DOM/String manipulation of snapshots. This may give some minor performance improvements on large codebases with lots of snapshots.
Bug fixes
- None.
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
- Updated docs
Code Changes:
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
Code Changes:
Remove data-cy from snapshots
Breaking changes to API
- none
Breaking changes to snapshots
The HTML parser we use got a major bump (4.1.0
-> 5.0.0
). The only change I've notice is putting end tags on a new line. Which looks more like a bug-fix on their end.
<div class="alert">
- <!----> Success</div>
+ <!----> Success
+</div>
New Features
- For those using Cypress for E2E testing, added the ability to optionally remove
data-cy="whatever"
from snapshots. This is disabled by default.
Bug fixes
- None
Maintenance
- Test coverage remains at 100%
- Updated dependencies.
- Updated docs
Code Changes:
Bug fix and performance increase
Breaking changes to API
- none
Breaking changes to snapshots
- In expectations that pass in a Vue wrapper (instead of using
wrapper.html()
) in projects that haveaddInputValues
andstringifyObjects
set to false (the defaults), tags without content that were previously on one line may now be broken up to two lines. This is due to the difference in how the wrapper was converted to HTML.
-<div class="example"></div>
+<div class="example">
+</div>
New Features
- none
Bug fixes
- There was a bug where all serializations were causing a VNode to be cloned if the user passed in a
wrapper
(rather than an string of the wrapper,wrapper.html()
). This cloning should only occur if you are using the experimental featuresstringifyObjects
oraddInputValues
. - These changes should improve performance for users not using these experimental features.
- Snapshots that were breaking (that shouldn't have) during an upgrade to 3.12 or 3.13 should be fixed.
Maintenance
- Test coverage remains at 100%
Code Changes:
Clear Attributes feature & Yarn partial support
Breaking changes to API
- none
Breaking changes to snapshots
- none
New Features
- You can now pass in an array of attributes to have their values cleared. This is useful when you have a particular attribute that is set to the random number for example.
{ attributesToClear: ['data-random'] }
.
<div :data-random="Math.random()"></div>
-<div data-random="0.1407138529114249"></div>
+<div data-random></div>
- Yarn users are now partially-supported. Although there is absolutely no reason to use Yarn after 2017 (npm is faster and supports the same features built in or via Node modules). So you really shouldn't be using it, but for those stuck at a job that forces you to use Less, Grunt, Yarn, CoffeeScript, or any other outdated technology, you have my sympathy. Hopefully this at least provides a path forward for these groups so they can slowly migrate towards better technologies. You've got Vue and Jest, so at least you're headed in the right direction.
Bug fixes
- none
Maintenance
- Test coverage remains at 100%
- Updated dependencies
- Updated documentation
Code Changes:
Input values visible in snapshots
Breaking changes to API
- none
Breaking changes to snapshots
- Improved
stringifyObjects
output. We now specifically handle different data types and output more accurate/useful string'd versions. Including many more data types than was previously handled.
Example of improvements:
<hr :title="new Date('2020')" />
- <hr title="{}">
+ <hr title="1577836800000">
<hr :title="new Date('asdf')" />
- <hr title="{}">
+ <hr title="Invalid Date">
<hr :title="new Error('err')" />
- <hr title="{}">
+ <hr title="Error: err">
<hr :title="Infinity" />
- <hr title="null">
+ <hr title="Infinity">
<hr :title="-Infinity" />
- <hr title="null">
+ <hr title="-Infinity">
<hr :title="NaN" />
- <hr title="null">
+ <hr title="NaN">
<hr :title="new Set(['a', 'b', 'b', 'c'])" />
- <hr title="{}">
+ <hr title="['a','b','c']">
<hr :title="String" />
- <hr title>
+ <hr title="Function">
<hr :title="undefined" />
- <hr title>
+ <hr title="undefined">
New Features
- There is now a
verbose
setting. This is set to true by default. Setting it to false will disable any console logs or errors from being output (not recommended, especially if using experimental features). addInputValues
is a new experimental feature to display the values of input elements as attributes in snapshots. This feature is disabled by default and requires you pass in a component wrapper, not an already flattened HTML string (wrapper
notwrapper.html()
). If your components are too large it will throw a max callstack exceeded error (this is why it is experimental, however on these components you can just pass inwrapper.html()
to skip the feature on that snapshot).
-<input class="theme">
+<input class="theme" value="dark">
- Note: In cases where a value would already be visible in the output, but does not give you information about what the current state of the input is, we add a
v-model
attribute instead of replacing thevalue
attribute. Such as with radio dials:
-<input type="radio" value="cat">
-<input type="radio" value="dog">
+<input type="radio" value="cat" v-model="'dog'">
+<input type="radio" value="dog" v-model="'dog'">
Bug fixes
- none
Maintenance
- Added quote from Views on Vue podcast
- Refactored many files to improve code quality and modularity.
- Updated and improved documentation
- Test coverage remains at 100%
- Organized test files better
- Set Travis-CI to use Node 8.3.0, the lowest version of Node this library supports, to ensure that support is not unintentially broken with the usage of newer JS features or dependency updates.
- Updated dependencies
- Improve tests
Code Changes:
Support Node 8.3+, improve docs
Breaking changes to API
- none
Breaking changes to snapshots
- none
New Features
- Now supports Node 8.3.0+ (previously required Node 12+)
- New Logo from the wonderful and talented Aurora Wooton
Bug fixes
- none
Maintenance
- Refactored a function to make it much simpler, and in the process allow for older Node versions to run the project
- Re-write and reorganize the documentation
- Test coverage remains at 100%