File tree Expand file tree Collapse file tree 5 files changed +295
-16
lines changed
Expand file tree Collapse file tree 5 files changed +295
-16
lines changed Original file line number Diff line number Diff line change 1+ const Enzyme = require ( 'enzyme' ) ;
2+ const Adapter = require ( 'enzyme-adapter-react-16' ) ;
3+
4+ Enzyme . configure ( { adapter : new Adapter ( ) } ) ;
Original file line number Diff line number Diff line change 1414 "@babel/preset-env" : " ^7.8.4" ,
1515 "@babel/preset-react" : " ^7.8.3" ,
1616 "@preconstruct/cli" : " ^1.1.7" ,
17- "prettier" : " 1.19.1"
17+ "enzyme" : " ^3.11.0" ,
18+ "enzyme-adapter-react-16" : " ^1.15.2" ,
19+ "enzyme-to-json" : " ^3.4.4" ,
20+ "jest" : " ^25.1.0" ,
21+ "prettier" : " 1.19.1" ,
22+ "react" : " ^16.12.0"
1823 },
1924 "preconstruct" : {
2025 "packages" : [
2126 " packages/*" ,
2227 " !packages/docs"
2328 ]
2429 },
30+ "jest" : {
31+ "moduleDirectories" : [" node_modules" ],
32+ "setupFiles" : [
33+ " ./enzyme.config.js"
34+ ]
35+ },
2536 "scripts" : {
2637 "postinstall" : " preconstruct dev" ,
2738 "build" : " preconstruct build" ,
2839 "release" : " preconstruct build" ,
29- "test" : " echo skip " ,
40+ "test" : " jest " ,
3041 "prettier" : " prettier --check ./packages/**/*.js --ignore-path .gitignore" ,
3142 "prettier:fix" : " prettier --check ./packages/**/*.js --ignore-path .gitignore --write"
3243 }
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` core component will render 1` ] = `
4+ <div >
5+ HelloWorld
6+ </div >
7+ ` ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import { shallow } from "enzyme" ;
3+ import HelloWorld from "../src" ;
4+ import toJson from "enzyme-to-json" ;
5+
6+ describe ( "core component" , ( ) => {
7+ test ( "will render" , ( ) => {
8+ const cmp = shallow ( < HelloWorld /> ) ;
9+ expect ( toJson ( ( cmp ) ) ) . toMatchSnapshot ( ) ;
10+ } ) ;
11+ } ) ;
You can’t perform that action at this time.
0 commit comments