Navigation Menu

Skip to content

Commit

Permalink
Mock jest tests with a special transform for the svg from the Pastana…
Browse files Browse the repository at this point in the history
…ga Icon System
  • Loading branch information
sneridagh committed Jul 14, 2018
1 parent f3f7840 commit 92c0f10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions jest-svgsystem-transform.js
@@ -0,0 +1,10 @@
const path = require('path');

module.exports = {
process(src, filename) {
if (filename.includes('src/icons')) {
return `module.exports = { attributes: { xmlns: '', viewBox: ''}}`;
}
return `module.exports = ${JSON.stringify(path.basename(filename))}`;
},
};
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -72,7 +72,8 @@
"transform": {
"^.+\\.js(x)?$": "babel-jest",
"^.+\\.scss$": "jest-css-modules",
"^.+\\.(svg|png)$": "jest-file"
"^.+\\.(png)$": "jest-file",
"^.+\\.(svg)$": "./jest-svgsystem-transform.js"
},
"collectCoverage": true,
"coverageThreshold": {
Expand Down

0 comments on commit 92c0f10

Please sign in to comment.