Skip to content

Commit

Permalink
Add jest-html
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukii committed Mar 20, 2017
1 parent b05bbae commit ed4ca27
Show file tree
Hide file tree
Showing 6 changed files with 415 additions and 18 deletions.
5 changes: 4 additions & 1 deletion .jestrc
@@ -1,3 +1,6 @@
{ {
"snapshotSerializers": ["./node_modules/jest-serializer-enzyme"] "snapshotSerializers": [
"./node_modules/jest-serializer-enzyme",
"./node_modules/jest-html"
]
} }
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -29,3 +29,9 @@ If you want to update snapshots, hit it with -u option.
```$xslt ```$xslt
$ yarn test -- -u $ yarn test -- -u
``` ```

To check snapshot as more like HTML, you can use jest-html

```$xslt
$ yarn jest-html
```
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -5,7 +5,8 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "webpack-dev-server --progress --inline --hot", "start": "webpack-dev-server --progress --inline --hot",
"test": "jest --config .jestrc" "test": "jest --config .jestrc",
"jest-html": "jest-html"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
Expand All @@ -17,6 +18,7 @@
"babel-preset-react-hmre": "^1.1.1", "babel-preset-react-hmre": "^1.1.1",
"enzyme": "^2.7.1", "enzyme": "^2.7.1",
"jest": "^19.0.2", "jest": "^19.0.2",
"jest-html": "^1.3.4",
"jest-serializer-enzyme": "^1.0.0", "jest-serializer-enzyme": "^1.0.0",
"react": "^15.4.2", "react": "^15.4.2",
"react-addons-test-utils": "^15.4.2", "react-addons-test-utils": "^15.4.2",
Expand Down
10 changes: 10 additions & 0 deletions src/__tests__/__snapshots__/test-enzyme.js.snap
Expand Up @@ -16,4 +16,14 @@ exports[`Greeting Hello enzyme is displayed? 1`] = `
</div> </div>
</div> </div>
</App> </App>
------------HTML PREVIEW---------------
<App greeting="Hello enzyme">
<div class="container">
<div class="jumbotron">
<h1>
Hello enzyme
</h1>
</div>
</div>
</App>
`; `;
8 changes: 8 additions & 0 deletions src/__tests__/__snapshots__/test-simple.js.snap
Expand Up @@ -12,4 +12,12 @@ exports[`Greeting Hello simple is displayed? 1`] = `
</h1> </h1>
</div> </div>
</div> </div>
------------HTML PREVIEW---------------
<div class="container">
<div class="jumbotron">
<h1>
Hello simple
</h1>
</div>
</div>
`; `;

0 comments on commit ed4ca27

Please sign in to comment.