1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

[with-jest] Fix tests (#3395)

* Fix tests

* Follow linting rules
This commit is contained in:
Brice BERNARD 2017-12-05 19:43:30 +01:00 committed by Tim Neutkens
parent e8f39ad74c
commit 25005d158b
6 changed files with 25 additions and 25 deletions

View file

@ -1,16 +1,13 @@
{ {
"env": { "env": {
"development": { "development": {
"presets": "next/babel" "presets": ["next/babel"]
}, },
"production": { "production": {
"presets": "next/babel" "presets": ["next/babel"]
}, },
"test": { "test": {
"presets": [ "presets": [["env", { "modules": "commonjs" }], "next/babel"]
["env", { "modules": "commonjs" }],
"next/babel"
]
} }
} }
} }

View file

@ -2,12 +2,12 @@
exports[`With Snapshot Testing App shows "Hello world!" 1`] = ` exports[`With Snapshot Testing App shows "Hello world!" 1`] = `
<div <div
data-jsx={2648947580} className="jsx-2982525546"
> >
<p <p
data-jsx={2648947580} className="jsx-2982525546"
> >
Hello World! Hello World!
</p> </p>
</div> </div>
`; `

View file

@ -0,0 +1,4 @@
module.exports = {
setupFiles: ['<rootDir>/jest.setup.js'],
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/']
}

View file

@ -0,0 +1,5 @@
import 'raf/polyfill'
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() })

View file

@ -1,24 +1,21 @@
{ {
"name": "with-jest", "name": "with-jest",
"version": "1.0.0", "version": "1.0.0",
"jest": {
"setupFiles": [
"<rootDir>/shim.js"
]
},
"dependencies": { "dependencies": {
"next": "latest", "next": "latest",
"react": "^16.0.0", "react": "16.2.0",
"react-dom": "^16.0.0" "react-dom": "16.2.0"
}, },
"devDependencies": { "devDependencies": {
"enzyme": "^2.8.2", "enzyme": "3.2.0",
"jest": "^21.0.0", "enzyme-adapter-react-16": "1.1.0",
"react-addons-test-utils": "^15.6.0", "jest": "21.2.1",
"react-test-renderer": "^16.0.0" "raf": "3.4.0",
"react-addons-test-utils": "15.6.2",
"react-test-renderer": "16.2.0"
}, },
"scripts": { "scripts": {
"test": "jest", "test": "NODE_ENV=test jest",
"dev": "next", "dev": "next",
"build": "next build", "build": "next build",
"start": "next start" "start": "next start"

View file

@ -1,3 +0,0 @@
global.requestAnimationFrame = callback => {
setTimeout(callback, 0)
}