jest-allure2-reporter
Version:
Idiomatic Jest reporter for Allure Framework
14 lines (11 loc) • 447 B
text/typescript
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 };
});
}