UNPKG

jest-allure2-reporter

Version:
14 lines (11 loc) 447 B
import path from 'node:path'; import type { AllureTestCaseResult, AllureTestStepResult } from 'jest-allure2-reporter'; export function normalizeAttachments( rootDirectory: string, result: AllureTestCaseResult | AllureTestStepResult, ) { return result.attachments?.map((attachment) => { const source = path.relative(rootDirectory, attachment.source); return source.startsWith('..') ? attachment : { ...attachment, source }; }); }