All files index.js

100% Statements 6/6
50% Branches 2/4
100% Functions 1/1
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                  2x 2x 2x 2x 2x   2x    
import {
    appliedGetStderr,
    commands,
    findFailures,
    getLastLines,
    getThresholds,
} from './utils';
 
export function validate(fail = Function, pass = Function) {
    const config = appliedGetStderr(commands.showConfig);
    const results = appliedGetStderr(commands.coverage);
    const thresholdList = Object.keys(getThresholds(config));
    const potentialFailures = getLastLines(results, thresholdList.length);
    const failures = findFailures(thresholdList, potentialFailures);
 
    return (failures.length > 0) ? fail(failures) : pass(true);
}