diff --git a/src/VueProgram.ts b/src/VueProgram.ts index b1ba72ef..b99e469d 100644 --- a/src/VueProgram.ts +++ b/src/VueProgram.ts @@ -195,7 +195,7 @@ class VueProgram { } } - private static resolveScriptBlock(content: string): ResolvedScript { + static resolveScriptBlock(content: string): ResolvedScript { // We need to import vue-template-compiler lazily because it cannot be included it // as direct dependency because it is an optional dependency of fork-ts-checker-webpack-plugin. // Since its version must not mismatch with user-installed Vue.js, @@ -209,7 +209,7 @@ class VueProgram { } const { script } = parser.parseComponent(content, { - pad: 'line' + pad: 'space' }); // No ' + ].join('\n'); + + var result = VueProgram.resolveScriptBlock(content); + + expect(result.scriptKind).to.be.equal(ts.ScriptKind.TS); + expect(result.content).to.be.equal([ + '', + 'import Vue from "vue";', + 'export default Vue.extend({});', + '' + ].join('\n')); + }); + + it('should pad lines', function() { + var content = [ + '', + '', + '' + ].join('\n'); + + var result = VueProgram.resolveScriptBlock(content); + + expect(result.content).to.be.equal([ + '//', + '//', + '//', + '//', + '', + 'import Vue from "vue";', + 'export default Vue.extend({});', + '' + ].join('\n')); + }); });