File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
var resolveFrom = require ( 'resolve-from' ) ;
3
3
var createEspowerPlugin = require ( 'babel-plugin-espower/create' ) ;
4
+ var requireFromString = require ( 'require-from-string' ) ;
4
5
var hasGenerators = parseInt ( process . version . slice ( 1 ) , 10 ) > 0 ;
5
6
var path = process . argv [ 2 ] ;
6
7
7
8
var options = {
8
- only : path ,
9
9
blacklist : hasGenerators ? [ 'regenerator' ] : [ ] ,
10
- optional : hasGenerators ? [ 'asyncToGenerator' ] : [ ] ,
10
+ optional : hasGenerators ? [ 'asyncToGenerator' , 'runtime' ] : [ 'runtime' ] ,
11
11
plugins : [
12
12
createEspowerPlugin ( require ( 'babel-core' ) , {
13
13
patterns : require ( './enhance-assert' ) . PATTERNS
14
14
} )
15
15
]
16
16
} ;
17
17
18
- try {
19
- var localBabel = resolveFrom ( '.' , 'babel-core/register' ) || resolveFrom ( '.' , 'babel/register' ) ;
18
+ var babel ;
20
19
21
- require ( localBabel ) ( options ) ;
20
+ try {
21
+ var localBabel = resolveFrom ( '.' , 'babel-core' ) || resolveFrom ( '.' , 'babel' ) ;
22
+ babel = require ( localBabel ) ;
22
23
} catch ( err ) {
23
- require ( 'babel-core/register' ) ( options ) ;
24
+ babel = require ( 'babel-core' ) ;
24
25
}
25
26
26
- require ( path ) ;
27
+ var transpiled = babel . transformFileSync ( path , options ) ;
28
+ requireFromString ( transpiled . code , path ) ;
Original file line number Diff line number Diff line change 64
64
"ava-init" : " ^0.1.0" ,
65
65
"babel-core" : " ^5.8.23" ,
66
66
"babel-plugin-espower" : " ^1.0.0" ,
67
+ "babel-runtime" : " ^5.8.29" ,
67
68
"bluebird" : " ^3.0.0" ,
68
69
"chalk" : " ^1.0.0" ,
69
- "co" : " ^4.6.0 " ,
70
+ "co" : " floatdrop/co#e6c2a50 " ,
70
71
"core-assert" : " ^0.1.0" ,
71
72
"empower" : " ^1.0.2" ,
72
73
"figures" : " ^1.4.0" ,
79
80
"power-assert-formatter" : " ^1.1.0" ,
80
81
"power-assert-renderers" : " ^0.1.0" ,
81
82
"pretty-ms" : " ^2.0.0" ,
83
+ "require-from-string" : " ^1.0.0" ,
82
84
"resolve-from" : " ^1.0.0" ,
83
85
"serialize-error" : " ^1.0.0" ,
84
86
"set-immediate-shim" : " ^1.0.1" ,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ test('rejects on error and streams output', function (t) {
35
35
buffer += data ;
36
36
} )
37
37
. catch ( function ( ) {
38
- t . ok ( / C a n n o t f i n d m o d u l e / . test ( buffer ) ) ;
38
+ t . ok ( / n o s u c h f i l e o r d i r e c t o r y / . test ( buffer ) ) ;
39
39
t . end ( ) ;
40
40
} ) ;
41
41
} ) ;
You can’t perform that action at this time.
0 commit comments