Skip to content

Commit b12f581

Browse files
committed
unit testing setup
1 parent f52d173 commit b12f581

File tree

8 files changed

+790
-14
lines changed

8 files changed

+790
-14
lines changed

package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"react-redux": "4.4.5",
4040
"react-router-sans-urls": "0.1.2",
4141
"react-tap-event-plugin": "1.0.0",
42-
"redux": "3.5.2",
42+
"redux": "3.6.0",
4343
"redux-logger": "2.6.1",
4444
"redux-thunk": "2.1.0",
4545
"reselect": "2.5.3"
@@ -56,5 +56,17 @@
5656
"1.0.0": "consumeStatusBar"
5757
}
5858
}
59+
},
60+
"devDependencies": {
61+
"enzyme": "^2.4.1",
62+
"jest": "^15.1.1",
63+
"react-addons-test-utils": "^15.3.1",
64+
"react-test-renderer": "^15.3.1",
65+
"tslint": "^3.15.1"
66+
},
67+
"jest": {
68+
"scriptPreprocessor": "<rootDir>/src/__tests__/preprocessor.js",
69+
"moduleFileExtensions": ["ts", "tsx", "js"],
70+
"testRegex": "/src/*/.*\\.test\\.(ts|tsx|js)$"
5971
}
6072
}

src/__tests__/preprocessor.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
const tsc = require('typescript');
4+
5+
module.exports = {
6+
process(src, path) {
7+
if (path.endsWith('.ts') || path.endsWith('.tsx')) {
8+
return tsc.transpile(
9+
src,
10+
{
11+
module: tsc.ModuleKind.CommonJS,
12+
jsx: tsc.JsxEmit.React,
13+
},
14+
path,
15+
[]
16+
);
17+
}
18+
return src;
19+
},
20+
};

0 commit comments

Comments
 (0)