Commit 9f194677 authored by Brikou CARRE's avatar Brikou CARRE Committed by Arunoda Susiripala

Upgrade jest and simplify .babelrc (#1913)

* Upgrade jest and simplify .babelrc

* Fix linter
parent 6ff40c3c
{ {
"env": { "env": {
"development": { "development": {
"presets": ["next/babel"] "presets": "next/babel"
}, },
"production": { "production": {
"presets": ["next/babel"] "presets": "next/babel"
}, },
"test": { "test": {
// next/babel does not transpile import/export syntax. "presets": [
// So, using es2015 in the beginning will fix that. ["env", { "modules": "commonjs" }],
"presets": ["es2015", "next/babel"] "next/babel"
]
} }
} }
} }
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`With Snapshot Testing App shows "Hello world!" 1`] = ` exports[`With Snapshot Testing App shows "Hello world!" 1`] = `
<div <div
data-jsx={2648947580}> data-jsx={2648947580}
>
<p <p
data-jsx={2648947580}> data-jsx={2648947580}
>
Hello World! Hello World!
</p> </p>
</div> </div>
......
/* global it, expect, describe */ /* eslint-env jest */
import React from 'react'
import { shallow } from 'enzyme' import { shallow } from 'enzyme'
import React from 'react'
import renderer from 'react-test-renderer' import renderer from 'react-test-renderer'
import App from '../pages/index.js' import App from '../pages/index.js'
describe('With Enzyme', () => { describe('With Enzyme', () => {
it('App shows "Hello world!"', () => { it('App shows "Hello world!"', () => {
const app = shallow( const app = shallow(<App />)
<App />
)
expect(app.find('p').text()).toEqual('Hello World!') expect(app.find('p').text()).toEqual('Hello World!')
}) })
......
...@@ -2,20 +2,19 @@ ...@@ -2,20 +2,19 @@
"name": "with-jest", "name": "with-jest",
"dependencies": { "dependencies": {
"next": "latest", "next": "latest",
"react": "^15.4.2", "react": "^15.5.4",
"react-dom": "^15.4.2" "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": { "scripts": {
"test": "jest", "test": "jest",
"dev": "next", "dev": "next",
"build": "next build", "build": "next build",
"start": "next start" "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"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment