mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 03:12:57 +00:00

* 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>
14 lines
283 B
JavaScript
14 lines
283 B
JavaScript
'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}$`)
|
|
);
|