@@ -5,7 +5,7 @@ const assert = require('node:assert');
55const fs = require ( 'node:fs' ) ;
66const path = require ( 'node:path' ) ;
77
8- // This test ensures that fs.rmSync handles UTF-8 characters in file paths,
8+ // This test ensures that fs.rmSync handles non-ASCII characters in file paths,
99// and that errors contain correctly encoded paths and err.path values.
1010
1111tmpdir . refresh ( ) ; // Prepare a clean temporary directory
@@ -24,13 +24,13 @@ fs.rmSync(filePath);
2424// Ensure the file has been removed
2525assert . strictEqual ( fs . existsSync ( filePath ) , false ) ;
2626
27- // // Ensure rmSync throws an error when trying to remove a directory without recursive
27+ // Ensure rmSync throws an error when trying to remove a directory without recursive
2828assert . throws ( ( ) => {
2929 fs . rmSync ( dirPath , { recursive : false } ) ;
3030} , ( err ) => {
31- // Assert the error message includes the correct non-ASCII path
31+ // Assert the error code and check that the error message includes the correct non-ASCII path
3232 assert . strictEqual ( err . code , 'ERR_FS_EISDIR' ) ;
3333 assert ( err . message . includes ( dirPath ) , 'Error message should include the directory path' ) ;
34- assert . strictEqual ( err . path , dirPath , 'err.path should match the non-ASCII directory path' ) ;
35- return true ; // Indicate the validation function passed
34+ assert . strictEqual ( err . path , dirPath ) ;
35+ return true ;
3636} ) ;
0 commit comments