Comparing version 1.0.1 to 1.0.2
@@ -6,8 +6,8 @@ var setImmediate = require('timers').setImmediate | ||
done.then(function (value) { | ||
setImmediate(cb.bind(undefined, null, value)) | ||
setImmediate(cb, null, value) | ||
}) | ||
done.catch(function (err) { | ||
setImmediate(cb.bind(undefined, err || new Error('rejected with no reason'))) | ||
setImmediate(cb, err || new Error('rejected with no reason')) | ||
}) | ||
return done | ||
} |
{ | ||
"name": "afterward", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Execute an error-first callback upon resolution or rejection of a promise (and return the promise)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ # afterward | ||
[![Coverage Status](https://coveralls.io/repos/jasonpincin/afterward/badge.png?branch=master)](https://coveralls.io/r/jasonpincin/afterward?branch=master) | ||
[![Davis Dependency Status](https://david-dm.org/jasonpincin/afterward.png)](https://david-dm.org/jasonpincin/afterward) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/jp-afterward.svg)](https://saucelabs.com/u/jp-afterward) | ||
@@ -49,9 +49,16 @@ Execute an error-first callback upon resolution or rejection of a promise, and return the promise. | ||
`npm test [--dot | --spec] [--grep=pattern]` | ||
`npm test [--dot | --spec] [--phantom] [--grep=pattern]` | ||
Specifying `--dot` or `--spec` will change the output from the default TAP style. | ||
Specifying `--phantom` will cause the tests to run in the headless phantom browser instead of node. | ||
Specifying `--grep` will only run the test files that match the given pattern. | ||
## coverage | ||
### browser test | ||
`npm run browser-test` | ||
This will run the tests in all browsers (specified in .zuul.yml). Be sure to [educate zuul](https://github.com/defunctzombie/zuul/wiki/cloud-testing#2-educate-zuul) first. | ||
### coverage | ||
`npm run coverage [--html]` | ||
@@ -58,0 +65,0 @@ |
@@ -8,3 +8,3 @@ var test = require('tape'), | ||
test('afterward', function (t) { | ||
t.plan(8) | ||
t.plan(10) | ||
@@ -34,3 +34,6 @@ var p1 = Promise.resolve('hi') | ||
}) | ||
var p4b = afterward(p4a) | ||
var p4b = afterward(p4a, function (err, msg) { | ||
t.false(err) | ||
t.equal(msg, 'hi', 'executes callback after async op') | ||
}) | ||
t.equal(p4a, p4b, 'returns promise given') | ||
@@ -37,0 +40,0 @@ p4b.then(function (data) { |
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
10683
62
66