Merge pull request #546 from Mingun/coverage
Add code coverage by Istanbul and coveralls.io
This commit is contained in:
commit
75d655409c
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
/browser
|
/browser
|
||||||
/examples/*.js
|
/examples/*.js
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/coverage
|
||||||
|
/.nyc_output
|
||||||
|
|
|
@ -10,6 +10,9 @@ node_js:
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g gulp
|
- npm install -g gulp
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- npm run coverage
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[![ci](https://img.shields.io/travis/pegjs/pegjs.svg)](https://travis-ci.org/pegjs/pegjs)
|
[![ci](https://img.shields.io/travis/pegjs/pegjs.svg)](https://travis-ci.org/pegjs/pegjs)
|
||||||
|
[![coverage](https://img.shields.io/coveralls/github/pegjs/pegjs.svg)](https://coveralls.io/github/pegjs/pegjs)
|
||||||
[![release](https://img.shields.io/npm/v/pegjs.svg)](https://www.npmjs.com/package/pegjs)
|
[![release](https://img.shields.io/npm/v/pegjs.svg)](https://www.npmjs.com/package/pegjs)
|
||||||
[![dev](https://img.shields.io/npm/v/pegjs/dev.svg)](https://github.com/pegjs/pegjs)
|
[![dev](https://img.shields.io/npm/v/pegjs/dev.svg)](https://github.com/pegjs/pegjs)
|
||||||
[![bower](https://img.shields.io/bower/v/pegjs.svg)](https://github.com/pegjs/bower)
|
[![bower](https://img.shields.io/bower/v/pegjs.svg)](https://github.com/pegjs/bower)
|
||||||
|
|
|
@ -427,6 +427,7 @@ function generateJS( ast, options ) {
|
||||||
" ip++;",
|
" ip++;",
|
||||||
" break;",
|
" break;",
|
||||||
"",
|
"",
|
||||||
|
" // istanbul ignore next",
|
||||||
" default:",
|
" default:",
|
||||||
" throw new Error(\"Invalid opcode: \" + bc[ip] + \".\");",
|
" throw new Error(\"Invalid opcode: \" + bc[ip] + \".\");",
|
||||||
" }",
|
" }",
|
||||||
|
@ -533,6 +534,7 @@ function generateJS( ast, options ) {
|
||||||
elseSp = stack.sp;
|
elseSp = stack.sp;
|
||||||
ip += elseLength;
|
ip += elseLength;
|
||||||
|
|
||||||
|
// istanbul ignore if
|
||||||
if ( thenSp !== elseSp ) {
|
if ( thenSp !== elseSp ) {
|
||||||
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -567,6 +569,7 @@ function generateJS( ast, options ) {
|
||||||
bodySp = stack.sp;
|
bodySp = stack.sp;
|
||||||
ip += bodyLength;
|
ip += bodyLength;
|
||||||
|
|
||||||
|
// istanbul ignore if
|
||||||
if ( bodySp !== baseSp ) {
|
if ( bodySp !== baseSp ) {
|
||||||
|
|
||||||
throw new Error( "Body of a loop can't move the stack pointer." );
|
throw new Error( "Body of a loop can't move the stack pointer." );
|
||||||
|
@ -780,6 +783,7 @@ function generateJS( ast, options ) {
|
||||||
ip++;
|
ip++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// istanbul ignore next
|
||||||
default:
|
default:
|
||||||
throw new Error( "Invalid opcode: " + bc[ ip ] + "." );
|
throw new Error( "Invalid opcode: " + bc[ ip ] + "." );
|
||||||
|
|
||||||
|
@ -843,6 +847,7 @@ function generateJS( ast, options ) {
|
||||||
" this.location = location;",
|
" this.location = location;",
|
||||||
" this.name = \"SyntaxError\";",
|
" this.name = \"SyntaxError\";",
|
||||||
"",
|
"",
|
||||||
|
" // istanbul ignore next",
|
||||||
" if (typeof Error.captureStackTrace === \"function\") {",
|
" if (typeof Error.captureStackTrace === \"function\") {",
|
||||||
" Error.captureStackTrace(this, peg$SyntaxError);",
|
" Error.captureStackTrace(this, peg$SyntaxError);",
|
||||||
" }",
|
" }",
|
||||||
|
@ -1003,6 +1008,7 @@ function generateJS( ast, options ) {
|
||||||
" log(event);",
|
" log(event);",
|
||||||
" break;",
|
" break;",
|
||||||
"",
|
"",
|
||||||
|
" // istanbul ignore next",
|
||||||
" default:",
|
" default:",
|
||||||
" throw new Error(\"Invalid event type: \" + event.type + \".\");",
|
" throw new Error(\"Invalid event type: \" + event.type + \".\");",
|
||||||
" }",
|
" }",
|
||||||
|
|
|
@ -17,6 +17,7 @@ function peg$SyntaxError(message, expected, found, location) {
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.name = "SyntaxError";
|
this.name = "SyntaxError";
|
||||||
|
|
||||||
|
// istanbul ignore next
|
||||||
if (typeof Error.captureStackTrace === "function") {
|
if (typeof Error.captureStackTrace === "function") {
|
||||||
Error.captureStackTrace(this, peg$SyntaxError);
|
Error.captureStackTrace(this, peg$SyntaxError);
|
||||||
}
|
}
|
||||||
|
|
16
package.json
16
package.json
|
@ -30,7 +30,8 @@
|
||||||
"clean": "gulp clean",
|
"clean": "gulp clean",
|
||||||
"test:impact": "node test/impact",
|
"test:impact": "node test/impact",
|
||||||
"test:server": "node test/server/run",
|
"test:server": "node test/server/run",
|
||||||
"test": "gulp"
|
"test": "nyc gulp",
|
||||||
|
"coverage": "nyc report --reporter=text-lcov | coveralls"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-preset-es2015": "6.24.1",
|
"babel-preset-es2015": "6.24.1",
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
"babelify": "8.0.0",
|
"babelify": "8.0.0",
|
||||||
"browserify": "14.5.0",
|
"browserify": "14.5.0",
|
||||||
"chai": "4.1.2",
|
"chai": "4.1.2",
|
||||||
|
"coveralls": "3.0.0",
|
||||||
"del": "3.0.0",
|
"del": "3.0.0",
|
||||||
"eslint-config-futagozaryuu": "3.7.x",
|
"eslint-config-futagozaryuu": "3.7.x",
|
||||||
"express": "4.16.2",
|
"express": "4.16.2",
|
||||||
|
@ -50,6 +52,7 @@
|
||||||
"gulp-rename": "1.2.2",
|
"gulp-rename": "1.2.2",
|
||||||
"gulp-uglify": "3.0.0",
|
"gulp-uglify": "3.0.0",
|
||||||
"morgan": "1.9.0",
|
"morgan": "1.9.0",
|
||||||
|
"nyc": "11.3.0",
|
||||||
"run-sequence": "2.2.0",
|
"run-sequence": "2.2.0",
|
||||||
"sinon": "4.1.3",
|
"sinon": "4.1.3",
|
||||||
"vinyl-buffer": "1.0.0",
|
"vinyl-buffer": "1.0.0",
|
||||||
|
@ -57,5 +60,16 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"nyc": {
|
||||||
|
"exclude": [
|
||||||
|
"test",
|
||||||
|
"gulpfile.js",
|
||||||
|
"**/.eslintrc.js"
|
||||||
|
],
|
||||||
|
"reporter": [
|
||||||
|
"text",
|
||||||
|
"text-summary"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue