Skip to content

Commit 2f19dcd

Browse files
TrottMylesBorins
authored andcommitted
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: #13501 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 3bdf7bf commit 2f19dcd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
2-
require('../common');
32

3+
const common = require('../common');
44
const assert = require('assert');
55
const fs = require('fs');
66

77
const encoding = 'foo-8';
88
const filename = 'bar.txt';
99

1010
assert.throws(
11-
fs.readFile.bind(fs, filename, { encoding }, () => {}),
12-
new RegExp(`Error: Unknown encoding: ${encoding}$`)
11+
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
12+
new RegExp(`^Error: Unknown encoding: ${encoding}$`)
1313
);

0 commit comments

Comments
 (0)