jest-metadata
Version:
🦸♂️ Superhero power for your Jest reporters! 🦸♀️
38 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AggregatedIdentifier = void 0;
class AggregatedIdentifier {
_testFilePath;
_identifier;
constructor(_testFilePath, _identifier = '') {
this._testFilePath = _testFilePath;
this._identifier = _identifier;
}
get testFilePath() {
return this._testFilePath;
}
get identifier() {
return this._identifier;
}
static global(identifier) {
return new AggregatedIdentifier('', identifier);
}
static parse(id) {
const [testFilePath, identifier] = id.split(':');
return new AggregatedIdentifier(testFilePath, identifier);
}
static normalize(id) {
return typeof id === 'string' ? AggregatedIdentifier.parse(id) : id;
}
toString() {
return `${this._testFilePath || ''}:${this._identifier}`;
}
equals(other) {
return this._testFilePath === other._testFilePath && this._identifier === other._identifier;
}
nest(subIdentifier) {
return new AggregatedIdentifier(this._testFilePath, `${this._identifier}.${subIdentifier}`);
}
}
exports.AggregatedIdentifier = AggregatedIdentifier;
//# sourceMappingURL=AggregatedIdentifier.js.map