Skip to content

Commit

Permalink
Update jest config to handle .css files and .flat call.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpovolny committed Sep 26, 2019
1 parent 740f295 commit cdda1e7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ import initializeStore from '../app/javascript/miq-redux/store';

ManageIQ.redux.store = initializeStore();
ManageIQ.redux.store.injectReducers();

Object.defineProperty(Array.prototype, 'flat', {
value: function(depth = 1) {
return this.reduce(function (flat, toFlatten) {
return flat.concat((Array.isArray(toFlatten) && (depth>1)) ? toFlatten.flat(depth-1) : toFlatten);
}, []);
}
});
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ module.exports = {
'js',
'jsx'
],
moduleNameMapper: {
"\\.(css|scss)$": "identity-obj-proxy"
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"fetch-mock": "^7.2.5",
"file-loader": "~1.1.11",
"glob": "~7.1.1",
"identity-obj-proxy": "^3.0.0",
"imports-loader": "~0.8.0",
"jasmine-jquery": "~2.1.1",
"jest": "^22.0.6",
Expand Down

0 comments on commit cdda1e7

Please sign in to comment.