diff --git a/.gitignore b/.gitignore index 2d415e1..73f68bf 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ npm-debug.log apiref bower_components dist +report diff --git a/gulpfile.js b/gulpfile.js index 142f8db..aa98843 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -96,7 +96,8 @@ gulp.task('lint', function() { gulp.task('browser', ['errors'], function() { return gulp.src('index.js') .pipe(browserify({ - insertGlobals: true + insertGlobals: true, + standalone: 'bitcore' })) .pipe(rename('bitcore.js')) .pipe(gulp.dest('browser')); @@ -110,7 +111,7 @@ gulp.task('browser-all', ['errors'], function(callback) { runSequence(['browser'], ['browser-test'], callback); }); -gulp.task('karma', ['browser-test'], testKarma); +gulp.task('karma', ['browser-all'], testKarma); gulp.task('errors', shell.task([ 'node ./lib/errors/build.js' diff --git a/lib/errors/build.js b/lib/errors/build.js index 7130c0f..cbd44f9 100644 --- a/lib/errors/build.js +++ b/lib/errors/build.js @@ -14,10 +14,10 @@ var formatMessage = function(message) { var defineElement = function(fullName, baseClass, message) { return fullName + ' = function() {\n' + ' this.message = ' + formatMessage(message) + ';\n' + - ' ' + baseClass + '.call(this, this.message);\n' + - ' this.name = "' + fullName + '";\n' + + ' this.stack = this.message + \'\\n\' + (new Error()).stack;\n' + '};\n' + - 'inherits(' + fullName + ', ' + baseClass + ');\n\n'; + fullName + '.prototype = Object.create(' + baseClass + '.prototype);\n' + + fullName + '.prototype.name = "' + fullName + '";\n\n'; }; var traverseNode = function(baseClass, errorDefinition) { diff --git a/lib/errors/spec.js b/lib/errors/spec.js index cc3f1b9..6a0453b 100644 --- a/lib/errors/spec.js +++ b/lib/errors/spec.js @@ -4,7 +4,7 @@ module.exports = [{ errors: [ { name: 'InvalidArgument', - message: 'HDPrivateKey: Invalid Argument {0}, expected {1} but got {2}', + message: 'Invalid Argument {0}, expected {1} but got {2}', errors: [{ name: 'InvalidB58Char', message: 'Invalid Base58 character: {0} in {1}' @@ -48,7 +48,7 @@ module.exports = [{ errors: [ { name: 'InvalidArgument', - message: 'HDPublicKey: Invalid Argument {0}, expected {1} but got {2}', + message: 'Invalid Argument {0}, expected {1} but got {2}', errors: [{ name: 'ArgumentIsPrivateExtended', message: 'Argument is an extended private key: {0}' diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b619ac3..eb62ce9 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -38,6 +38,11 @@ } } }, + "inherits": { + "version": "2.0.1", + "from": "inherits@2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, "hash.js": { "version": "0.3.2", "from": "hash.js@0.3.2", @@ -49,6 +54,11 @@ } } }, + "lodash": { + "version": "2.4.1", + "from": "lodash@=2.4.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" + }, "sha512": { "version": "0.0.1", "from": "sha512@=0.0.1", diff --git a/package.json b/package.json index 5ae6407..9b56679 100644 --- a/package.json +++ b/package.json @@ -91,14 +91,11 @@ "gulp-mocha": "^2.0.0", "gulp-rename": "^1.2.0", "gulp-shell": "^0.2.10", - "inherits": "^2.0.1", - "lodash": "^2.4.1", "mocha": "~2.0.1", "run-sequence": "^1.0.2", "karma": "^0.12.28", "karma-firefox-launcher": "^0.1.3", "karma-mocha": "^0.1.9", - "lodash": "^2.4.1", "mocha": "~2.0.1", "run-sequence": "^1.0.2" },