11const { getVueJestConfig, getCustomTransformer } = require ( './utils' )
2- const vueOptionsNamespace = require ( './constants' ) . vueOptionsNamespace
32
43function applyTransformer (
54 transformer ,
65 blocks ,
7- vueOptionsNamespace ,
6+ componentNamespace ,
87 filename ,
98 config
109) {
11- return transformer . process ( { blocks, vueOptionsNamespace , filename, config } )
10+ return transformer . process ( { blocks, componentNamespace , filename, config } )
1211}
1312
1413function groupByType ( acc , block ) {
@@ -17,9 +16,9 @@ function groupByType(acc, block) {
1716 return acc
1817}
1918
20- module . exports = function ( allBlocks , filename , config ) {
19+ module . exports = ( allBlocks , filename , componentNamespace , config ) => {
2120 const blocksByType = allBlocks . reduce ( groupByType , { } )
22- const code = [ ]
21+ const codes = [ ]
2322 for ( const [ type , blocks ] of Object . entries ( blocksByType ) ) {
2423 const transformer = getCustomTransformer (
2524 getVueJestConfig ( config ) . transform ,
@@ -29,13 +28,12 @@ module.exports = function(allBlocks, filename, config) {
2928 const codeStr = applyTransformer (
3029 transformer ,
3130 blocks ,
32- vueOptionsNamespace ,
31+ componentNamespace ,
3332 filename ,
3433 config
3534 )
36- code . push ( codeStr )
35+ codes . push ( codeStr )
3736 }
3837 }
39-
40- return code . length ? code . join ( '\n' ) : ''
38+ return codes
4139}
0 commit comments