add html report for integrity tests

This commit is contained in:
Michele Guerini Rocco 2018-06-21 03:30:24 +02:00
parent 68f56ede58
commit f000022189
Signed by: rnhmjoj
GPG Key ID: 91BE884FBA4B591A
4 changed files with 15 additions and 11 deletions

View File

@ -11,6 +11,7 @@
"coffeescript": "^1.9.2",
"fast-levenshtein": "^2.0.6",
"mocha": "^5.2.0",
"mochawesome": "^3.0.1",
"mock-fs": "^4.5.0",
"nyc": "^13.0.0",
"moment": "^2.22.2",
@ -35,7 +36,7 @@
"hubot-youtube": "^1.1.0"
},
"scripts": {
"test": "nyc mocha test/*.coffee; true"
"test": "nyc mocha; true"
},
"nyc": {
"include": [
@ -49,6 +50,7 @@
"json-summary",
"html"
],
"report-dir": "report/coverage",
"sourceMap": true,
"instrument": true,
"cache": true

View File

@ -19,8 +19,8 @@ fs = require 'fs'
module.exports = (robot) ->
robot.respond /(?:mostrami la )?(?:copertura|coverage)(?: dei test)?/i, (res) ->
url = 'https://maxwell.ydns.eu/asjon/coverage'
file = 'coverage/coverage-summary.json'
url = 'https://maxwell.ydns.eu/asjon/report/coverage'
file = 'report/coverage/coverage-summary.json'
try
report = JSON.parse (fs.readFileSync file, 'utf8')
@ -41,5 +41,5 @@ module.exports = (robot) ->
#{files.join '\n'}
HTML report: #{url}
JSON report: #{url}/coverage-final.json
JSON report: #{url}/coverage-summary.json
"""

View File

@ -10,7 +10,9 @@ describe 'modulo coverage', ->
Asjon (assa) ->
asjon = assa
after asjon.after
afterEach asjon.clear
afterEach () ->
asjon.clear()
mock.restore()
require('../scripts/coverage.coffee')(asjon.robot)
done()
@ -31,8 +33,7 @@ describe 'modulo coverage', ->
it 'dovrebbe reagire correttamente ad un errore di parsing', (done) ->
# broken report
mock
'coverage/coverage-summary.json': '{'
'report/coverage/coverage-summary.json': '{'
asjon.receive (e,l) ->
l.join().should.match /^errore nel leggere il report:\nSyntaxError/g
done()
@ -41,7 +42,7 @@ describe 'modulo coverage', ->
it 'dovrebbe reagire correttamente quando il report non è disponibile', (done) ->
# missing report
mock
'coverage/coverage-summary.json':
'report/coverage/coverage-summary.json':
mock.symlink path: '/no-such-file'
asjon.receive (e,l) ->
l.join().should.match /^report non disponibile/g
@ -51,13 +52,11 @@ describe 'modulo coverage', ->
it 'dovrebbe parsare correttamente il report json', (done) ->
# fake report
mock
'coverage/coverage-summary.json': JSON.stringify
'report/coverage/coverage-summary.json': JSON.stringify
total: lines: pct: 73.11
'a/b.coffee': lines: pct: 92.12
'a/c.coffee': lines: pct: 81.67
asjon.receive (e,l) ->
l.join().should.match /^=== Coverage: /g
mock.restore()
done()
asjon.send 'asjon coverage'

3
test/mocha.opts Normal file
View File

@ -0,0 +1,3 @@
test/*.coffee
--reporter mochawesome
--reporter-options reportDir=report,reportFilename=index,json=false,quiet=true