Skip to content

Commit 2f4b6bd

Browse files
vinimdocarmoMylesBorins
authored andcommitted
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: #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>
1 parent 850f85d commit 2f4b6bd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
require('../common');
3+
4+
const assert = require('assert');
5+
const fs = require('fs');
6+
7+
const encoding = 'foo-8';
8+
const filename = 'bar.txt';
9+
10+
assert.throws(
11+
fs.readFile.bind(fs, filename, { encoding }, () => {}),
12+
new RegExp(`Error: Unknown encoding: ${encoding}$`)
13+
);

0 commit comments

Comments
 (0)