@lewiswright/vitest-plugin-vis
Version:
Vitest visual testing plugin
11 lines (10 loc) • 397 B
JavaScript
/**
* Trim off common folder such as `src` or `tests` from the test file path.
* This is used to generate the default snapshot sub-path.
*/
export function trimCommonFolder(suiteName) {
const suiteDir = suiteName.split('/', 1)[0];
if (['tests', 'test', 'src', 'source', 'js', 'ts', 'lib'].includes(suiteDir))
return suiteName.slice(suiteDir.length + 1);
return suiteName;
}