From 5c60363409a3112433cb6c4a28c932713e9512c3 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Sat, 6 Apr 2019 11:01:23 +0800 Subject: [PATCH] test: fix this scope bug in test-stream2-writable.js --- test/parallel/test-stream2-writable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index 5b25da0b67c0b8..7c5f825a575d69 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -322,13 +322,14 @@ for (let i = 0; i < chunks.length; i++) { assert.strictEqual(this.writing, undefined); wrote = true; this.writing = true; - setTimeout(function() { + setTimeout(() => { this.writing = false; cb(); }, 1); }; w.on('finish', common.mustCall(function() { assert.strictEqual(wrote, true); + assert.strictEqual(this.writing, false); })); w.write(Buffer.alloc(0)); w.end();