node/test/parallel/test-stream-writable-final-async.js
Rich Trott de9be2a679
test: remove lint rule for setTimeout() arguments
With the introduction of the promises API for setTimeout(), the
requirement that it have two parameters may not be sensible anymore in
tests.

PR-URL: https://github.com/nodejs/node/pull/41901
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-02-11 06:02:28 +00:00

26 lines
481 B
JavaScript

'use strict';
const common = require('../common');
const {
Duplex,
} = require('stream');
const { setTimeout } = require('timers/promises');
{
class Foo extends Duplex {
async _final(callback) {
await setTimeout(common.platformTimeout(1));
callback();
}
_read() {}
}
const foo = new Foo();
foo._write = common.mustCall((chunk, encoding, cb) => {
cb();
});
foo.end('test', common.mustCall());
foo.on('error', common.mustNotCall());
}