Skip to content

Commit a10d19b

Browse files
committed
Fix occasional test errors on Chrome 45
If multiple chunks of data got queued up, the abort on data test would erroneously fail. Wait till the end of the tick before considering 'data' events as errors.
1 parent a169930 commit a10d19b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/browser/abort.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,25 @@ test('abort on response', function (t) {
3030
test('abort on data', function (t) {
3131
var req = http.get('/browserify.png?copies=5', function (res) {
3232
var firstData = true
33+
var failOnData = false
3334

3435
res.on('end', function () {
3536
t.fail('unexpected end')
3637
})
3738

3839
res.on('data', function (data) {
39-
if (firstData) {
40+
if (failOnData)
41+
t.fail('unexpected data')
42+
else if (firstData) {
4043
firstData = false
4144
req.abort()
4245
t.end()
43-
} else {
44-
t.fail('unexpected data')
46+
process.nextTick(function () {
47+
// Wait for any data that may have been queued
48+
// in the stream before considering data events
49+
// as errors
50+
failOnData = true
51+
})
4552
}
4653
})
4754
})

0 commit comments

Comments
 (0)