# Description: # shows integrity tests coverage # # Dependencies: # None # # Configuration: # None # # Commands: # hubot (mostrami la) copertura (dei test) # # Author: # Enrico Fasoli (fazo96) moment = require 'moment' path = require 'path' fs = require 'fs' module.exports = (robot) -> robot.respond /(?:mostrami la )?(?:copertura|coverage)(?: dei test)?/i, (res) -> url = 'https://maxwell.ydns.eu/asjon/report/coverage' file = 'report/coverage/coverage-summary.json' try report = JSON.parse (fs.readFileSync file, 'utf8') catch err if err.code is 'ENOENT' return res.send 'report non disponibile. forse \ non รจ ancora stato generato?' else return res.send "errore nel leggere il report:\n#{err}" files = [] for name, file of report if name isnt "total" files.push "- #{path.basename name} is covered at #{file.lines.pct}%" res.send """ === Coverage: #{report.total.lines.pct}% #{files.join '\n'} HTML report: #{url} JSON report: #{url}/coverage-summary.json """