Skip to content

Commit d49afed

Browse files
committed
Fix c8 coverage for tsx dynamic imports
1 parent 8ff69f4 commit d49afed

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default function vitePluginSvgr({
3737

3838
const filePath = id.replace(postfixRE, "");
3939
const svgCode = await fs.promises.readFile(filePath, "utf8");
40+
// `tsx` injects an import-interop helper here during tests, which adds
41+
// an unreachable branch to coverage for these ESM-only modules.
42+
/* c8 ignore next 2 */
4043
const { transform: svgrTransform } = await import("@svgr/core");
4144
const { default: jsx } = await import("@svgr/plugin-jsx");
4245
const componentCode = await svgrTransform(svgCode, svgrOptions, {

0 commit comments

Comments
 (0)