Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Learning React | 3,311 | 3 months ago | 115 | JavaScript | ||||||
The code samples for Learning React by Alex Banks and Eve Porcello, published by O'Reilly Media | ||||||||||
Mastering React Test Driven Development | 111 | a year ago | 5 | mit | ||||||
Mastering React Test-Driven Development, published by Packt | ||||||||||
Ngxs Example App | 33 | 2 years ago | 7 | mit | TypeScript | |||||
(A port of ngrx-example-app) This app is a book collection manager. The user can authenticate, use the Google Books API to search for books and add them to their collection. https://ngxs-example-app.netlify.app | ||||||||||
Awesome Address Book | 18 | 2 years ago | mit | TypeScript | ||||||
This project shows a basic address book built with ReactJS, Redux Toolkit and Typescript 📖 | ||||||||||
Eloquent Js | 18 | 5 years ago | JavaScript | |||||||
Homework problems/examples from book "Eloquent JavaScript." Tests are in Jest. | ||||||||||
The Art Of Unit Testing | 13 | 5 years ago | mit | JavaScript | ||||||
Repository that contains code in Node.js from the book The Art of Unit Testing, Second Edition by Roy Osherove | ||||||||||
React Mybooks | 12 | 6 years ago | mit | JavaScript | ||||||
MyBooks 📚 is a bookshelf app that allows users to select and categorize books they have read, are currently reading, or want to read | ||||||||||
Bookstore Cms | 12 | 3 years ago | JavaScript | |||||||
A Bookstore CMS made with React-Redux. Tested with Jest. | ||||||||||
Typonomikon | 11 | 2 months ago | Coq | |||||||
Źródła mojej książki o Coqu, programowaniu funkcyjnym, teorii typów, logice konstruktywnej i innych takich. | ||||||||||
Shuwa Frontend Book App | 8 | 2 years ago | 1 | JavaScript | ||||||
秀和システム「フロントエンド開発入門 プロフェッショナルな開発ツールと設計・実装 」書籍内で利用するサンプルアプリケーションです。 |
Jest-snapshots-book is a custom jest reporter that builds html representations of snapshots. It is designed for snapshot testing React components. Here is an article on Medium that I've written about this reporter.
Jest-snapshots-book reporter recursively goes through the tested component and all its' parents and grabs all styles. Grabbed styles are inserted in the component page so that you can see styled React component there.
The reporter takes raw expected snapshot content from a component .snap file. Then it makes the actual snapshot by applying diff from a failed test result to the expected snapshot.
Each time when jest is run this reporter will produce a book of snapshots with table of contents. The book will be placed in the folder "snapshots-book" in the root of your project.
You can check out your snapshots in the browser instead of manually listing them in your code editor.
Here is an example of a test file for a paginator React component:
import React from 'react';
import { configure, render } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Paginator from './Paginator';
configure({ adapter: new Adapter() });
describe('Paginator', () => {
const snapshoot = (tp, cp) => {
const wrapper = render(<Paginator tp={tp} cp={cp} />);
it(`Total = ${tp}, Current = ${cp}`, () => {
expect(wrapper).toMatchSnapshot();
});
}
snapshoot(0, 0);
snapshoot(1, -1);
snapshoot(1, 1);
snapshoot(2, 2);
snapshoot(3, 1);
for (let cp = 1; cp <= 10; cp++) {
snapshoot(10, cp);
}
});
Here is the result produced by jest-snapshots-book reporter. If a test passed only one snapshot is shown because expected and actual snapshots are the same. If a test failed expected and actual snapshots are shown side by side. Clicking on the snapshot toggles its' representation (rendered, raw, diff).
Install as a dev dependency:
$ npm install --save-dev jest-snapshots-book
Add the reporter after the default jest reporter in the configuration file:
"reporters": [
"default",
"jest-snapshots-book"
]
Add the reporter directory to ignored paths:
"modulePathIgnorePatterns": [
"<rootDir>/snapshots-book"
],
"watchPathIgnorePatterns": [
"<rootDir>/snapshots-book"
]
To enable verbose mode of the reporter pass "verbose": true
as an additional parameter when initializing the reporter:
"reporters": [
"default",
["jest-snapshots-book", {"verbose": true}]
]