Skip to content

Commit

Permalink
test: replace setTimeout with setImmediate in stream test
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and addaleax committed Nov 30, 2019
1 parent 8ef629a commit e122d39
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/sequential/test-stream-writable-clear-buffer.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
}
}

Expand Down

0 comments on commit e122d39

Please sign in to comment.