Skip to content

Commit

Permalink
enable css to be directly imported/mocked into components for unit te…
Browse files Browse the repository at this point in the history
…sting in jest
  • Loading branch information
mejackreed committed Jan 25, 2019
1 parent a0ab72a commit be46986
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions __mocks__/css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
3 changes: 3 additions & 0 deletions jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
],
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["html", "lcov"],
"moduleNameMapper": {
"\\.css$": "<rootDir>/__mocks__/css.js"
},
"setupFiles": [
"<rootDir>/setupJest.js"
],
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const baseConfig = [
eslintLoaderConfig,
babelLoaderConfig,
{
test: /\.scss$/,
test: /\.s?css$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
Expand Down

0 comments on commit be46986

Please sign in to comment.