callback-timeout
Advanced tools
@@ -6,3 +6,3 @@ var defineError = require('define-error') | ||
function TimeoutError () { | ||
this.code = 'ETIMEOUT' | ||
this.code = 'ETIMEDOUT' | ||
} |
@@ -15,5 +15,5 @@ var timeout = require('..') | ||
if (err) | ||
console.log(err.code, err.message) // ETIMEOUT ... | ||
console.log(err.code, err.message) // ETIMEDOUT ... | ||
else | ||
console.log('doSomethingSlowHandler executed without error') // Won't happen | ||
}, 1000)) |
{ | ||
"name": "callback-timeout", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Invokes callback with single error argument if timeout occurs before it's invoked by other means", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,3 +28,3 @@ callback-timeout | ||
if (err) | ||
console.log(err.code, err.message) // ETIMEOUT ... | ||
console.log(err.code, err.message) // ETIMEDOUT ... | ||
else | ||
@@ -50,3 +50,3 @@ console.log('doSomethingSlowHandler executed without error.') // Will not happen | ||
The constructor of the error supplied to the `callback` when a timeout occurs. | ||
TimeoutError objects will have a `code` property with the value `ETIMEOUT`. | ||
TimeoutError objects will have a `code` property with the value `ETIMEDOUT`. | ||
@@ -63,12 +63,12 @@ ## install | ||
`npm test [--dot | --spec] [--phantom] [--grep=pattern]` | ||
`npm test` | ||
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. | ||
### browser test | ||
`npm run browser-test` | ||
`npm run phantom` | ||
or | ||
`npm run travis-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. | ||
@@ -78,5 +78,8 @@ | ||
`npm run coverage [--html]` | ||
For a textual coverage overview: | ||
This will output a textual coverage report. Including `--html` will also open | ||
an HTML coverage report in the default browser. | ||
`npm run view-cover` | ||
or for an HTML coverage report: | ||
`npm run open-cover` |
var test = require('tape'), | ||
timeout = require('..') | ||
test('errors have code of ETIMEOUT', function (t) { | ||
test('errors have code of ETIMEDOUT', function (t) { | ||
t.plan(1) | ||
@@ -12,5 +12,5 @@ | ||
function done (err) { | ||
t.equal(err.code, 'ETIMEOUT') | ||
t.equal(err.code, 'ETIMEDOUT') | ||
} | ||
}) | ||
14
7.69%82
3.8%10974
-1.38%