@contract-case/case-plugin-base
Version:
Plugin framework for writing plugins for the ContractCase test framework
26 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.locationString = void 0;
/**
* Helper to determine if maintainer debug logging is on. This exists to avoid a
* dependency cycle from `shouldLog`
*
* @internal
* @param matchContext - LogLevelContext
* @returns true if maintainer debug logging is on
*/
const isMaintainerDebug = (matchContext) => matchContext['_case:currentRun:context:logLevel'] === 'maintainerDebug' ||
matchContext['_case:currentRun:context:logLevel'] === 'deepMaintainerDebug';
/**
* Gets the string representation of the current context
*
* @internal
*/
const locationString = (matchContext) => matchContext['_case:currentRun:context:location']
.filter((locationItem) => (locationItem.startsWith(':') && isMaintainerDebug(matchContext)) ||
!locationItem.startsWith(':'))
.reduce((acc, curr) => curr.startsWith('[') || curr.startsWith(':') || acc === ''
? `${acc}${curr}`
: `${acc}.${curr}`, '');
exports.locationString = locationString;
//# sourceMappingURL=locationString.js.map