UNPKG

jest-allure2-reporter

Version:
37 lines 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AllureRealm = void 0; const tslib_1 = require("tslib"); const node_path_1 = tslib_1.__importDefault(require("node:path")); const node_os_1 = tslib_1.__importDefault(require("node:os")); const jest_metadata_1 = require("jest-metadata"); const runtime_1 = require("../runtime"); const metadata_1 = require("../metadata"); class AllureRealm { runtimeContext = new runtime_1.AllureRuntimeContext({ getCurrentMetadata: () => jest_metadata_1.state.currentMetadata, getFileMetadata: () => jest_metadata_1.state.lastTestFile, getGlobalMetadata: () => jest_metadata_1.state, getNow: () => Date.now(), getReporterConfig() { let config = new metadata_1.AllureMetadataProxy(jest_metadata_1.state).get('config'); if (!config) { console.warn("Cannot receive jest-allure2-reporter's config from the parent process. Have you set up Jest test environment correctly?"); } config ??= { resultsDir: node_path_1.default.join(node_os_1.default.tmpdir(), 'allure-results'), overwrite: true, injectGlobals: true, attachments: { subDir: 'attachments', contentHandler: 'write', fileHandler: 'ref', }, }; return config; }, }); runtime = new runtime_1.AllureRuntimeImplementation(this.runtimeContext); } exports.AllureRealm = AllureRealm; //# sourceMappingURL=AllureRealm.js.map