Skip to content

Commit 9f19467

Browse files
brikouarunoda
authored andcommitted
Upgrade jest and simplify .babelrc (vercel#1913)
* Upgrade jest and simplify .babelrc * Fix linter
1 parent 6ff40c3 commit 9f19467

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

examples/with-jest/.babelrc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"env": {
33
"development": {
4-
"presets": ["next/babel"]
4+
"presets": "next/babel"
55
},
66
"production": {
7-
"presets": ["next/babel"]
7+
"presets": "next/babel"
88
},
99
"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+
]
1314
}
1415
}
1516
}

examples/with-jest/__tests__/__snapshots__/index.test.js.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`With Snapshot Testing App shows "Hello world!" 1`] = `
24
<div
3-
data-jsx={2648947580}>
5+
data-jsx={2648947580}
6+
>
47
<p
5-
data-jsx={2648947580}>
8+
data-jsx={2648947580}
9+
>
610
Hello World!
711
</p>
812
</div>

examples/with-jest/__tests__/index.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
/* global it, expect, describe */
1+
/* eslint-env jest */
22

3-
import React from 'react'
43
import { shallow } from 'enzyme'
4+
import React from 'react'
55
import renderer from 'react-test-renderer'
6+
67
import App from '../pages/index.js'
78

89
describe('With Enzyme', () => {
910
it('App shows "Hello world!"', () => {
10-
const app = shallow(
11-
<App />
12-
)
11+
const app = shallow(<App />)
1312

1413
expect(app.find('p').text()).toEqual('Hello World!')
1514
})

examples/with-jest/package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
"name": "with-jest",
33
"dependencies": {
44
"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"
713
},
814
"scripts": {
915
"test": "jest",
1016
"dev": "next",
1117
"build": "next build",
1218
"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"
2019
}
2120
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy