mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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 <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
1 parent
3bdf7bf9e9
commit
2f19dcddaa
1 file changed
+3
-3
@@ -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}$`)
|
||||
);
|
||||
Reference in new issue
Block a user