From 6bdb9c362141b1b4ea3a23c4b654ed9cb351bb5d Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Tue, 24 Oct 2017 17:35:19 +0100 Subject: [PATCH] Use nyc for test coverage Use existing coverage as threshold values Bump mocha back to latest that supports Node 0.12 --- .gitignore | 8 ++++---- gruntfile.js | 27 --------------------------- package.json | 23 ++++++++++++++++++----- test/coverage/blanket.js | 4 ---- 4 files changed, 22 insertions(+), 40 deletions(-) mode change 100755 => 100644 .gitignore delete mode 100644 test/coverage/blanket.js diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index c27bf0856..d2d408edb --- a/.gitignore +++ b/.gitignore @@ -4,14 +4,14 @@ thumbs.db node_modules/ .settings .session.vim -coverage.html -lib-cov/ .vscode # Ignore webstorm directories .idea/ - .bundle/ docs/_site -Gemfile.lock \ No newline at end of file +Gemfile.lock + +.nyc_output +coverage diff --git a/gruntfile.js b/gruntfile.js index e394ddafa..b28db3366 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -28,30 +28,6 @@ module.exports = function(grunt) { reporter: 'spec' }, src: ['test/**/*.js'] - }, - testCoverage: { - options: { - reporter: 'spec', - require: 'test/coverage/blanket' - }, - src: ['test/**/*.js'] - }, - coverage: { - options: { - reporter: 'html-cov', - // use the quiet flag to suppress the mocha console output - quiet: true, - // specify a destination file to capture the mocha - // output (the quiet option does not suppress this) - captureFile: 'coverage.html' - }, - src: ['test/**/*.js'] - }, - 'travis-cov': { - options: { - reporter: 'travis-cov' - }, - src: ['test/**/*.js'] } } }); @@ -87,7 +63,4 @@ module.exports = function(grunt) { grunt.registerTask('default', ['jshint', 'dynamo:start', 'mochaTest']); grunt.registerTask('test', ['jshint', 'dynamo:start', 'mochaTest:test']); - - grunt.registerTask('coverage', ['jshint', 'dynamo:start', 'mochaTest:testCoverage', 'mochaTest:coverage', 'mochaTest:travis-cov']); - }; diff --git a/package.json b/package.json index 970c6c7d1..c59f33229 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "main": "index.js", "scripts": { "test": "grunt test", - "coverage": "grunt coverage" + "coverage": "nyc grunt test" }, "keywords": [ "dynamodb", @@ -37,14 +37,13 @@ "author": "Brandon Goode ", "license": "MIT", "devDependencies": { - "blanket": "1.1.5", "dynamodb-local": "0.0.18", "grunt": "^1.0.1", "grunt-contrib-jshint": "^1.1.0", "grunt-mocha-test": "^0.13.2", - "mocha": "^2.5.3", - "should": "^11.2.1", - "travis-cov": "^0.2.5" + "mocha": "^3.5.3", + "nyc": "^11.2.1", + "should": "^11.2.1" }, "dependencies": { "aws-sdk": "^2.80.0", @@ -52,5 +51,19 @@ "hooks": "0.3.2", "lodash": "^4.17.4", "q": "^1.5.0" + }, + "nyc": { + "include": [ + "lib/**/*.js" + ], + "reporter": [ + "html", + "text-summary" + ], + "check-coverage": true, + "lines": 82, + "statements": 82, + "functions": 87, + "branches": 71 } } diff --git a/test/coverage/blanket.js b/test/coverage/blanket.js deleted file mode 100644 index 5b472c689..000000000 --- a/test/coverage/blanket.js +++ /dev/null @@ -1,4 +0,0 @@ -require('blanket')({ - // Only files that match the pattern will be instrumented - pattern: 'dynamoose/lib/' -}); \ No newline at end of file