File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 21
21
"dependencies" : {
22
22
"es6-map" : " ^0.1.3" ,
23
23
"es6-weak-map" : " ^2.0.1" ,
24
- "esrecurse" : " ^4.0 .0" ,
24
+ "esrecurse" : " ^4.1 .0" ,
25
25
"estraverse" : " ^4.1.1"
26
26
},
27
27
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe('fallback option', function() {
38
38
} ) . to . throw ( "Unknown node type NumericLiteral" ) ;
39
39
} ) ;
40
40
41
- it ( 'should not raise an error even if it encountered an unknown node.' , function ( ) {
41
+ it ( 'should not raise an error even if it encountered an unknown node when fallback is iteration .' , function ( ) {
42
42
const ast = esprima . parse ( `
43
43
var foo = 0;
44
44
` ) ;
@@ -48,6 +48,16 @@ describe('fallback option', function() {
48
48
analyze ( ast ) ; // default is `fallback: 'iteration'`
49
49
analyze ( ast , { fallback : 'iteration' } ) ;
50
50
} ) ;
51
+
52
+ it ( 'should not raise an error even if it encountered an unknown node when fallback is a function.' , function ( ) {
53
+ const ast = esprima . parse ( `
54
+ var foo = 0;
55
+ ` ) ;
56
+
57
+ ast . body [ 0 ] . declarations [ 0 ] . init . type = 'NumericLiteral' ;
58
+
59
+ analyze ( ast , { fallback : node => Object . keys ( node ) } ) ;
60
+ } ) ;
51
61
} ) ;
52
62
53
63
// vim: set sw=4 ts=4 et tw=80 :
You can’t perform that action at this time.
0 commit comments