mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
b61cab2234
* 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>
79 lines
1.7 KiB
JavaScript
79 lines
1.7 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
const options = 'test';
|
|
const expectedError = common.expectsError({
|
|
code: 'ERR_INVALID_OPT_VALUE_ENCODING',
|
|
type: TypeError,
|
|
}, 17);
|
|
|
|
assert.throws(() => {
|
|
fs.readFile('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.readFileSync('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.readdir('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.readdirSync('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.readlink('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.readlinkSync('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.writeFile('path', 'data', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.writeFileSync('path', 'data', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.appendFile('path', 'data', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.appendFileSync('path', 'data', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.watch('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.realpath('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.realpathSync('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.mkdtemp('path', options, common.mustNotCall());
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.mkdtempSync('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.ReadStream('path', options);
|
|
}, expectedError);
|
|
|
|
assert.throws(() => {
|
|
fs.WriteStream('path', options);
|
|
}, expectedError);
|