All files / wdio-sync/src constants.js

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 322x   2x                                             2x 53x 368x   6x    
const STACK_START = /^\s+at /
 
const STACKTRACE_FILTER = [
    // exclude @wdio/sync from stack traces
    'node_modules/@wdio/sync/',
 
    // exclude webdriverio stack traces
    'node_modules/webdriverio/build/',
 
    // exclude Request emit
    ' (events.js:',
    ' (domain.js:',
 
    // other excludes
    '(internal/process/next_tick.js',
    'new Promise (<anonymous>)',
    'Generator.next (<anonymous>)',
    '__awaiter ('
]
 
/**
 * filter stack array
 * @param {string} stackRow
 * @returns {boolean}
 */
export const STACKTRACE_FILTER_FN = (stackRow) => {
    if (stackRow.match(STACK_START)) {
        return !STACKTRACE_FILTER.some(r => stackRow.includes(r))
    }
    return true
}