File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
transforms/convert-module-for-to-setup-test Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -861,6 +861,12 @@ module.exports = function(file, api) {
861861 }
862862 }
863863
864+ function flatten ( node ) {
865+ const isBE = node . type === 'BinaryExpression' ;
866+ const isPLUS = node . operator === '+' ;
867+ return isBE && isPLUS ? [ ...flatten ( node . left ) , ...flatten ( node . right ) ] : [ node ] ;
868+ }
869+
864870 function updateInjectCalls ( ctx ) {
865871 ctx
866872 . find ( j . CallExpression , {
@@ -884,7 +890,8 @@ module.exports = function(file, api) {
884890 let options = p . node . arguments [ 1 ] ;
885891 let as = options . properties . find ( property => property . key . name === 'as' ) ;
886892 if ( as ) {
887- localName = as . value . value ;
893+ let flattenValue = flatten ( as . value ) ;
894+ localName = flattenValue . map ( node => node . value ) . join ( '' ) ;
888895 }
889896 }
890897 let property = j . identifier ( localName ) ;
You can’t perform that action at this time.
0 commit comments