Code coverage for Solidity smart-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
solidity-coverage/lib/ui.js

53 lines
1.5 KiB

const c = require('chalk');
const emoji = require('node-emoji');
/**
* Coverage tool output handler. This is where any logging solidity-coverage does on its
* own behalf is managed. NB, most output is generated by the host dev stack (e.g. truffle,
* buidler or by the coverage generator (e.g. Istanbul).
* )
*/
class UI {
constructor(log){
this.log = log || console.log;
}
/**
* Writes a formatted message to console
* @param {String} kind message selector
* @param {String[]} args info to inject into template
*/
report(kind, args=[]){
const ct = c.bold.green('>');
const ds = c.bold.yellow('>');
const kinds = {
'truffle-version': `${ct} ${c.bold('truffle')}: v${args[0]}`,
'ganache-version': `${ct} ${c.bold('ganache-core')}: ${args[0]}`,
'instr-start': `\n${c.bold('Instrumenting for coverage...')}` +
`\n${c.bold('=============================')}\n`,
'instr-skip': `\n${c.bold('Coverage skipped for:')}` +
`\n${c.bold('=====================')}\n`,
'instr-item': `${ct} ${args[0]}`,
'instr-skipped': `${ds} ${c.grey(args[0])}`
}
this.log(emoji.emojify(kinds[kind]));
}
/**
* Returns a formatted message. Useful for error message.
* @param {String} kind message selector
* @param {String[]} args info to inject into template
* @return {String} message
*/
generate(kind, args){
}
}
module.exports = UI;