diff --git a/test/simple/test-fs-write-stream-end.js b/test/simple/test-fs-write-stream-end.js index 6c0f29c344..2a85ac3eea 100644 --- a/test/simple/test-fs-write-stream-end.js +++ b/test/simple/test-fs-write-stream-end.js @@ -31,7 +31,8 @@ var writeEndOk = false; var file = path.join(common.tmpDir, 'write-end-test.txt'); var stream = fs.createWriteStream(file); - stream.end('a\n', 'utf8', function() { + stream.end('a\n', 'utf8'); + stream.on('close', function() { var content = fs.readFileSync(file, 'utf8'); assert.equal(content, 'a\n'); writeEndOk = true;