tjw-lint / vue3-snapshot-serializer

Vitest/Jest Snapshot Serializer for Vue 3 components
https://TheJaredWilcurt.com/vue-snapshot-serializer
MIT License
3 stars 2 forks source link

Diffable Formatter Setting: Preserve whitespace in specific tags #15

Closed TheJaredWilcurt closed 2 weeks ago

TheJaredWilcurt commented 1 month ago

With this input:

<div>Hello World</div>
<a>Hello World</a>
<pre>Hello World</pre>

The following settings produce different results:

<!-- Default settings -->
<!-- global.vueSnapshots.formatting.tagsWithWhitespacePreserved = ['a', 'pre']; -->
<div>
  Hello World
</div>
<a>Hello World</a>
<pre>Hello World</pre>
<!-- global.vueSnapshots.formatting.tagsWithWhitespacePreserved = ['div']; -->
<div>Hello World</div>
<a>
  Hello World
</a>
<pre>
  Hello World
</pre>
<!-- Preserve whitespace in no tags with `false` or `[]` -->
<!-- global.vueSnapshots.formatting.tagsWithWhitespacePreserved = []; -->
<!-- global.vueSnapshots.formatting.tagsWithWhitespacePreserved = false; -->
<div>
  Hello World
</div>
<a>
  Hello World
</a>
<pre>
  Hello World
</pre>
<!-- Preserve whitespace in all tags with `true` -->
<!-- global.vueSnapshots.formatting.tagsWithWhitespacePreserved = true; -->
<div>Hello World</div>
<a>Hello World</a>
<pre>Hello World</pre>
mauryapari commented 3 weeks ago

@TheJaredWilcurt . will work on this if no issues are raised on https://github.com/tjw-lint/vue3-snapshot-serializer/pull/31 PR.