From aba1ff202cd5d4a3377321626c3e2661a3564371 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 16 Mar 2018 22:12:37 -0700 Subject: [PATCH] test: refactor test-fs-readfile-tostring-fail The test uses both `assert()` and `assert.ok()`. Use just `assert.ok()`. Remove a comment that does not appear to match the code and does not seem to explain much beyond the bare code itself. PR-URL: https://github.com/nodejs/node/pull/19404 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Shingo Inoue Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/sequential/test-fs-readfile-tostring-fail.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/sequential/test-fs-readfile-tostring-fail.js b/test/sequential/test-fs-readfile-tostring-fail.js index 88cf7347efbfdf..81c7a941eb9476 100644 --- a/test/sequential/test-fs-readfile-tostring-fail.js +++ b/test/sequential/test-fs-readfile-tostring-fail.js @@ -30,11 +30,10 @@ for (let i = 0; i < 201; i++) { stream.end(); stream.on('finish', common.mustCall(function() { - // make sure that the toString does not throw an error fs.readFile(file, 'utf8', common.mustCall(function(err, buf) { assert.ok(err instanceof Error); - assert(/^(Array buffer allocation failed|"toString\(\)" failed)$/ - .test(err.message)); + assert.ok(/^(Array buffer allocation failed|"toString\(\)" failed)$/ + .test(err.message)); assert.strictEqual(buf, undefined); })); }));