Skip to content

Commit

Permalink
Merge pull request #41 from stephenyeargin/code-coverage
Browse files Browse the repository at this point in the history
Code coverage
  • Loading branch information
stephenyeargin committed Dec 15, 2015
2 parents 2258979 + 97b30c9 commit 6fb3bc4
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 5 deletions.
45 changes: 43 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
/node_modules
.node-version
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# IDE
.idea

# Code coverage
coverage.json
.coveralls.yml

# Node versions (nodenv)
.node-version
6 changes: 5 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ module.exports = function (grunt) {
test: {
options: {
reporter: 'spec',
require: 'coffee-script'
require: [
'coffee-script',
'blanket',
],
compilers: 'coffee:coffee-script/register'
},
src: ['test/**/*.coffee']
}
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"hubot": "2.x"
},
"devDependencies": {
"blanket": "^1.2.1",
"chai": "^2.1.1",
"coffee-script": "1.6.3",
"coffee-script": "1.10.0",
"coveralls": "^2.11.6",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-watch": "~0.6.1",
Expand All @@ -31,9 +33,19 @@
"hubot-test-helper": "0.0.6",
"matchdep": "~0.3.0",
"mocha": "^2.1.0",
"mocha-lcov-reporter": "^1.0.0",
"nock": "^2.3.0",
"require-dir": "^0.3.0",
"sinon": "^1.13.0",
"sinon-chai": "^2.7.0"
"sinon-chai": "^2.7.0",
"travis-cov": "^0.2.5"
},
"config": {
"blanket": {
"pattern": "src",
"data-cover-never": "node_modules",
"loader": "./node-loaders/coffee-script"
}
},
"main": "index.coffee",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions test/grafana-s3-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ expect = chai.expect

room = null

before ->
matchesBlanket = (path) -> path.match /node_modules\/blanket/
runningTestCoverage = Object.keys(require.cache).filter(matchesBlanket).length > 0
if runningTestCoverage
require('require-dir')("#{__dirname}/../src", {recurse: true, duplicates: true})

setupRoomAndRequestGraph = (done) ->
room = helper.createRoom()

Expand Down
6 changes: 6 additions & 0 deletions test/grafana-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ helper = new Helper('./../src/grafana.coffee')

expect = chai.expect

before ->
matchesBlanket = (path) -> path.match /node_modules\/blanket/
runningTestCoverage = Object.keys(require.cache).filter(matchesBlanket).length > 0
if runningTestCoverage
require('require-dir')("#{__dirname}/../src", {recurse: true, duplicates: true})

describe 'grafana', ->
room = null

Expand Down
6 changes: 6 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--compilers coffee:coffee-script/register
--reporter list
--require coffee-script
--require test/test_helper.coffee
--colors
--full-trace
2 changes: 2 additions & 0 deletions test/test_helper.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.env.NODE_ENV = 'test'
process.env.HUBOT_DEPLOY_APPS_JSON = require("path").join(__dirname, "test_apps.json")

0 comments on commit 6fb3bc4

Please sign in to comment.