Skip to content

Commit

Permalink
Refactor vitestTransform function to use localName as fallback for te…
Browse files Browse the repository at this point in the history
…st title
  • Loading branch information
yannbf committed Oct 1, 2024
1 parent 46e7a4b commit 192622c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions code/core/src/csf-tools/vitest-plugin/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,9 @@ export async function vitestTransform({
return;
}

// use the story's name as the test title for vitest, and fallback to exportName
const testTitle = parsed._stories[exportName].name ?? exportName;
const decl = parsed._storyExports[exportName];
const localName = parsed._stories[exportName].localName ?? exportName;
// use the story's name as the test title for vitest, and fallback to exportName
const testTitle = parsed._stories[exportName].name ?? localName;
return getTestStatementForStory({ testTitle, localName, exportName, node });
})
.filter((st) => !!st) as t.ExpressionStatement[];
Expand Down

0 comments on commit 192622c

Please sign in to comment.