Skip to content
Permalink
Browse files

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 <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
Trott authored and MylesBorins committed Nov 20, 2019
1 parent 8af3311 commit 4a5f00c35d8fa18ab8f8caef4a91253aff8faf27
Showing with 6 additions and 5 deletions.
  1. +6 −5 test/sequential/test-stream-writable-clear-buffer.js
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const Stream = require('stream');
// This test ensures that the _writeableState.bufferedRequestCount and
// the actual buffered request count are the same
@@ -10,11 +10,12 @@ class StreamWritable extends Stream.Writable {
super({ objectMode: true });
}

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

0 comments on commit 4a5f00c

Please sign in to comment.
You can’t perform that action at this time.