UNPKG

allure-vitest

Version:
58 lines 2.08 kB
import { uint8ArrayToBase64 } from "allure-js-commons/sdk"; import { BaseVitestTestRuntime } from "./runtime.js"; const toBase64Content = (content) => content instanceof Uint8Array ? uint8ArrayToBase64(content) : btoa(content); export class VitestBrowserTestRuntime extends BaseVitestTestRuntime { async attachment(name, content, options) { await this.sendMessage({ type: "attachment_content", data: { name, content: toBase64Content(content), encoding: "base64", contentType: options.contentType, fileExtension: options.fileExtension, wrapInStep: true, timestamp: Date.now(), }, }); } async globalAttachment(name, content, options) { await this.sendMessage({ type: "global_attachment_content", data: { name, content: toBase64Content(content), encoding: "base64", contentType: options.contentType, fileExtension: options.fileExtension, }, }); } syncAttachment(sendMessageSync, name, content, options) { sendMessageSync({ type: "attachment_content", data: { name, content: toBase64Content(content), encoding: "base64", contentType: options.contentType, fileExtension: options.fileExtension, wrapInStep: true, timestamp: Date.now(), }, }); } syncGlobalAttachment(sendMessageSync, name, content, options) { sendMessageSync({ type: "global_attachment_content", data: { name, content: toBase64Content(content), encoding: "base64", contentType: options.contentType, fileExtension: options.fileExtension, }, }); } } //# sourceMappingURL=VitestBrowserTestRuntime.js.map