UNPKG

jest-metadata

Version:

🦸‍♂️ Superhero power for your Jest reporters! 🦸‍♀️

33 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AssociateMetadata = void 0; const errors_1 = require("../errors"); class AssociateMetadata { _map = new Map(); filePath(value, metadata) { if (!value) { throw new errors_1.JestMetadataError('Cannot associate metadata with an empty file path'); } if (!metadata) { throw new errors_1.JestMetadataError(`Cannot associate a non-existent metadata with a file: ${value}`); } this._map.set(value, metadata); } testCaseResult(testCaseResult, metadata) { if (!testCaseResult) { throw new errors_1.JestMetadataError('Cannot associate metadata with a non-existent test case'); } if (!metadata) { throw new errors_1.JestMetadataError(`Cannot associate a non-existent metadata with a test case: ${testCaseResult.fullName}`); } this._map.set(testCaseResult, metadata); } globalMetadata(metadata) { this._map.set(undefined, metadata); } get(key) { return this._map.get(key); } } exports.AssociateMetadata = AssociateMetadata; //# sourceMappingURL=AssociateMetadata.js.map