dist/lib/matchers.js
function convertDiffToMessages(diff, actualOnly = false, includeTimeouts = false, timeout = undefined, comparisonLines = [], paths = []) {
    if (diff.tree && Object.keys(diff.tree).length > 0) {
        const keys = Object.keys(diff.tree);
        keys.forEach(key => {
            const _paths = [...paths];
            _paths.push(key);
            convertDiffToMessages(diff.tree[key], actualOnly, includeTimeouts, timeout, comparisonLines, _paths);
        });
    }
    else {
        let _paths = paths.join('');
        if (_paths.charAt(0) === '.') {
            _paths = _paths.substring(1);
        }
        const _actual = printValue(diff.actual);
        const _expected = printValue(diff.expected);
        let compareStr = '';
        if (actualOnly) {
            compareStr = (typeof diff.actual === 'undefined') ?
                '' : `{actual: <${_actual}>}\n`;
        }
        else {
            compareStr = (typeof diff.actual === 'undefined' && typeof diff.expected === 'undefined') ?
                '' : `{actual: <${_actual}>, expected: <${_expected}>}\n`;
        }
        const timeoutStr = (includeTimeouts) ? ` within ${timeout || diff.timeout}ms` : '';
        comparisonLines.push(`${diff.constructorName} at path '${_paths}'${timeoutStr}\n${compareStr}( ${diff.selector} )`);
    }
    return comparisonLines;
}
function convertDiffToMessages(diff, actualOnly = false, includeTimeouts = false, timeout = undefined, comparisonLines = [], paths = []) {
    if (diff.tree && Object.keys(diff.tree).length > 0) {
        const keys = Object.keys(diff.tree);
        keys.forEach(key => {
            const _paths = [...paths];
            _paths.push(key);
            convertDiffToMessages(diff.tree[key], actualOnly, includeTimeouts, timeout, comparisonLines, _paths);
        });
    }
    else {
        let _paths = paths.join('');
        if (_paths.charAt(0) === '.') {
            _paths = _paths.substring(1);
        }
        const _actual = printValue(diff.actual);
        const _expected = printValue(diff.expected);
        let compareStr = '';
        if (actualOnly) {
            compareStr = (typeof diff.actual === 'undefined') ?
                '' : `{actual: <${_actual}>}\n`;
        }
        else {
            compareStr = (typeof diff.actual === 'undefined' && typeof diff.expected === 'undefined') ?
                '' : `{actual: <${_actual}>, expected: <${_expected}>}\n`;
        }
        const timeoutStr = (includeTimeouts) ? ` within ${timeout || diff.timeout}ms` : '';
        comparisonLines.push(`${diff.constructorName} at path '${_paths}'${timeoutStr}\n${compareStr}( ${diff.selector} )`);
    }
    return comparisonLines;
}
function convertDiffToMessages ( diff , actualOnly = false , includeTimeouts = false , timeout = undefined , comparisonLines = [ ] , paths = [ ] ) { if ( diff . tree && Object . keys ( diff . tree ) . length > 0 ) { const keys = Object . keys ( diff . tree ) ; keys . forEach ( key => { const _paths = [ ... paths ] ; _paths . push ( key ) ; convertDiffToMessages ( diff . tree [ key ] , actualOnly , includeTimeouts , timeout , comparisonLines , _paths ) ; } ) ; } else { let _paths = paths . join ( '' ) ; if ( _paths . charAt ( 0 ) === '.' ) { _paths = _paths . substring ( 1 ) ; } const _actual = printValue ( diff . actual ) ; const _expected = printValue ( diff . expected ) ; let compareStr = '' ; if ( actualOnly ) { compareStr = ( typeof diff . actual === 'undefined' ) ? '' : ` ${ _actual } \n ` ; } else { compareStr = ( typeof diff . actual === 'undefined' && typeof diff . expected === 'undefined' ) ? '' : ` ${ _actual } ${ _expected } \n ` ; } const timeoutStr = ( includeTimeouts ) ? ` ${ timeout || diff . timeout } ` : '' ; comparisonLines . push ( ` ${ diff . constructorName } ${ _paths } ${ timeoutStr } \n ${ compareStr } ${ diff . selector } ` ) ; } return comparisonLines ; }
ERROR TEXT FUNCTIONS
ERROR TEXT FUNCTIONS