Socket
Socket
Sign inDemoInstall

jest-serializer-html

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-serializer-html - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 3.0.0
- Switched to [diffable-html](https://github.com/rayrutjes/diffable-html) to handle the HTML formatting
# 2.0.0

@@ -2,0 +6,0 @@

8

index.js

@@ -1,2 +0,2 @@

var beautify = require('js-beautify').html;
var toDiffableHtml = require('diffable-html');

@@ -8,8 +8,4 @@ module.exports = {

print(val) {
return beautify(val, {
unformatted: [],
wrap_attributes: 'force-aligned',
indent_size: 2
});
return toDiffableHtml(val);
},
};
{
"name": "jest-serializer-html",
"version": "2.0.0",
"version": "3.0.0",
"description": "Jest snapshot serializer that beautifies HTML.",

@@ -37,3 +37,3 @@ "main": "index.js",

"dependencies": {
"js-beautify": "^1.6.12"
"diffable-html": "^1.0.0"
},

@@ -40,0 +40,0 @@ "devDependencies": {

@@ -8,3 +8,3 @@ # A Jest snapshot serializer that beautifies HTML.

This serializer is based on [js-beautify](https://github.com/beautify-web/js-beautify) and is configured to indent HTML tags as much as possible to ease readability of diffs in case of failing snapshot tests.
This serializer is based on [diffable-html](https://github.com/rayrutjes/diffable-html) which is an opinionated HTML formatter that will ease readability of diffs in case of failing snapshot tests.

@@ -45,3 +45,5 @@ ## Install

<li>
<a href="#">My HTML</a>
<a href="#">
My HTML
</a>
</li>

@@ -65,3 +67,3 @@ </ul>

<h1>Hello ${ msg }!</h1>
<ul><li><a href="#">My HTML</a></li></ul>
<ul id="main-list" class="list"><li><a href="#">My HTML</a></li></ul>
`

@@ -88,6 +90,12 @@ };

exports[`should beautify HTML 1`] = `
<h1>Hello You!</h1>
<ul>
<h1>
Hello You!
</h1>
<ul id="main-list"
class="list"
>
<li>
<a href="#">My HTML</a>
<a href="#">
My HTML
</a>
</li>

@@ -98,4 +106,6 @@ </ul>

You can read more about the [HTML formatting here](https://github.com/rayrutjes/diffable-html#readme).
## Special thanks
This package was inspired by the amazing post here: [Jest for all: Episode 1 — Vue.js](https://hackernoon.com/jest-for-all-episode-1-vue-js-d616bccbe186) by [Cristian Carlesso](https://hackernoon.com/@kentaromiura_the_js_guy).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc