Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
added jest configs for handling all files
Browse files Browse the repository at this point in the history
  • Loading branch information
PrudhviRaj5 committed Nov 29, 2017
1 parent 6f42c23 commit 52d295c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions config/jest/assetsTransformer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require('path');

module.exports = {
process(src, filename, config, options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
},
};
2 changes: 1 addition & 1 deletion shim.js → config/jest/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

global.requestAnimationFrame = function(callback) {
setTimeout(callback, 0);
};
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
"license": "MIT",
"jest": {
"setupFiles": [
"<rootDir>/shim.js"
"<rootDir>/config/jest/shim.js"
],
"mapCoverage": true,
"collectCoverageFrom": [
"app/**/*.{js,jsx,ts,tsx}"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/config/jest/assetsTransformer.js",
"\\.(css|less)$": "<rootDir>/config/jest/assetsTransformer.js"
},
"testMatch": [
"**/?(*.)(spec|test).js?(x)"
]
Expand Down
3 changes: 2 additions & 1 deletion tests/components/App.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { shallow, configure } from 'enzyme';
import App from '../../app/components/App';
import Adapter from 'enzyme-adapter-react-16';

import App from '../../app/components/App';

configure({ adapter: new Adapter() });

describe('App Component', () => {
Expand Down

0 comments on commit 52d295c

Please sign in to comment.