@@ -59,8 +59,8 @@ assert.strictEqual(path.posix.basename('foo'), 'foo');
5959
6060// POSIX filenames may include control characters
6161// c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
62- const controlCharFilename = ' Icon' + String . fromCharCode ( 13 ) ;
63- assert . strictEqual ( path . posix . basename ( ' /a/b/' + controlCharFilename ) ,
62+ const controlCharFilename = ` Icon${ String . fromCharCode ( 13 ) } ` ;
63+ assert . strictEqual ( path . posix . basename ( ` /a/b/${ controlCharFilename } ` ) ,
6464 controlCharFilename ) ;
6565
6666
@@ -160,8 +160,8 @@ assert.strictEqual(path.win32.dirname('foo'), '.');
160160 [ 'file//' , '' ] ,
161161 [ 'file./' , '.' ] ,
162162 [ 'file.//' , '.' ] ,
163- ] . forEach ( function ( test ) {
164- [ path . posix . extname , path . win32 . extname ] . forEach ( function ( extname ) {
163+ ] . forEach ( ( test ) => {
164+ [ path . posix . extname , path . win32 . extname ] . forEach ( ( extname ) => {
165165 let input = test [ 0 ] ;
166166 let os ;
167167 if ( extname === path . win32 . extname ) {
@@ -208,6 +208,7 @@ const joinTests = [
208208 [ [ path . posix . join , path . win32 . join ] ,
209209 // arguments result
210210 [ [ [ '.' , 'x/b' , '..' , '/b/c.js' ] , 'x/b/c.js' ] ,
211+ [ [ ] , '.' ] ,
211212 [ [ '/.' , 'x/b' , '..' , '/b/c.js' ] , '/x/b/c.js' ] ,
212213 [ [ '/foo' , '../../../bar' ] , '/bar' ] ,
213214 [ [ 'foo' , '../../../bar' ] , '../../bar' ] ,
@@ -310,11 +311,11 @@ joinTests.push([
310311 ]
311312 )
312313] ) ;
313- joinTests . forEach ( function ( test ) {
314+ joinTests . forEach ( ( test ) => {
314315 if ( ! Array . isArray ( test [ 0 ] ) )
315316 test [ 0 ] = [ test [ 0 ] ] ;
316- test [ 0 ] . forEach ( function ( join ) {
317- test [ 1 ] . forEach ( function ( test ) {
317+ test [ 0 ] . forEach ( ( join ) => {
318+ test [ 1 ] . forEach ( ( test ) => {
318319 const actual = join . apply ( null , test [ 0 ] ) ;
319320 const expected = test [ 1 ] ;
320321 // For non-Windows specific tests with the Windows join(), we need to try
@@ -333,7 +334,7 @@ joinTests.forEach(function(test) {
333334 '\n expect=' + JSON . stringify ( expected ) +
334335 '\n actual=' + JSON . stringify ( actual ) ;
335336 if ( actual !== expected && actualAlt !== expected )
336- failures . push ( '\n' + message ) ;
337+ failures . push ( `\n ${ message } ` ) ;
337338 } ) ;
338339 } ) ;
339340} ) ;
@@ -344,15 +345,15 @@ assert.strictEqual(failures.length, 0, failures.join(''));
344345const typeErrorTests = [ true , false , 7 , null , { } , undefined , [ ] , NaN ] ;
345346
346347function fail ( fn ) {
347- const args = Array . prototype . slice . call ( arguments , 1 ) ;
348+ const args = Array . from ( arguments ) . slice ( 1 ) ;
348349
349- assert . throws ( function ( ) {
350+ assert . throws ( ( ) => {
350351 fn . apply ( null , args ) ;
351352 } , TypeError ) ;
352353}
353354
354- typeErrorTests . forEach ( function ( test ) {
355- [ path . posix , path . win32 ] . forEach ( function ( namespace ) {
355+ typeErrorTests . forEach ( ( test ) => {
356+ [ path . posix , path . win32 ] . forEach ( ( namespace ) => {
356357 fail ( namespace . join , test ) ;
357358 fail ( namespace . resolve , test ) ;
358359 fail ( namespace . normalize , test ) ;
@@ -396,7 +397,7 @@ assert.strictEqual(path.posix.normalize('///..//./foo/.//bar'), '/foo/bar');
396397// path.resolve tests
397398const resolveTests = [
398399 [ path . win32 . resolve ,
399- // arguments result
400+ // arguments result
400401 [ [ [ 'c:/blah\\blah' , 'd:/games' , 'c:../a' ] , 'c:\\blah\\a' ] ,
401402 [ [ 'c:/ignore' , 'd:\\a/b\\c/d' , '\\e.exe' ] , 'd:\\e.exe' ] ,
402403 [ [ 'c:/ignore' , 'c:/some/file' ] , 'c:\\some\\file' ] ,
@@ -413,7 +414,7 @@ const resolveTests = [
413414 ]
414415 ] ,
415416 [ path . posix . resolve ,
416- // arguments result
417+ // arguments result
417418 [ [ [ '/var/lib' , '../' , 'file/' ] , '/var/file' ] ,
418419 [ [ '/var/lib' , '/../' , 'file/' ] , '/file' ] ,
419420 [ [ 'a/b/c/' , '../../..' ] , process . cwd ( ) ] ,
@@ -423,9 +424,9 @@ const resolveTests = [
423424 ]
424425 ]
425426] ;
426- resolveTests . forEach ( function ( test ) {
427+ resolveTests . forEach ( ( test ) => {
427428 const resolve = test [ 0 ] ;
428- test [ 1 ] . forEach ( function ( test ) {
429+ test [ 1 ] . forEach ( ( test ) => {
429430 const actual = resolve . apply ( null , test [ 0 ] ) ;
430431 let actualAlt ;
431432 const os = resolve === path . win32 . resolve ? 'win32' : 'posix' ;
@@ -514,7 +515,7 @@ const relativeTests = [
514515 ]
515516 ] ,
516517 [ path . posix . relative ,
517- // arguments result
518+ // arguments result
518519 [ [ '/var/lib' , '/var' , '..' ] ,
519520 [ '/var/lib' , '/bin' , '../../bin' ] ,
520521 [ '/var/lib' , '/var/lib' , '' ] ,
@@ -530,9 +531,9 @@ const relativeTests = [
530531 ]
531532 ]
532533] ;
533- relativeTests . forEach ( function ( test ) {
534+ relativeTests . forEach ( ( test ) => {
534535 const relative = test [ 0 ] ;
535- test [ 1 ] . forEach ( function ( test ) {
536+ test [ 1 ] . forEach ( ( test ) => {
536537 const actual = relative ( test [ 0 ] , test [ 1 ] ) ;
537538 const expected = test [ 2 ] ;
538539 const os = relative === path . win32 . relative ? 'win32' : 'posix' ;
@@ -543,7 +544,7 @@ relativeTests.forEach(function(test) {
543544 '\n expect=' + JSON . stringify ( expected ) +
544545 '\n actual=' + JSON . stringify ( actual ) ;
545546 if ( actual !== expected )
546- failures . push ( '\n' + message ) ;
547+ failures . push ( `\n ${ message } ` ) ;
547548 } ) ;
548549} ) ;
549550assert . strictEqual ( failures . length , 0 , failures . join ( '' ) ) ;
@@ -575,14 +576,14 @@ if (common.isWindows) {
575576 // These tests cause resolve() to insert the cwd, so we cannot test them from
576577 // non-Windows platforms (easily)
577578 assert . strictEqual ( path . win32 . _makeLong ( 'foo\\bar' ) . toLowerCase ( ) ,
578- ' \\\\?\\' + process . cwd ( ) . toLowerCase ( ) + ' \\foo\\bar' ) ;
579+ ` \\\\?\\${ process . cwd ( ) . toLowerCase ( ) } \\foo\\bar` ) ;
579580 assert . strictEqual ( path . win32 . _makeLong ( 'foo/bar' ) . toLowerCase ( ) ,
580- ' \\\\?\\' + process . cwd ( ) . toLowerCase ( ) + ' \\foo\\bar' ) ;
581+ ` \\\\?\\${ process . cwd ( ) . toLowerCase ( ) } \\foo\\bar` ) ;
581582 const currentDeviceLetter = path . parse ( process . cwd ( ) ) . root . substring ( 0 , 2 ) ;
582583 assert . strictEqual ( path . win32 . _makeLong ( currentDeviceLetter ) . toLowerCase ( ) ,
583- ' \\\\?\\' + process . cwd ( ) . toLowerCase ( ) ) ;
584+ ` \\\\?\\${ process . cwd ( ) . toLowerCase ( ) } ` ) ;
584585 assert . strictEqual ( path . win32 . _makeLong ( 'C' ) . toLowerCase ( ) ,
585- ' \\\\?\\' + process . cwd ( ) . toLowerCase ( ) + ' \\c' ) ;
586+ ` \\\\?\\${ process . cwd ( ) . toLowerCase ( ) } \\c` ) ;
586587}
587588assert . strictEqual ( path . win32 . _makeLong ( 'C:\\foo' ) , '\\\\?\\C:\\foo' ) ;
588589assert . strictEqual ( path . win32 . _makeLong ( 'C:/foo' ) , '\\\\?\\C:\\foo' ) ;
0 commit comments