@@ -110,17 +110,16 @@ export default {
110
110
111
111
const imports = ` import { mount } from '@vue/test-utils'
112
112
import ${ componentName} from '../../src/components/${ componentName} .vue'
113
-
114
113
`
115
114
116
115
const results = [imports];
117
116
118
117
for (const el of htmlList) {
119
118
const test = `
120
119
test('renders ${ componentName} ', () => {
121
- const wrapper = mount(${ componentName} )
120
+ const wrapper = mount(${ componentName} )
122
121
123
- // customize your tests here; for more info please visit: https://github.com/vuejs/test-utils/
122
+ // customize your tests here; for more info please visit: https://github.com/vuejs/test-utils/
124
123
})`
125
124
results .push (test);
126
125
}
@@ -235,11 +234,11 @@ const wrapper = mount(${componentName})
235
234
// eslint-disable-next-line no-unused-vars
236
235
for (let i = 0 ; i < htmlArr .length ; i++ ) {
237
236
const el = htmlArr[i];
238
- // if (!el.text) {
239
- // outputStr += ` <${el} data-test="${componentName}-${el}-${i}" />\n`;
240
- // } else {
241
- // outputStr += ` `;
242
- // outputStr += htmlElementMap[el.text][0] + ` data-test="${componentName}-${el.text}-${el.id}"`
237
+ if (! el .text ) {
238
+ outputStr += ` <${ el} />\n ` ;
239
+ } else {
240
+ outputStr += ` ` ;
241
+ outputStr += htmlElementMap[el .text ][0 ];
243
242
// if conditional to check class
244
243
if (el .class !== " " ) {
245
244
outputStr += " " + " class = " + ` "${ el .class } "` ;
@@ -259,6 +258,7 @@ const wrapper = mount(${componentName})
259
258
}
260
259
}
261
260
return outputStr;
261
+ }
262
262
},
263
263
writeComments (componentName ) {
264
264
if (this .componentMap [componentName]? .noteList ? .length > 0 ) {
@@ -518,6 +518,23 @@ const wrapper = mount(${componentName})
518
518
</style >`
519
519
} else return ` \n\n <style scoped>\n ${ styleString} </style >` ;
520
520
},
521
+ // create Babel config for testing
522
+ createBabelConfigFile (location ) {
523
+ let str = `
524
+ module.exports = {
525
+ presets: [
526
+ ['@babel/preset-env',
527
+ {
528
+ targets: {
529
+ node: 'current'
530
+ }
531
+ }
532
+ ]
533
+ ]
534
+ }`
535
+ fs .writeFileSync (path .join (location, " babel.config.js" ), str);
536
+ },
537
+ // create Firebase config for OAuth
521
538
createFirebaseConfigFile (location ) {
522
539
if (this .$store .state .exportOauth === ' on' ){
523
540
let str = ` import { initializeApp } from 'firebase/app';` ;
0 commit comments