Skip to content

Commit 7fbd6d5

Browse files
committed
first commit
0 parents  commit 7fbd6d5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# 6to5-jest
2+
3+
**package.json**
4+
5+
```json
6+
{
7+
"dependencies": {
8+
"6to5": "*",
9+
"jest": "*"
10+
},
11+
"scripts": {
12+
"test": "jest"
13+
},
14+
"jest": {
15+
"scriptPreprocessor": "<rootDir>/preprocessor.js",
16+
"testFileExtensions": ["es6", "js"],
17+
"moduleFileExtensions": ["js", "json", "es6"]
18+
}
19+
}
20+
```
21+
22+
**preprocessor.js**
23+
24+
```javascript
25+
var to5 = require("6to5");
26+
27+
module.exports = {
28+
process: function (src, filename) {
29+
// Ignore all files within node_modules
30+
// 6to5 files can be .js and .es6
31+
if (filename.indexOf("node_modules") === -1 && to5.canCompile(filename)) {
32+
return to5.transform(src, { filename: filename }).code;
33+
}
34+
return src;
35+
}
36+
};
37+
```

0 commit comments

Comments
 (0)