Comparing version 3.0.3 to 3.0.4
12
index.js
@@ -232,3 +232,3 @@ var abbott = require('abbott'); | ||
for(var i = 0; i < callbacks.length; i++){ | ||
callbacks[i].apply(null, results); | ||
defer(callbacks[i].apply.bind(callbacks[i], null, results)); | ||
} | ||
@@ -320,5 +320,4 @@ } | ||
function resolver(callback){ | ||
var context = this, | ||
complete = callback; | ||
function resolver(complete){ | ||
var context = this; | ||
@@ -341,2 +340,3 @@ // No callback? Just run the task. | ||
} | ||
context.callbacks.push(complete); | ||
@@ -348,3 +348,3 @@ | ||
var complete = resolveWithDependencies.bind(context, function(resolvedResults){ | ||
var resolved = resolveWithDependencies.bind(context, function(resolvedResults){ | ||
if(righto._debug){ | ||
@@ -359,3 +359,3 @@ if(righto._autotrace || context.resolve._traceOnExecute){ | ||
defer(resolveDependencies.bind(null, context.args, complete, resolveDependency.bind(context.resolve))); | ||
defer(resolveDependencies.bind(null, context.args, resolved, resolveDependency.bind(context.resolve))); | ||
@@ -362,0 +362,0 @@ return context.resolve; |
{ | ||
"name": "righto", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -1536,2 +1536,77 @@ var test = require('tape'), | ||
}, 50); | ||
}); | ||
test('enourmous handle stack depth success', function(t){ | ||
t.plan(1); | ||
var depth = 0; | ||
var testDepth = 10000; | ||
function run(callback){ | ||
var thingo = righto.handle(righto(function(done){ | ||
if(depth++ < testDepth){ | ||
return done('error'); | ||
} | ||
done(null, 'complete'); | ||
}), function(error, done){ | ||
if(error){ | ||
return run(done); | ||
} | ||
done(); | ||
}); | ||
thingo(callback); | ||
} | ||
run(function(error, result){ | ||
t.equal(result, 'complete', 'Success after enourmous handle depth'); | ||
}) | ||
}); | ||
test('enourmous handle stack depth reject', function(t){ | ||
t.plan(1); | ||
var depth = 0; | ||
var testDepth = 10000; | ||
function run(callback){ | ||
var thingo = righto.handle(righto(function(done){ | ||
if(depth++ < testDepth){ | ||
return done('retry'); | ||
} | ||
done('fail'); | ||
}), function(error, done){ | ||
if(error === 'retry'){ | ||
return run(done); | ||
} | ||
done(error); | ||
}); | ||
thingo(callback); | ||
} | ||
run(function(error, result){ | ||
t.equal(error, 'fail', 'Rejection after enourmous handle depth'); | ||
}) | ||
}); | ||
test('enourmous stack depth already done', function(t){ | ||
t.plan(1); | ||
var depth = 0; | ||
var testDepth = 10000; | ||
var x = righto.from(1); | ||
while(depth++ < testDepth){ | ||
x = righto.sync(x => x, x); | ||
} | ||
x(function(error, result){ | ||
t.equal(result, 1, 'Success after enourmous handle depth'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68723
1784