diff --git a/.gitignore b/.gitignore index 1296338..e2a293b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ lib-cov # Coverage directory used by tools like istanbul coverage +.nyc_output # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt diff --git a/karma.conf.js b/karma.conf.js index cf70b03..1ffca9b 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -19,6 +19,7 @@ module.exports = function(config) { 'node_modules/chai/chai.js', 'dist/regenerator.min.js', 'dist/nodent.min.js', + 'node_modules/bluebird/js/browser/bluebird.core.min.js', '.browser/*.spec.js' ], diff --git a/karma.sauce.js b/karma.sauce.js index e787518..1316ab0 100644 --- a/karma.sauce.js +++ b/karma.sauce.js @@ -113,6 +113,7 @@ module.exports = function(config) { 'dist/ajv.min.js', 'node_modules/chai/chai.js', 'dist/nodent.min.js', + 'node_modules/bluebird/js/browser/bluebird.core.min.js', '.browser/*.spec.js' ], diff --git a/package.json b/package.json index 4f2b32f..89eaecc 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test-spec": "mocha spec/*.spec.js -R spec", "test-fast": "AJV_FAST_TEST=true npm run test-spec", "test-debug": "mocha spec/*.spec.js --debug-brk -R spec", - "test-cov": "istanbul cover -x '**/spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec", + "test-cov": "nyc npm run test-spec", "test-ts": "tsc --target ES5 --noImplicitAny lib/ajv.d.ts", "bundle": "./scripts/bundle . Ajv pure_getters", "bundle-regenerator": "./scripts/bundle regenerator", @@ -30,6 +30,16 @@ "prepublish": "npm run build && npm run bundle-all", "watch": "watch 'npm run build' ./lib/dot" }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, "repository": { "type": "git", "url": "https://github.com/epoberezkin/ajv.git" @@ -66,7 +76,6 @@ "gh-pages-generator": "^0.2.0", "glob": "^7.0.0", "if-node-version": "^1.0.0", - "istanbul": "^0.4.2", "js-beautify": "^1.5.6", "jshint": "^2.8.0", "json-schema-test": "^1.1.1", @@ -77,6 +86,7 @@ "karma-sauce-launcher": "^0.3.0", "mocha": "^3.0.0", "nodent": "^2.5.3", + "nyc": "^8.3.0", "phantomjs-prebuilt": "^2.1.4", "pre-commit": "^1.1.1", "regenerator": "0.8.42", diff --git a/spec/after_test.js b/spec/after_test.js new file mode 100644 index 0000000..17c0167 --- /dev/null +++ b/spec/after_test.js @@ -0,0 +1,19 @@ +'use strict'; + +var should = require('./chai').should(); + +exports.error = function (res) { + console.log('ajv options:', res.validator._opts); +}; + +exports.each = function (res) { + // console.log(res.errors); + res.valid .should.be.a('boolean'); + if (res.valid === true ) { + should.equal(res.errors, null); + } else { + res.errors .should.be.an('array'); + for (var i=0; i