diff --git a/e2e/__projects__/basic/components/TemplateString.vue b/e2e/__projects__/basic/components/TemplateString.vue new file mode 100644 index 00000000..7454d234 --- /dev/null +++ b/e2e/__projects__/basic/components/TemplateString.vue @@ -0,0 +1,21 @@ + + + diff --git a/e2e/__projects__/basic/package.json b/e2e/__projects__/basic/package.json index 0ed65a1a..d6cbbcb1 100644 --- a/e2e/__projects__/basic/package.json +++ b/e2e/__projects__/basic/package.json @@ -38,6 +38,13 @@ "vue-jest": { "pug": { "basedir": "./" + }, + "templateCompiler": { + "transpileOptions": { + "transforms": { + "dangerousTaggedTemplateString": true + } + } } } } diff --git a/e2e/__projects__/basic/test.js b/e2e/__projects__/basic/test.js index 20adeb87..51a5bc2b 100644 --- a/e2e/__projects__/basic/test.js +++ b/e2e/__projects__/basic/test.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils' import TypeScript from './components/TypeScript.vue' +import TemplateString from './components/TemplateString.vue' import { resolve } from 'path' import { readFileSync } from 'fs' import jestVue from 'vue-jest' @@ -81,6 +82,15 @@ test('processes .vue files with lang set to typescript', () => { expect(wrapper.element.tagName).toBe('DIV') }) +test('processes .vue files with template strings in the template', () => { + const wrapper = mount(TemplateString) + expect(wrapper.attributes('data-sth')).toBe(` + query { + id + } + `) +}) + test('processes functional components', () => { const clickSpy = jest.fn() const wrapper = mount(FunctionalSFC, { diff --git a/lib/process.js b/lib/process.js index bdd00e37..1a462dc5 100644 --- a/lib/process.js +++ b/lib/process.js @@ -57,16 +57,21 @@ function processTemplate(template, filename, config) { template.content = loadSrc(template.src, filename) } + const userTemplateCompilerOptions = vueJestConfig.templateCompiler || {} const result = compilerUtils.compileTemplate({ source: template.content, compiler: VueTemplateCompiler, filename: filename, - compilerOptions: { - optimize: false - }, isFunctional: template.attrs.functional, preprocessLang: template.lang, - preprocessOptions: vueJestConfig[template.lang] + preprocessOptions: vueJestConfig[template.lang], + ...userTemplateCompilerOptions, + compilerOptions: { + optimize: false, + ...userTemplateCompilerOptions.compilerOptions + }, + transformAssetUrls: { ...userTemplateCompilerOptions.transformAssetUrls }, + transpileOptions: { ...userTemplateCompilerOptions.transpileOptions } }) logResultErrors(result) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy