File tree Expand file tree Collapse file tree 3 files changed +30
-16
lines changed
Expand file tree Collapse file tree 3 files changed +30
-16
lines changed Original file line number Diff line number Diff line change 11# 6to5-jest
22
3+ [ 6to5] ( https://github.com/6to5/6to5 ) [ jest] ( https://github.com/facebook/jest ) plugin
4+
5+ ## Usage
6+
7+ Make the following changes to ` package.json ` :
8+
39** package.json**
410
511``` json
612{
713 "dependencies" : {
8- "6to5" : " *" ,
14+ "6to5-jest " : " *" ,
915 "jest" : " *"
1016 },
1117 "scripts" : {
1218 "test" : " jest"
1319 },
1420 "jest" : {
15- "scriptPreprocessor" : " <rootDir>/preprocessor.js " ,
21+ "scriptPreprocessor" : " 6to5-jest " ,
1622 "testFileExtensions" : [" es6" , " js" ],
1723 "moduleFileExtensions" : [" js" , " json" , " es6" ]
1824 }
1925}
2026```
2127
22- ** preprocessor.js **
28+ And run:
2329
24- ``` javascript
25- var to5 = require (" 6to5" );
30+ $ npm install
2631
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- ```
32+ ** And you're good to go!**
Original file line number Diff line number Diff line change 1+ var to5 = require ( "6to5" ) ;
2+
3+ module . exports = {
4+ process : function ( src , filename ) {
5+ // Ignore all files within node_modules
6+ // 6to5 files can be .js and .es6
7+ if ( filename . indexOf ( "node_modules" ) === - 1 && to5 . canCompile ( filename ) ) {
8+ return to5 . transform ( src , { filename : filename } ) . code ;
9+ }
10+ return src ;
11+ }
12+ } ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " 6to5-jest" ,
3+ "version" : " 1.0.0" ,
4+ "dependencies" : {
5+ "6to5" : " *"
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments