// List of string literals of failed tests. function getLiteralsForFailed(leadingComment, failedList) { const result = failedList.map(path => babelTypes.stringLiteral(path)); if (result.length) { babelTypes.addComment(result[0], 'leading', leadingComment); } return result; }
/** * Annotate code with original file path. */ function annotateWithOriginalPath(ast, relPath) { if (ast.program && ast.program.body && ast.program.body.length > 0) { babelTypes.addComment( ast.program.body[0], 'leading', ' Original: ' + relPath, true); } }
annotate(node, message) { babelTypes.addComment( node, 'leading', ` ${this.constructor.name}: ${message} `); }
// List of string literals of slow tests with duration comments. function getLiteralsForSlow(leadingComment, slowList) { const result = slowList.map(([path, duration]) => { const literal = babelTypes.stringLiteral(path); babelTypes.addComment( literal, 'trailing', ` ${duration / 1000}s`, true); return literal; }); if (result.length) { babelTypes.addComment(result[0], 'leading', leadingComment); } return result; }