Upgrade jest and simplify .babelrc (#1913)

* Upgrade jest and simplify .babelrc

* Fix linter
This commit is contained in:
Brikou CARRE 2017-05-09 18:00:25 +02:00 committed by Arunoda Susiripala
parent 6ff40c3c6a
commit 9f194677ec
4 changed files with 24 additions and 21 deletions

View file

@ -1,15 +1,16 @@
{
"env": {
"development": {
"presets": ["next/babel"]
"presets": "next/babel"
},
"production": {
"presets": ["next/babel"]
"presets": "next/babel"
},
"test": {
// next/babel does not transpile import/export syntax.
// So, using es2015 in the beginning will fix that.
"presets": ["es2015", "next/babel"]
"presets": [
["env", { "modules": "commonjs" }],
"next/babel"
]
}
}
}

View file

@ -1,8 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`With Snapshot Testing App shows "Hello world!" 1`] = `
<div
data-jsx={2648947580}>
data-jsx={2648947580}
>
<p
data-jsx={2648947580}>
data-jsx={2648947580}
>
Hello World!
</p>
</div>

View file

@ -1,15 +1,14 @@
/* global it, expect, describe */
/* eslint-env jest */
import React from 'react'
import { shallow } from 'enzyme'
import React from 'react'
import renderer from 'react-test-renderer'
import App from '../pages/index.js'
describe('With Enzyme', () => {
it('App shows "Hello world!"', () => {
const app = shallow(
<App />
)
const app = shallow(<App />)
expect(app.find('p').text()).toEqual('Hello World!')
})

View file

@ -2,20 +2,19 @@
"name": "with-jest",
"dependencies": {
"next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
"react": "^15.5.4",
"react-dom": "^15.5.4"
},
"devDependencies": {
"enzyme": "^2.8.2",
"jest": "^20.0.0",
"react-addons-test-utils": "^15.5.1",
"react-test-renderer": "^15.5.4"
},
"scripts": {
"test": "jest",
"dev": "next",
"build": "next build",
"start": "next start"
},
"devDependencies": {
"enzyme": "^2.5.1",
"jest-cli": "^18.0.0",
"react-addons-test-utils": "^15.4.2",
"babel-preset-es2015": "^6.22.0",
"react-test-renderer": "^15.4.2"
}
}