Skip to content

Fix snapshots breaking inside tables

Choose a tag to compare

@TheJaredWilcurt TheJaredWilcurt released this 04 Feb 16:25
6ed5b96

Breaking changes to API

  • none

Breaking changes to snapshots

  • Because we have switched from JSDOM to Cheerio with this release:
    • Empty HTML attributes will now be trimmed. <div class=""></div> becomes <div class></div>.
    • Optionally self-closing HTML tags, will now be closed in snapshots. <svg><path></path></svg> becomes <svg><path /></svg>

New Features

  • Switching from JSDOM to Cheerio should speed up snapshot tests between 1.3-8x depending on machine, amount of snapshots, and types of tests.

Bug fixes

  • When switching over from regex to JSDOM, for more accurate attribute removal, we inadvertantly broke tests targeting <tr>'s and <td>'s. To fix this, we switched from JSDOM to Cheerio + HTMLParser2 under the hood.
-
-
-     First
-
-
-     Second
-
-
+ <tr>
+   <td>
+     First
+   </td>
+   <td>
+     Second
+   </td>
+ </tr>

Maintenance

  • Updated tests. Created new tests for new scenarios around tables and SVGs
  • Updated documentation
  • Added two new dependencies (cheerio, htmlparser2)
  • Test coverage went from 99.582% to 100% 🎉

Code Changes: