All Projects → ruyadorno → jest-serializer-html-string

ruyadorno / jest-serializer-html-string

Licence: MIT license
A better Jest snapshot serializer for plain html strings

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jest-serializer-html-string

A11y.css
This CSS file intends to warn developers about possible risks and mistakes that exist in HTML code. It can also be used to roughly evaluate a site's quality by simply including it as an external stylesheet.
Stars: ✭ 1,277 (+7411.76%)
Mutual labels:  test, markup
Preact Jest Snapshot Test Boilerplate
🚀 Test Preact components using Jest snapshots
Stars: ✭ 24 (+41.18%)
Mutual labels:  serializer, snapshot
Snap Shot
Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
Stars: ✭ 170 (+900%)
Mutual labels:  test, snapshot
reducer-tester
Utilities for testing redux reducers
Stars: ✭ 19 (+11.76%)
Mutual labels:  test, snapshot
Snapshooter
Snapshooter is a snapshot testing tool for .NET Core and .NET Framework
Stars: ✭ 118 (+594.12%)
Mutual labels:  test, snapshot
Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (+711.76%)
Mutual labels:  test, snapshot
html-comment-regex
Regular expression for matching HTML comments
Stars: ✭ 15 (-11.76%)
Mutual labels:  string, test
BaNG
Backup Next Generation for Linux & Mac using rsync (support hardlinks and btrfs snapshots), Web-Frontend, Statistics, History-Merger)
Stars: ✭ 28 (+64.71%)
Mutual labels:  snapshot
inside-vm
Detect if code is running inside a virtual machine (x86 and x86-64 only).
Stars: ✭ 32 (+88.24%)
Mutual labels:  test
MathLib
The Math Algorithm
Stars: ✭ 38 (+123.53%)
Mutual labels:  test
MGObfuscator
An easy encryptor / decryptor for iOS
Stars: ✭ 17 (+0%)
Mutual labels:  string
ebs-snapshot-lambda
AWS lambda function to snapshot EBS volumes and purge old snapshots.
Stars: ✭ 37 (+117.65%)
Mutual labels:  snapshot
jest-puppe-shots
A Jest plugin for creating screenshots of React components with a little help of Puppeteer
Stars: ✭ 86 (+405.88%)
Mutual labels:  snapshot
Swiftmazing
A iOS application with layout based on App Store that can check the most starred and last updated Swift repository
Stars: ✭ 73 (+329.41%)
Mutual labels:  snapshot
botium-cli
Botium CLI - The Selenium for Chatbots
Stars: ✭ 27 (+58.82%)
Mutual labels:  test
Testables
Make private properties testable
Stars: ✭ 40 (+135.29%)
Mutual labels:  test
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+482.35%)
Mutual labels:  test
logunit
A Java library for unit-testing logging.
Stars: ✭ 40 (+135.29%)
Mutual labels:  test
TorXakis
A tool for Model Based Testing
Stars: ✭ 40 (+135.29%)
Mutual labels:  test
btrfs-backup
A simple, flexible script for versioned backups using btrfs and rsync
Stars: ✭ 59 (+247.06%)
Mutual labels:  snapshot

jest-serializer-html-string NPM version Build Status

A slightly better Jest snapshot serializer for working with strings containing rendered html.

Example

Given:

function renderElem(props) {
	return `<body>
				<div class="home active">
					<h1><img src="${ props.img }" alt="Foo"/></h1><div>Hello</div>
					<p><span class="something">Hey</span>
					<img src="${ props.img }" /></p>
				</div>
			</body>
	`;
}

expect(renderElem({ img: '/foo.png' })).toMatchSnapshot();

Produces beautified snapshot:

<body>
  <div class="home active">
    <h1>
      <img src="/foo.png" alt="Foo" />
    </h1>
    <div>Hello</div>
    <p>
      <span class="something">Hey</span>
      <img src="/foo.png" />
    </p>
  </div>
</body>

Setup

Install from npm:

npm install --save-dev jest-serializer-html-string

Add it to your Jest config:

"jest": {
  "snapshotSerializers": ["jest-serializer-html-string"]
}

Please refer to the Jest snapshotSerializers config docs if you need more info.

License

MIT © Ruy Adorno

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].