0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-fs-read-file-assert-encoding.js
Ruben Bridgewater 095357e26e
lib: tweak use of internal/errors
In addition refactor common.throws to common.expectsError

PR-URL: https://github.com/nodejs/node/pull/13829
Refs: https://github.com/nodejs/node/issues/11273
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-07-22 18:18:04 -04:00

12 lines
289 B
JavaScript

'use strict';
const common = require('../common');
const fs = require('fs');
const encoding = 'foo-8';
const filename = 'bar.txt';
common.expectsError(
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
{ code: 'ERR_INVALID_OPT_VALUE_ENCODING', type: TypeError }
);