Skip to content

Commit caff490

Browse files
committed
Add preprocessor for jest tests
1 parent 99bee09 commit caff490

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ dist/
3030
src/**/*.js
3131
test/**/*.js
3232
coverage/
33+
!test/preprocessor.js

test/preprocessor.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
const tsc = require('typescript');
4+
const tsConfig = require('./../tsconfig.json');
5+
6+
module.exports = {
7+
process(src, path) {
8+
if (path.endsWith('.ts') || path.endsWith('.tsx')) {
9+
return tsc.transpile(src, tsConfig.compilerOptions, path, []);
10+
}
11+
return src;
12+
},
13+
};

0 commit comments

Comments
 (0)