Comparing version 3.1.2 to 3.2.0
{ | ||
"name": "kgo", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Flow control the super easy way", | ||
@@ -5,0 +5,0 @@ "main": "kgo.js", |
14
run.js
@@ -13,8 +13,18 @@ var stackSlice = require('stack-slice'), | ||
this._task.fn.apply(this, this._args.concat([function(error){ | ||
function complete(error){ | ||
if(step._complete){ | ||
throw new Error('Step callback called more than once for task: ' + step._task.names); | ||
} | ||
step._complete = true; | ||
var result = Array.prototype.slice.call(arguments, 1); | ||
step.done(error, result); | ||
}])); | ||
} | ||
this._task.fn.apply(this, this._args.concat([complete])); | ||
}; | ||
Step.prototype.done = function(error, result){ | ||
if(error){ | ||
@@ -21,0 +31,0 @@ if(error instanceof Error){ |
@@ -507,2 +507,21 @@ var test = require('tape'), | ||
}); | ||
}); | ||
test('done called more than once', function(t){ | ||
t.plan(2); | ||
var d = require('domain').create(); | ||
d.on('error', function(error){ | ||
t.ok(error instanceof Error, 'error is instance of Error'); | ||
t.equal(error.message, 'Step callback called more than once for task: someTask'); | ||
}); | ||
d.run(function(){ | ||
kgo | ||
('someTask', function(done){ | ||
done(); | ||
done(); | ||
}); | ||
}); | ||
}); |
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
24791
674