Skip to content

Commit

Permalink
fix (jest) add moduleNameMapper option
Browse files Browse the repository at this point in the history
  • Loading branch information
grrseguin committed Jun 30, 2016
1 parent 920b6e8 commit 0a52632
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions __mocks__/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Return a Proxy to emulate css modules (if you are using them)

var idObj = require('identity-obj-proxy');
module.exports = idObj;
2 changes: 1 addition & 1 deletion __tests__/Title-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Title from '../src/components/Title';

describe('Title', () => {

it('changes the text after click', () => {
it('should have a text', () => {
// Render a checkbox with label in the document
const title = TestUtils.renderIntoDocument(
<Title>Hello, world! I am a title.</Title>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"babel-preset-react": "^6.11.1",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"identity-obj-proxy": "^2.0.0",
"jest-cli": "^13.0.0",
"react-addons-test-utils": "^15.1.0",
"style-loader": "^0.13.1",
Expand All @@ -28,6 +29,9 @@
"start": "webpack-dev-server"
},
"jest": {
"moduleNameMapper": {
"^.+\\.css$": "../../__mocks__/style.js"
},
"unmockedModulePathPatterns": [
"../node_modules/react/",
"../node_modules/react-dom/",
Expand Down

0 comments on commit 0a52632

Please sign in to comment.