test: expand test coverage of fs.js
* test reading a file passing a not valid enconding Refs: https://coverage.nodejs.org/coverage-067be658f966dafe/root/internal/fs.js.html PR-URL: https://github.com/nodejs/node/pull/10947 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
parent
bee83e0bbc
commit
b19334e566
13
test/parallel/test-fs-read-file-assert-encoding.js
Normal file
13
test/parallel/test-fs-read-file-assert-encoding.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
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}$`)
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user