implementato sistema di controllo copertura test

This commit is contained in:
Enrico Fasoli 2015-04-28 15:41:57 +02:00
parent dcaee41ac3
commit b9596a7ccf
5 changed files with 19 additions and 12 deletions

1
.gitignore vendored
View File

@ -6,5 +6,6 @@ hubot.lua
run.sh
run_telegram.sh
*.pub
coverage/
.telegram/
telegram.config

View File

@ -1,5 +1,4 @@
#expect = require("chai").expect
path = require("path")
path = require "path"
Robot = require("hubot/src/robot")
TextMessage = require("hubot/src/message").TextMessage

View File

@ -5,7 +5,10 @@
"author": "Enrico Fasoli <fazius2009@gmail.com>",
"description": "Il miglior amico della 5IA",
"dependencies": {
"chai": "^2.3.0",
"cheerio": "^0.19.0",
"coffee-coverage": "^0.4.6",
"coffee-script": "^1.9.2",
"github": "^0.2.4",
"htmlparser": "^1.7.7",
"hubot": "^2.12.0",
@ -16,6 +19,7 @@
"hubot-help": "^0.1.1",
"hubot-heroku-keepalive": "0.0.4",
"hubot-maps": "0.0.2",
"hubot-mock-adapter": "^1.0.0",
"hubot-pugme": "^0.1.0",
"hubot-redis-brain": "0.0.2",
"hubot-rules": "^0.1.0",
@ -25,20 +29,23 @@
"hubot-youtube": "^0.1.2",
"moment": "^2.10.2",
"nightmare": "^1.8.0",
"nock": "^1.7.1",
"nodepie": "^0.6.7",
"soupselect": "^0.2.0",
"weak": "^0.4.0",
"wolfram": "^0.3.1"
},
"config": {
"blanket": {
"pattern": ""
}
},
"scripts": {
"coverage-html": "mkdir -p coverage && mocha test/ --require coffee-coverage/register --compilers coffee:coffee-script/register -R html-cov scripts/ > coverage/coverage.html",
"coverage-json": "mkdir -p coverage && mocha test/ --require coffee-coverage/register --compilers coffee:coffee-script/register -R json-cov scripts/ > coverage/coverage.json",
"test": "mocha test/ --compilers coffee:coffee-script/register"
},
"engines": {
"node": "0.10.x"
},
"devDependencies": {
"chai": "^2.3.0",
"hubot-mock-adapter": "^1.0.0",
"nock": "^1.7.1"
}
}

View File

@ -33,7 +33,7 @@ runCmd = (cmd,res,cb) ->
module.exports = (robot) ->
robot.respond /aggiornati|scarica (?:gli )?aggiornamenti/i, (res) ->
if !isFromAdmin(res) then return res.send res.random nope
runCmd 'git pull && npm install && npm install --dev', res
runCmd 'git pull && npm install', res
robot.respond /(?:controlla gli )?aggiornamenti/i, (res) ->
if !isFromAdmin(res) then return res.send res.random nope
@ -41,7 +41,7 @@ module.exports = (robot) ->
robot.respond /(?:installa (?:le )?)?dipendenze/i, (res) ->
if !isFromAdmin(res) then return res.send res.random nope
runCmd 'npm install && npm install --dev', res
runCmd 'npm install', res
robot.respond /(?:esegui (?:i )?)?test/i, (res) ->
if !isFromAdmin(res) then return res.send res.random nope
@ -59,7 +59,7 @@ module.exports = (robot) ->
robot.on 'githubhook', (data,params) ->
if data.ref is 'refs/heads/master' and process.env.AUTO_KILL_ON_UPDATE
runCmd 'git pull && npm install && npm install --dev', null, ->
runCmd 'git pull && npm install', null, ->
dest = name: params.name, room: params.room.replace(':','#')
robot.send dest, 'riavvio in 5 SECONDI'
reboot = ->

View File

@ -33,7 +33,7 @@ describe 'modulo shell', ->
asjon.send 'asjon controlla gli aggiornamenti'
it 'dovrebbe eseguire i comandi corretti per installare gli aggiornamenti', (done) ->
cmd = 'git pull && npm install && npm install --dev'
cmd = 'git pull && npm install'
acc = 0
asjon.receive (e,l) ->
l.join().should.equal ss[acc]+cmd
@ -51,7 +51,7 @@ describe 'modulo shell', ->
asjon.send 'asjon controlla gli aggiornamenti'
it 'dovrebbe eseguire i comandi corretti per installare le dipendenze', (done) ->
cmd = 'npm install && npm install --dev'
cmd = 'npm install'
acc = 0
asjon.receive (e,l) ->
l.join().should.equal ss[acc]+cmd