Skip to content

Commit

Permalink
fix(empower): make _capt and _expr methods not enumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
twada committed Oct 21, 2015
1 parent d2193e0 commit 1b885b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var capturable = require('./lib/capturable');
var create = require('object-create');
var slice = Array.prototype.slice;
var extend = require('xtend/mutable');
var define = require('define-properties');

/**
* Enhance Power Assert feature to assert function/object.
Expand Down Expand Up @@ -40,7 +41,7 @@ function empower (assert, formatter, options) {
default:
throw new Error('Cannot be here');
}
extend(enhancedAssert, capturable());
define(enhancedAssert, capturable());
return enhancedAssert;
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"array-foreach": "^1.0.1",
"array-map": "0.0.0",
"array-some": "^1.0.0",
"define-properties": "^1.1.2",
"escallmatch": "^1.4.1",
"object-create": "^0.1.0",
"xtend": "^4.0.0"
Expand Down
14 changes: 14 additions & 0 deletions test/empower_option_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,23 @@ function sharedTestsForEmpowerFunctionReturnValue () {
test('has _capt method', function () {
assert.equal(typeof this.empoweredAssert._capt, 'function');
});
test('_capt method should not be enumerable', function () {
var key, enumerated = {};
for (key in this.empoweredAssert) {
enumerated[key] = this.empoweredAssert[key];
}
assert.equal(typeof enumerated['_capt'], 'undefined');
});
test('has _expr method', function () {
assert.equal(typeof this.empoweredAssert._expr, 'function');
});
test('_expr method should not be enumerable', function () {
var key, enumerated = {};
for (key in this.empoweredAssert) {
enumerated[key] = this.empoweredAssert[key];
}
assert.equal(typeof enumerated['_expr'], 'undefined');
});
test('has equal method', function () {
assert.equal(typeof this.empoweredAssert.equal, 'function');
});
Expand Down

0 comments on commit 1b885b6

Please sign in to comment.