Skip to content

Commit

Permalink
support coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
yaniswang committed Oct 6, 2015
1 parent 895970d commit 68160df
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 402 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
lib-cov
node_modules
coverage
npm-debug.log
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
lib-cov
node_modules
coverage
npm-debug.log
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ sudo: false
language: node_js
node_js:
- "0.12"

cache:
directories:
- node_modules

matrix:
fast_finish: true

script: "grunt"

after_success: istanbul-coveralls
39 changes: 6 additions & 33 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/*global module:false*/
module.exports = function(grunt) {

var bWin32 = process.platform === 'win32',
setCmd = bWin32 ? 'set' : 'export',
cmdSplit = bWin32 ? '&' : '&&';

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks('grunt-mocha-hack');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-watch');
Expand All @@ -25,30 +20,16 @@ module.exports = function(grunt) {
}
}
},
clean: ["lib", "lib-cov", "coverage.html"],
clean: ["lib", "coverage"],
concat: {
htmlhint: {
src: ['src/core.js', 'src/reporter.js', 'src/htmlparser.js', 'src/rules/*.js'],
dest: 'lib/htmlhint.js'
}
},
"mocha-hack": {
test: {
src: "test/**/*.js",
options: {
useColors: true,
reporter: 'spec'
}
}
},
exec: {
jscover: {
command: '"./node_modules/.bin/jscover" lib lib-cov',
stdout: true,
stderr: true
},
savecover: {
command: setCmd + ' HTMLHINT_COV=1 '+cmdSplit+' "./node_modules/.bin/mocha" --recursive --reporter html-cov > coverage.html',
test: {
command: '"./node_modules/.bin/istanbul" cover "./node_modules/mocha/bin/_mocha" -- --recursive',
stdout: true,
stderr: true
}
Expand Down Expand Up @@ -81,22 +62,14 @@ module.exports = function(grunt) {
},
watch: {
src: {
files: ['src/**/*.js'],
files: ['src/**/*.js', 'test/**/*.js'],
tasks: 'dev'
},
test: {
files: ['test/**/*.js'],
tasks: 'test'
}
}
});

grunt.registerTask('dev', ['jshint', 'concat', 'test']);

grunt.registerTask('test', 'mocha-hack');

grunt.registerTask('test-cov', ['exec:jscover', 'exec:savecover']);
grunt.registerTask('dev', ['jshint', 'clean', 'concat', 'exec:test']);

grunt.registerTask('default', ['jshint', 'clean', 'concat', 'test', 'test-cov', 'uglify', 'replace']);
grunt.registerTask('default', ['dev', 'uglify', 'replace']);

};
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ HTMLHint

HTMLHint is a Static Code Analysis Tool for HTML, you can use it with IDE or in build system.

[![Build Status](https://travis-ci.org/yaniswang/HTMLHint.png?branch=master)](https://travis-ci.org/yaniswang/HTMLHint) [![NPM version](https://badge.fury.io/js/htmlhint.png)](http://badge.fury.io/js/htmlhint)

jsCoverage: [98%](http://htmlhint.com/coverage.html)
[![Build Status](https://img.shields.io/travis/yaniswang/HTMLHint.svg)](https://travis-ci.org/yaniswang/HTMLHint)
[![Coverage Status](https://img.shields.io/coveralls/yaniswang/htmlhint.svg?style=flat)](https://coveralls.io/r/yaniswang/htmlhint?branch=master)
[![NPM version](https://img.shields.io/npm/v/htmlhint.svg?style=flat)](https://www.npmjs.com/package/htmlhint)
[![NPM count](https://img.shields.io/npm/dm/htmlhint.svg?style=flat)](https://www.npmjs.com/package/htmlhint)
[![NPM count](https://img.shields.io/npm/dt/htmlhint.svg?style=flat)](https://www.npmjs.com/package/htmlhint)

Official Site: [http://htmlhint.com/](http://htmlhint.com/)

Expand Down
355 changes: 0 additions & 355 deletions coverage.html

This file was deleted.

4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = process.env.HTMLHINT_COV
? require('./lib-cov/htmlhint')
: require('./lib/htmlhint');
module.exports = require('./lib/htmlhint');
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
"grunt-contrib-uglify": "0.2.0",
"grunt-contrib-watch": "0.3.1",
"grunt-exec": "0.4.0",
"grunt-mocha-hack": "0.1.0",
"grunt-replace": "0.4.0",
"jscover": "0.2.4",
"mocha": "2.2.0"
"mocha": "2.2.0",
"istanbul-coveralls": "1.0.3"
},
"bin": {
"htmlhint": "./bin/htmlhint"
Expand Down

0 comments on commit 68160df

Please sign in to comment.