-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
708 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import realm from './realms'; | ||
import type { IAllureRuntime } from './runtime'; | ||
|
||
export { JestAllure2Reporter } from './reporter/JestAllure2Reporter'; | ||
export { JestAllure2Reporter as default } from './reporter/JestAllure2Reporter'; | ||
export { ReporterOptions } from './options/ReporterOptions'; | ||
export * from './annotations'; | ||
export * from './decorators'; | ||
|
||
export const allure = realm.runtime; | ||
export const allure = realm.runtime as IAllureRuntime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,16 @@ | ||
import { randomUUID } from 'node:crypto'; | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import os from 'node:os'; | ||
|
||
import { state } from 'jest-metadata'; | ||
|
||
import { AllureRuntime } from '../runtime'; | ||
import { OUT_DIR } from '../constants'; | ||
|
||
const fallbackAttachmentsFolder = path.join(os.tmpdir(), 'allure-attachments'); | ||
import { SHARED_CONFIG } from '../constants'; | ||
import { AttachmentsHandler } from '../runtime/AttachmentsHandler'; | ||
import type { SharedReporterConfig } from '../options'; | ||
|
||
export class AllureRealm { | ||
runtime = new AllureRuntime({ | ||
metadataProvider: () => state.currentMetadata, | ||
nowProvider: () => Date.now(), | ||
placeAttachment: (name) => { | ||
const attachmentsFolder = state.get( | ||
OUT_DIR, | ||
fallbackAttachmentsFolder, | ||
) as string; | ||
const extension = path.extname(name); | ||
return path.join(attachmentsFolder, randomUUID() + extension); | ||
}, | ||
writeAttachment: async (filePath, content) => { | ||
await fs.promises.mkdir(path.dirname(filePath), { recursive: true }); | ||
await fs.promises.writeFile(filePath, content); | ||
}, | ||
attachmentsHandler: new AttachmentsHandler(() => { | ||
return state.get(SHARED_CONFIG) as SharedReporterConfig; | ||
}), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.