Skip to content

Commit

Permalink
test: expand test coverage of fs.js
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
  • Loading branch information
vinimdocarmo authored and evanlucas committed Jan 31, 2017
1 parent 4aedde8 commit cfd1b19
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-fs-read-file-assert-encoding.js
Original file line number Diff line number Diff line change
@@ -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}$`)
);

0 comments on commit cfd1b19

Please sign in to comment.