Skip to content

Commit

Permalink
#24 moved jest config and enzyme setup to separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
paleika committed Dec 30, 2020
1 parent a697715 commit 68be644
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
moduleNameMapper: {
'\\.(css|less|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
'\\.(gif|png|ttf|eot|svg)$': '<rootDir>/__mocks__/fileMock.js'
},
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js']
}
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,5 @@
"webpack": "^4.44.2",
"webpack-cli": "3.3.12",
"webpack-dev-server": "^3.11.1"
},
"jest": {
"moduleNameMapper": {
"\\.(css|less|sass|scss)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|png|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
}
}
}
5 changes: 1 addition & 4 deletions src/components/app/app.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React from 'react'
import Enzyme, { shallow } from 'enzyme'
import EnzymeAdapter from 'enzyme-adapter-react-16'
import { shallow } from 'enzyme'

import App from './app'

Enzyme.configure({ adapter: new EnzymeAdapter() })

test('renders without error', () => {
const wrapper = shallow(<App />)
const appComponent = wrapper.find("[data-test='component-app']")
Expand Down
4 changes: 4 additions & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Enzyme from 'enzyme'
import EnzymeAdapter from 'enzyme-adapter-react-16'

Enzyme.configure({ adapter: new EnzymeAdapter() })

0 comments on commit 68be644

Please sign in to comment.