jest-allure2-reporter
Version:
Idiomatic Jest reporter for Allure Framework
37 lines • 1.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AllureTestItemMetadataProxy = void 0;
const constants_1 = require("../constants");
const AllureMetadataProxy_1 = require("./AllureMetadataProxy");
class AllureTestItemMetadataProxy extends AllureMetadataProxy_1.AllureMetadataProxy {
$boundPath;
constructor(metadata, boundPath) {
super(metadata);
this.$boundPath = boundPath;
}
get id() {
const localPath = this.$localPath().join('.');
return localPath ? `${this.$metadata.id}:${localPath}` : this.$metadata.id;
}
$bind(step) {
return new AllureTestItemMetadataProxy(this.$metadata, step === null ? [] : [...this.$metadata.get(constants_1.CURRENT_STEP, [])]);
}
$startStep() {
const count = this.get('steps', []).length;
this.push('steps', [{}]);
this.$metadata.push(constants_1.CURRENT_STEP, ['steps', `${count}`]);
return this;
}
$stopStep() {
const currentStep = this.$metadata.get(constants_1.CURRENT_STEP, []);
this.$metadata.set(constants_1.CURRENT_STEP, currentStep.slice(0, -2));
return this;
}
$localPath(key, ...innerKeys) {
const stepPath = this.$boundPath ?? this.$metadata.get(constants_1.CURRENT_STEP, []);
const allKeys = key ? [key, ...innerKeys] : innerKeys;
return [constants_1.PREFIX, ...stepPath, ...allKeys];
}
}
exports.AllureTestItemMetadataProxy = AllureTestItemMetadataProxy;
//# sourceMappingURL=AllureTestItemMetadataProxy.js.map