Skip to content

Commit 0ce9a9c

Browse files
Trotttargos
authored andcommitted
test: replace setTimeout with setImmediate in stream test
Replace setTimeout() with setImmediate() in test-stream-writable-clear-buffer. The test still fails in Node.js 8.6.0 (if you comment out the `common` module, since it uses BigInts and those aren't supported in 8.6.0). PR-URL: #30561 Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent bf43bf5 commit 0ce9a9c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/sequential/test-stream-writable-clear-buffer.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
const common = require('../common');
2+
require('../common');
33
const Stream = require('stream');
44
// This test ensures that the _writeableState.bufferedRequestCount and
55
// the actual buffered request count are the same
@@ -10,11 +10,12 @@ class StreamWritable extends Stream.Writable {
1010
super({ objectMode: true });
1111
}
1212

13-
// We need a timeout like on the original issue thread
14-
// otherwise the code will never reach our test case
15-
// this means this should go on the sequential folder.
13+
// Refs: https://github.com/nodejs/node/issues/6758
14+
// We need a timer like on the original issue thread.
15+
// Otherwise the code will never reach our test case.
16+
// This means this should go in the sequential folder.
1617
_write(chunk, encoding, cb) {
17-
setTimeout(cb, common.platformTimeout(10));
18+
setImmediate(cb);
1819
}
1920
}
2021

0 commit comments

Comments
 (0)