@@ -452,7 +452,7 @@ test('putout: operator: add-args: MemberExpression', (t) => {
452
452
t . end ( ) ;
453
453
} ) ;
454
454
455
- test ( 'putout: operator: add-args: VariableDeclaration ' , ( t ) => {
455
+ test ( 'putout: operator: add-args: AssignmentExpression: no ' , ( t ) => {
456
456
const args = {
457
457
process : [ '{process}' , 'module.exports.__a = (__args) => __body' ] ,
458
458
} ;
@@ -471,14 +471,7 @@ test('putout: operator: add-args: VariableDeclaration', (t) => {
471
471
] ,
472
472
} ) ;
473
473
474
- const expected = montag `
475
- module.exports.VariableDeclaration = (path) => {
476
- const {PUTOUT_PROGRESS_BAR} = process.env;
477
- const {stderr} = process;
478
- };
479
- ` ;
480
-
481
- t . equal ( code , expected ) ;
474
+ t . equal ( code , source ) ;
482
475
t . end ( ) ;
483
476
} ) ;
484
477
@@ -557,3 +550,35 @@ test('putout: operator: add-args: FunctionDeclaration', (t) => {
557
550
t . end ( ) ;
558
551
} ) ;
559
552
553
+ test ( 'putout: operator: add-args: VariableDeclaration' , ( t ) => {
554
+ const args = {
555
+ traverse : [ '{traverse}' , 'const __ = __' ] ,
556
+ } ;
557
+
558
+ const source = montag `
559
+ const CallExpression = {
560
+ print(path, {indent, print, maybe}) {
561
+ traverse(path.get('callee'));
562
+ }
563
+ };
564
+ ` ;
565
+
566
+ const { code} = putout ( source , {
567
+ fixCount : 1 ,
568
+ printer : 'putout' ,
569
+ plugins : [
570
+ [ 'add-args' , addArgs ( args ) ] ,
571
+ ] ,
572
+ } ) ;
573
+
574
+ const expected = montag `
575
+ const CallExpression = {
576
+ print(path, {indent, print, maybe, traverse}) {
577
+ traverse(path.get('callee'));
578
+ },
579
+ };\n
580
+ ` ;
581
+
582
+ t . equal ( code , expected ) ;
583
+ t . end ( ) ;
584
+ } ) ;
0 commit comments