kareem 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/package.json +1 -1
- package/test/pre.test.js +21 -0
package/index.js
CHANGED
|
@@ -322,6 +322,7 @@ Kareem.prototype.clone = function() {
|
|
|
322
322
|
continue;
|
|
323
323
|
}
|
|
324
324
|
n._pres[key] = this._pres[key].slice();
|
|
325
|
+
n._pres[key].numAsync = this._pres[key].numAsync;
|
|
325
326
|
}
|
|
326
327
|
for (var key in this._posts) {
|
|
327
328
|
if (!this._posts.hasOwnProperty(key)) {
|
|
@@ -340,6 +341,7 @@ Kareem.prototype.merge = function(other) {
|
|
|
340
341
|
continue;
|
|
341
342
|
}
|
|
342
343
|
ret._pres[key] = (ret._pres[key] || []).concat(other._pres[key].slice());
|
|
344
|
+
ret._pres[key].numAsync += other._pres[key].numAsync;
|
|
343
345
|
}
|
|
344
346
|
for (var key in other._posts) {
|
|
345
347
|
if (!other._posts.hasOwnProperty(key)) {
|
package/package.json
CHANGED
package/test/pre.test.js
CHANGED
|
@@ -135,6 +135,27 @@ describe('execPre', function() {
|
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
it('async pres with clone()', function(done) {
|
|
139
|
+
var execed = false;
|
|
140
|
+
|
|
141
|
+
hooks.pre('cook', true, function(next, done) {
|
|
142
|
+
execed = true;
|
|
143
|
+
setTimeout(
|
|
144
|
+
function() {
|
|
145
|
+
done();
|
|
146
|
+
},
|
|
147
|
+
5);
|
|
148
|
+
|
|
149
|
+
next();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
hooks.clone().execPre('cook', null, function(err) {
|
|
153
|
+
assert.ifError(err);
|
|
154
|
+
assert.ok(execed);
|
|
155
|
+
done();
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
138
159
|
it('returns correct error when async pre errors', function(done) {
|
|
139
160
|
var execed = {};
|
|
140
161
|
|