1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const fs = require('fs'); 5 6const options = 'test'; 7const expectedError = { 8 code: 'ERR_INVALID_OPT_VALUE_ENCODING', 9 name: 'TypeError', 10}; 11 12assert.throws(() => { 13 fs.readFile('path', options, common.mustNotCall()); 14}, expectedError); 15 16assert.throws(() => { 17 fs.readFileSync('path', options); 18}, expectedError); 19 20assert.throws(() => { 21 fs.readdir('path', options, common.mustNotCall()); 22}, expectedError); 23 24assert.throws(() => { 25 fs.readdirSync('path', options); 26}, expectedError); 27 28assert.throws(() => { 29 fs.readlink('path', options, common.mustNotCall()); 30}, expectedError); 31 32assert.throws(() => { 33 fs.readlinkSync('path', options); 34}, expectedError); 35 36assert.throws(() => { 37 fs.writeFile('path', 'data', options, common.mustNotCall()); 38}, expectedError); 39 40assert.throws(() => { 41 fs.writeFileSync('path', 'data', options); 42}, expectedError); 43 44assert.throws(() => { 45 fs.appendFile('path', 'data', options, common.mustNotCall()); 46}, expectedError); 47 48assert.throws(() => { 49 fs.appendFileSync('path', 'data', options); 50}, expectedError); 51 52assert.throws(() => { 53 fs.watch('path', options, common.mustNotCall()); 54}, expectedError); 55 56assert.throws(() => { 57 fs.realpath('path', options, common.mustNotCall()); 58}, expectedError); 59 60assert.throws(() => { 61 fs.realpathSync('path', options); 62}, expectedError); 63 64assert.throws(() => { 65 fs.mkdtemp('path', options, common.mustNotCall()); 66}, expectedError); 67 68assert.throws(() => { 69 fs.mkdtempSync('path', options); 70}, expectedError); 71 72assert.throws(() => { 73 fs.ReadStream('path', options); 74}, expectedError); 75 76assert.throws(() => { 77 fs.WriteStream('path', options); 78}, expectedError); 79