mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 10:01:19 +00:00

* Assign codes to errors reported by internal/fs.js PR-URL: https://github.com/nodejs/node/pull/11317 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
18 lines
381 B
JavaScript
18 lines
381 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
const encoding = 'foo-8';
|
|
const filename = 'bar.txt';
|
|
const expectedError = common.expectsError({
|
|
code: 'ERR_INVALID_OPT_VALUE_ENCODING',
|
|
type: TypeError,
|
|
});
|
|
|
|
assert.throws(
|
|
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
|
|
expectedError
|
|
);
|