File tree 1 file changed +8
-1
lines changed
transforms/convert-module-for-to-setup-test
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) {
861
861
}
862
862
}
863
863
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
+
864
870
function updateInjectCalls ( ctx ) {
865
871
ctx
866
872
. find ( j . CallExpression , {
@@ -884,7 +890,8 @@ module.exports = function(file, api) {
884
890
let options = p . node . arguments [ 1 ] ;
885
891
let as = options . properties . find ( property => property . key . name === 'as' ) ;
886
892
if ( as ) {
887
- localName = as . value . value ;
893
+ let flattenValue = flatten ( as . value ) ;
894
+ localName = flattenValue . map ( node => node . value ) . join ( '' ) ;
888
895
}
889
896
}
890
897
let property = j . identifier ( localName ) ;
You can’t perform that action at this time.
0 commit comments