File tree Expand file tree Collapse file tree 4 files changed +24
-21
lines changed Expand file tree Collapse file tree 4 files changed +24
-21
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"env" : {
3
3
"development" : {
4
- "presets" : [ " next/babel" ]
4
+ "presets" : " next/babel"
5
5
},
6
6
"production" : {
7
- "presets" : [ " next/babel" ]
7
+ "presets" : " next/babel"
8
8
},
9
9
"test" : {
10
- // next/babel does not transpile import/export syntax.
11
- // So, using es2015 in the beginning will fix that.
12
- "presets" : [" es2015" , " next/babel" ]
10
+ "presets" : [
11
+ [" env" , { "modules" : " commonjs" }],
12
+ " next/babel"
13
+ ]
13
14
}
14
15
}
15
16
}
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
1
3
exports [` With Snapshot Testing App shows "Hello world!" 1` ] = `
2
4
<div
3
- data-jsx = { 2648947580 } >
5
+ data-jsx = { 2648947580 }
6
+ >
4
7
<p
5
- data-jsx = { 2648947580 } >
8
+ data-jsx = { 2648947580 }
9
+ >
6
10
Hello World!
7
11
</p >
8
12
</div >
Original file line number Diff line number Diff line change 1
- /* global it, expect, describe */
1
+ /* eslint-env jest */
2
2
3
- import React from 'react'
4
3
import { shallow } from 'enzyme'
4
+ import React from 'react'
5
5
import renderer from 'react-test-renderer'
6
+
6
7
import App from '../pages/index.js'
7
8
8
9
describe ( 'With Enzyme' , ( ) => {
9
10
it ( 'App shows "Hello world!"' , ( ) => {
10
- const app = shallow (
11
- < App />
12
- )
11
+ const app = shallow ( < App /> )
13
12
14
13
expect ( app . find ( 'p' ) . text ( ) ) . toEqual ( 'Hello World!' )
15
14
} )
Original file line number Diff line number Diff line change 2
2
"name" : " with-jest" ,
3
3
"dependencies" : {
4
4
"next" : " latest" ,
5
- "react" : " ^15.4.2" ,
6
- "react-dom" : " ^15.4.2"
5
+ "react" : " ^15.5.4" ,
6
+ "react-dom" : " ^15.5.4"
7
+ },
8
+ "devDependencies" : {
9
+ "enzyme" : " ^2.8.2" ,
10
+ "jest" : " ^20.0.0" ,
11
+ "react-addons-test-utils" : " ^15.5.1" ,
12
+ "react-test-renderer" : " ^15.5.4"
7
13
},
8
14
"scripts" : {
9
15
"test" : " jest" ,
10
16
"dev" : " next" ,
11
17
"build" : " next build" ,
12
18
"start" : " next start"
13
- },
14
- "devDependencies" : {
15
- "enzyme" : " ^2.5.1" ,
16
- "jest-cli" : " ^18.0.0" ,
17
- "react-addons-test-utils" : " ^15.4.2" ,
18
- "babel-preset-es2015" : " ^6.22.0" ,
19
- "react-test-renderer" : " ^15.4.2"
20
19
}
21
20
}
You can’t perform that action at this time.
0 commit comments