Skip to content

Releases: tjw-lint/vue3-snapshot-serializer

v2.6.0 - Stubs

17 Feb 16:28
52fc797
Compare
Choose a tag to compare

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

11 Feb 22:48
543d94f
Compare
Choose a tag to compare

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

20 Jan 19:03
83c7332
Compare
Choose a tag to compare

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

20 Jan 14:59
fc3eb7e
Compare
Choose a tag to compare

Features:

  • The formatter used by jest-serializer-vue-tjw is now available in vue3-snapshot-serializer as "Classic"
    • global.vueSnapshots.formatter = 'classic'; - Switch from 'diffable' to 'classic'
    • global.vueSnapshots.classicFormatter = {}; - pass in any settings. They are documented in types.js

Maintenance:

  • Test coverage remains at 100%
  • Updated types.js for new API

Diff:

v2.2.0 - Classes Per Line and Sorted Classes

14 Jan 17:00
f1b4ac1
Compare
Choose a tag to compare

Features:

  • There is now an sortClasses option to sort your classes, similar to sortAttributes. 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 to formatting.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

13 Jan 03:43
83ab078
Compare
Choose a tag to compare

Features:

  • New Diffable formatting option escapeAttributes was added. Previously, attributes used the same setting as escapeInnerText. 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 use htmlparser2 for AST generation, replacing parse5. 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

16 Dec 18:15
6ec2526
Compare
Choose a tag to compare

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'. Use postProcessor 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

13 Dec 14:07
7260c4f
Compare
Choose a tag to compare

Features:

  • Now the test and print functions can be directly imported. Thanks to @FloEdelmann for (#69)

Maintenance:

  • Update dependencies
  • Test coverage remains at 100%

Diff:

v1.0.0 - Types

11 Dec 16:36
e821303
Compare
Choose a tag to compare

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

30 Nov 19:36
7816214
Compare
Choose a tag to compare

Features:

  • Updated the list of self-closing SVG tags to include filter tags.

Maintenance:

  • Test coverage remains at 100%

Diff: