@@ -4,72 +4,75 @@ const assert = require('assert');
44const fs = require ( 'fs' ) ;
55
66const options = 'test' ;
7- const unknownEncodingMessage = / ^ E r r o r : U n k n o w n e n c o d i n g : t e s t $ / ;
7+ const expectedError = common . expectsError ( {
8+ code : 'ERR_INVALID_OPT_VALUE_ENCODING' ,
9+ type : TypeError ,
10+ } , 17 ) ;
811
912assert . throws ( ( ) => {
1013 fs . readFile ( 'path' , options , common . mustNotCall ( ) ) ;
11- } , unknownEncodingMessage ) ;
14+ } , expectedError ) ;
1215
1316assert . throws ( ( ) => {
1417 fs . readFileSync ( 'path' , options ) ;
15- } , unknownEncodingMessage ) ;
18+ } , expectedError ) ;
1619
1720assert . throws ( ( ) => {
1821 fs . readdir ( 'path' , options , common . mustNotCall ( ) ) ;
19- } , unknownEncodingMessage ) ;
22+ } , expectedError ) ;
2023
2124assert . throws ( ( ) => {
2225 fs . readdirSync ( 'path' , options ) ;
23- } , unknownEncodingMessage ) ;
26+ } , expectedError ) ;
2427
2528assert . throws ( ( ) => {
2629 fs . readlink ( 'path' , options , common . mustNotCall ( ) ) ;
27- } , unknownEncodingMessage ) ;
30+ } , expectedError ) ;
2831
2932assert . throws ( ( ) => {
3033 fs . readlinkSync ( 'path' , options ) ;
31- } , unknownEncodingMessage ) ;
34+ } , expectedError ) ;
3235
3336assert . throws ( ( ) => {
3437 fs . writeFile ( 'path' , 'data' , options , common . mustNotCall ( ) ) ;
35- } , unknownEncodingMessage ) ;
38+ } , expectedError ) ;
3639
3740assert . throws ( ( ) => {
3841 fs . writeFileSync ( 'path' , 'data' , options ) ;
39- } , unknownEncodingMessage ) ;
42+ } , expectedError ) ;
4043
4144assert . throws ( ( ) => {
4245 fs . appendFile ( 'path' , 'data' , options , common . mustNotCall ( ) ) ;
43- } , unknownEncodingMessage ) ;
46+ } , expectedError ) ;
4447
4548assert . throws ( ( ) => {
4649 fs . appendFileSync ( 'path' , 'data' , options ) ;
47- } , unknownEncodingMessage ) ;
50+ } , expectedError ) ;
4851
4952assert . throws ( ( ) => {
5053 fs . watch ( 'path' , options , common . mustNotCall ( ) ) ;
51- } , unknownEncodingMessage ) ;
54+ } , expectedError ) ;
5255
5356assert . throws ( ( ) => {
5457 fs . realpath ( 'path' , options , common . mustNotCall ( ) ) ;
55- } , unknownEncodingMessage ) ;
58+ } , expectedError ) ;
5659
5760assert . throws ( ( ) => {
5861 fs . realpathSync ( 'path' , options ) ;
59- } , unknownEncodingMessage ) ;
62+ } , expectedError ) ;
6063
6164assert . throws ( ( ) => {
6265 fs . mkdtemp ( 'path' , options , common . mustNotCall ( ) ) ;
63- } , unknownEncodingMessage ) ;
66+ } , expectedError ) ;
6467
6568assert . throws ( ( ) => {
6669 fs . mkdtempSync ( 'path' , options ) ;
67- } , unknownEncodingMessage ) ;
70+ } , expectedError ) ;
6871
6972assert . throws ( ( ) => {
7073 fs . ReadStream ( 'path' , options ) ;
71- } , unknownEncodingMessage ) ;
74+ } , expectedError ) ;
7275
7376assert . throws ( ( ) => {
7477 fs . WriteStream ( 'path' , options ) ;
75- } , unknownEncodingMessage ) ;
78+ } , expectedError ) ;
0 commit comments