Skip to content

Commit

Permalink
test: refactor test-fs-read-*
Browse files Browse the repository at this point in the history
* 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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Trott authored and MylesBorins committed Aug 16, 2017
1 parent 3bdf7bf commit 2f19dcd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-fs-read-file-assert-encoding.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict';
require('../common');

const common = require('../common');
const assert = require('assert');
const fs = require('fs');

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}$`)
);

0 comments on commit 2f19dcd

Please sign in to comment.