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 | 14x 14x 70x 14x 70x 2063x 2063x | const stripAnsiFrom = require('strip-ansi'); module.exports.getCapturedText = callsToLog => formatCapturedText(callsToLog, false); module.exports.getCapturedTextWithColor = callsToLog => formatCapturedText(callsToLog, true); function formatCapturedText(callsToLog, preserveColors) { return callsToLog.map(args => { // the validator only ever uses the first arg in consolg.log const output = preserveColors ? args[0] : stripAnsiFrom(args[0]); // the tests expect `console.log()` to be interpreted as a newline // but the mock captures the info as `undefined` return output === undefined ? '\n' : output; }); } |