File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ File.prototype.clone = function(opt) {
128
128
contents : contents ,
129
129
} ) ;
130
130
131
+ if ( this . isSymbolic ( ) ) {
132
+ file . symlink = this . symlink ;
133
+ }
134
+
131
135
// Clone our custom properties
132
136
Object . keys ( this ) . forEach ( function ( key ) {
133
137
if ( self . constructor . isCustomProp ( key ) ) {
Original file line number Diff line number Diff line change @@ -419,6 +419,12 @@ describe('File', function() {
419
419
420
420
describe ( 'clone()' , function ( ) {
421
421
422
+ var fakeStat = {
423
+ isSymbolicLink : function ( ) {
424
+ return true ;
425
+ } ,
426
+ } ;
427
+
422
428
it ( 'copies all attributes over with Buffer contents' , function ( done ) {
423
429
var options = {
424
430
cwd : '/' ,
@@ -577,6 +583,24 @@ describe('File', function() {
577
583
] , done ) ;
578
584
} ) ;
579
585
586
+ it ( 'fixes file.symlink if file is a symbolic link' , function ( done ) {
587
+ var val = '/test/test.js' ;
588
+ var options = {
589
+ cwd : '/' ,
590
+ base : '/test/' ,
591
+ path : '/test/test.coffee' ,
592
+ content : null ,
593
+ stat : fakeStat ,
594
+ symlink : val ,
595
+ } ;
596
+ var file = new File ( options ) ;
597
+ var file2 = file . clone ( ) ;
598
+
599
+ expect ( file2 ) . toNotBe ( file ) ;
600
+ expect ( file2 . symlink ) . toEqual ( file . symlink ) ;
601
+ done ( ) ;
602
+ } ) ;
603
+
580
604
it ( 'copies all attributes over with null contents' , function ( done ) {
581
605
var options = {
582
606
cwd : '/' ,
You can’t perform that action at this time.
0 commit comments