Releases: tjw-lint/vue3-snapshot-serializer
Releases · tjw-lint/vue3-snapshot-serializer
v2.6.0 - Stubs
Features:
- New "stubs" feature lets you target any element via CSS selectors and remove their innerHTML, attributes, and rename the tag.
- Example:
global.vueSnapshots.stubs = ['.example'];
<div class="example" title="parent">
<span title="child">child</span>
</div>
<!-- becomes -->
<example-stub />
Maintenance:
- Updated
types.js
- Updated dependencies
- Updated Node
Diff:
v2.5.0 - Debug/Troubleshooting
Features:
- Added
global.vueSnapshots.debug = true
option to help in troubleshooting.
Maintenance:
- Updated dependencies
- Updated
types.js
for new API - Test coverage remains at 100%
Diff:
v2.4.0 - Checkbox/Radio Dial "checked" attribute
Features:
- If using
global.vueSnapshots.addInputvalues = true;" (on by default), your snapshots will now include a
checked` attribute for Checkboxes and radio dials.<input checked="true" type="radio">
<input checked="false" type="checkbox">
Maintenance:
- Test coverage remains at 100%
Diff:
v2.3.0 - Classic Formatter
Features:
- The formatter used by
jest-serializer-vue-tjw
is now available invue3-snapshot-serializer
as "Classic"global.vueSnapshots.formatter = 'classic';
- Switch from 'diffable' to 'classic'global.vueSnapshots.classicFormatter = {};
- pass in any settings. They are documented intypes.js
Maintenance:
- Test coverage remains at 100%
- Updated
types.js
for new API
Diff:
v2.2.0 - Classes Per Line and Sorted Classes
Features:
- There is now an
sortClasses
option to sort your classes, similar tosortAttributes
. The goal is to reduce noise in snapshots to give more meaningful diffs. It is enabled by default, you'll likely see some snapshots needing updated after this.vueSnapshots.sortClasses = false;
<span class="dog cat zebra pig"></span>
vueSnapshots.sortClasses = true;
<span class="cat dog pig zebra"></span>
- There is now a
formatting.classesPerLine
option, similar toformatting.attributesPerLine
. This breaks up classes on to multiple lines based on the numeric setting (defaults to allowing 1 class on the same line as the class attribute). The goal with this setting is to decrease visual fatigue when looking at snapshot diffs, making them more "diffable".vueSnapshots.formatting.classesPerLine = 500;
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline" disabled > 9 classes </button>
vueSnapshots.formatting.classesPerLine = 1;
<button class=" bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline " disabled > 9 classes </button>
vueSnapshots.formatting.classesPerLine = 0;
<button class=" bg-blue-500 " disabled > 1 class </button>
vueSnapshots.formatting.classesPerLine = 1;
<button class="bg-blue-500" disabled > 1 class </button>
Maintenance:
- Test coverage remains at 100%
- Updated Types.js for new API
Diff:
v2.1.0 - Formatter re-write, escapeAttributes
Features:
- New Diffable formatting option
escapeAttributes
was added. Previously, attributes used the same setting asescapeInnerText
. The two have now been split up because the presumed desired default settings for each are actually different. But now you can control them, so feel free to toggle them however you like. - Total dependencies for this library has dropped from 3 down to 2 with the removal of
parse5
.
Bug fixes:
- The built-in
diffable
formatter has been re-written to usehtmlparser2
for AST generation, replacingparse5
. Expect some minor snapshot differences from this, however if you find any issues, report them. This fixes an issue involving stubbed components (#70), thanks to @FloEdelmann for reporting this bug.
Maintenance:
- Update Deps
- Test coverage remains at 100%
- Updated Types.js for new API
- Updated to latest Node 23 and npm 11
Diff:
v2.0.0 - Post Processor replaces custom formatter
Features:
- A new API feature was added,
global.vueSnapshots.postProcessor
which is a custom function you write that is handed a string of markup (after it has been formatted). Your function must return a string (not a promise).
Breaking Change:
- Previously you could set
global.vueSnapshots.formatter
to'diffable'
,'none'
, or a custom function. Now it only supports'diffable'
or'none'
. UsepostProcessor
instead. Reasoning for this change can be seen in #74.
Maintenance:
- Updated dependencies.
- Test coverage remains at 100%.
Diff:
v1.0.1 - Export `test`/`print` functions
Features:
- Now the
test
andprint
functions can be directly imported. Thanks to @FloEdelmann for (#69)
Maintenance:
- Update dependencies
- Test coverage remains at 100%
Diff:
v1.0.0 - Types
Features:
- Bumping this to v1, as I have been using it in real-world projects and not ran into any major issues. So I'm deeming it ready for general consumption. Report bugs if you find them.
- Thanks to @FloEdelmann for catching a minor bug and making a PR for it (#68)
- Updated
types.js
to match new API changes (#65)
Maintenance:
- Update dependencies
- Test coverage remains at 100%
Diff:
v0.14.0 - Self-closing SVG Filter Tags
Features:
- Updated the list of self-closing SVG tags to include filter tags.
Maintenance:
- Test coverage remains at 100%
Diff: