From 1573f487cbab86573014ade6ed7f48f9c9f45c74 Mon Sep 17 00:00:00 2001 From: taile <1112264.lptai@gmail.com> Date: Tue, 14 Dec 2021 17:29:24 +0700 Subject: [PATCH] Issue #417: Should not return empty string so that it is compatible with babel --- packages/vue2-jest/lib/transformers/typescript.js | 3 +-- packages/vue3-jest/lib/transformers/typescript.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/vue2-jest/lib/transformers/typescript.js b/packages/vue2-jest/lib/transformers/typescript.js index f32fa454..22f6b3b9 100644 --- a/packages/vue2-jest/lib/transformers/typescript.js +++ b/packages/vue2-jest/lib/transformers/typescript.js @@ -21,8 +21,7 @@ module.exports = scriptLang => ({ res.outputText = stripInlineSourceMap(res.outputText) - const inputSourceMap = - res.sourceMapText !== undefined ? JSON.parse(res.sourceMapText) : '' + const inputSourceMap = res.sourceMapText && JSON.parse(res.sourceMapText) const customTransformer = getCustomTransformer(vueJestConfig['transform'], 'js') || {} diff --git a/packages/vue3-jest/lib/transformers/typescript.js b/packages/vue3-jest/lib/transformers/typescript.js index 1aa2b656..275cc75f 100644 --- a/packages/vue3-jest/lib/transformers/typescript.js +++ b/packages/vue3-jest/lib/transformers/typescript.js @@ -21,8 +21,7 @@ module.exports = { res.outputText = stripInlineSourceMap(res.outputText) - const inputSourceMap = - res.sourceMapText !== undefined ? JSON.parse(res.sourceMapText) : '' + const inputSourceMap = res.sourceMapText && JSON.parse(res.sourceMapText) const customTransformer = getCustomTransformer(vueJestConfig['transform'], 'js') || {}