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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 1x 1x 252x 252x 231x 258x 102x 126x 126x 126x 126x 126x 126x 23x 23x 23x 1x | const chalk = require('chalk'); const emoji = require('node-emoji'); /** * Coverage tool output formatters. These classes support any the logging solidity-coverage API * (or plugins which consume it) do on their own behalf. NB, most output is generated by the host * dev stack (ex: the hardhat compile command, or istanbul). */ class UI { constructor(log){ this.log = log || console.log; this.chalk = chalk; } /** * Writes a formatted message * @param {String} kind message selector * @param {String[]} args info to inject into template */ report(kind, args=[]){} /** * Returns a formatted message. Useful for error messages. * @param {String} kind message selector * @param {String[]} args info to inject into template * @return {String} message */ generate(kind, args=[]){} _write(msg){ this.log(this._format(msg)) } _format(msg){ return emoji.emojify(msg) } } /** * UI for solidity-coverage/lib/app.js */ class AppUI extends UI { constructor(log){ super(log); } /** * Writes a formatted message via log * @param {String} kind message selector * @param {String[]} args info to inject into template */ report(kind, args=[]){ const c = this.chalk; const ct = c.bold.green('>'); const ds = c.bold.yellow('>'); const w = ":warning:"; const kinds = { 'instr-start': `\n${c.bold('Instrumenting for coverage...')}` + `\n${c.bold('=============================')}\n`, 'instr-item': `${ct} ${args[0]}`, 'istanbul': `${ct} ${c.grey('Istanbul reports written to')} ./coverage/ ` + `${c.grey('and')} ./coverage.json`, 'command': `\n${w} ${c.red.bold('solidity-coverage >= 0.7.0 is no longer a shell command.')} ${w}\n` + `${c.bold('=============================================================')}\n\n` + `Instead, you should use the plugin produced for your development stack\n` + `(like Hardhat) or design a custom workflow using the package API\n\n` + `> See https://github.com/sc-forks/solidity-coverage for help with configuration.\n\n` + `${c.green.bold('Thanks! - sc-forks')}\n`, }; this._write(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=[]){ const c = this.chalk; const kinds = { 'config-fail':`${c.red('A config option (.solcover.js) is incorrectly formatted: ')}` + `${c.red(args[0])}.`, 'instr-fail': `${c.red('Could not instrument:')} ${args[0]}. ` + `${c.red('(Please verify solc can compile this file without errors.) ')}`, 'istanbul-fail': `${c.red('Istanbul coverage reports could not be generated. ')}`, 'sources-fail': `${c.red('Cannot locate expected contract sources folder: ')} ${args[0]}`, } return this._format(kinds[kind]) } } module.exports = { AppUI: AppUI, UI: UI }; |