Skip to content

Commit

Permalink
fix: artifact-test delay
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Feb 10, 2024
1 parent c9ef4bc commit 7e3b782
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const listener: EnvironmentListenerFn = ({ testEvents }) => {

function onTrackArtifact(artifact: any) {
const $step = allure.$bind();
const $$test = $test;
const originalSave = artifact.doSave.bind(artifact);

artifact.doSave = async (artifactPath: string, ...args: unknown[]) => {
Expand All @@ -45,7 +46,7 @@ const listener: EnvironmentListenerFn = ({ testEvents }) => {
const isVideo = !!inferMimeType({ sourcePath: artifactPath })?.startsWith('video/');
const handler = isDirectory ? zipHandler : isLog ? logHandler : 'copy';
const mimeType = isLog ? 'text/plain' : undefined;
const $allure = (isLog || isVideo ? $test : $step) ?? $step;
const $allure = (isLog || isVideo ? $$test : $step) ?? $step;

$allure.fileAttachment(artifactPath, {
name: path.basename(artifactPath),
Expand Down

0 comments on commit 7e3b782

Please sign in to comment.