From 2f19dcddaab47bf61ef470f3419d2b1c06f94cc3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 6 Jun 2017 09:53:32 -0700 Subject: [PATCH] test: refactor test-fs-read-* * Use `common.mustNotCall()` in place of `common.noop` where appropriate * Increase specificity of regular expressions (that is, make them match the whole error string rather than part of the error string) in `assert.throws()` calls PR-URL: https://github.com/nodejs/node/pull/13501 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson --- test/parallel/test-fs-read-file-assert-encoding.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-read-file-assert-encoding.js b/test/parallel/test-fs-read-file-assert-encoding.js index 897bcd3bc98795..ac0f45f98b30d4 100644 --- a/test/parallel/test-fs-read-file-assert-encoding.js +++ b/test/parallel/test-fs-read-file-assert-encoding.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const fs = require('fs'); @@ -8,6 +8,6 @@ const encoding = 'foo-8'; const filename = 'bar.txt'; assert.throws( - fs.readFile.bind(fs, filename, { encoding }, () => {}), - new RegExp(`Error: Unknown encoding: ${encoding}$`) + fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()), + new RegExp(`^Error: Unknown encoding: ${encoding}$`) );