File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
module . exports = function ( grunt ) {
12
12
13
+ var fs = require ( 'fs' ) ;
14
+
13
15
// Project configuration.
14
16
grunt . initConfig ( {
15
17
jshint : {
@@ -30,7 +32,8 @@ module.exports = function(grunt) {
30
32
src : [ 'tmp/sample_long' ]
31
33
} ,
32
34
exclude : [ 'tmp/end_01/**/*' , '!tmp/end_01/1.txt' ] ,
33
- excludeSub : [ 'tmp/end_02/**/*.*' , '!tmp/end_02/2/**/*' ]
35
+ excludeSub : [ 'tmp/end_02/**/*.*' , '!tmp/end_02/2/**/*' ] ,
36
+ symlink : [ 'tmp/symlink' ]
34
37
} ,
35
38
36
39
// Unit tests.
@@ -52,6 +55,8 @@ module.exports = function(grunt) {
52
55
grunt . file . copy ( 'test/fixtures/sample_long/long.txt' , 'tmp/sample_long/long.txt' ) ;
53
56
grunt . file . copy ( 'test/fixtures/sample_short/short.txt' , 'tmp/sample_short/short.txt' ) ;
54
57
58
+ fs . symlinkSync ( 'tmp/broken-symlink' , 'tmp/symlink' , 'dir' ) ;
59
+
55
60
var cwd = 'test/fixtures/start' ;
56
61
grunt . file . expand ( {
57
62
cwd : cwd
Original file line number Diff line number Diff line change 9
9
'use strict' ;
10
10
11
11
var async = require ( 'async' ) ;
12
+ var fs = require ( "fs" ) ;
12
13
var rimraf = require ( 'rimraf' ) ;
13
14
14
15
module . exports = function ( grunt ) {
15
16
16
17
function clean ( filepath , options , done ) {
18
+
17
19
if ( ! grunt . file . exists ( filepath ) ) {
20
+ try {
21
+ fs . unlinkSync ( filepath ) ;
22
+ } catch ( err ) { }
18
23
return done ( ) ;
19
24
}
20
25
Original file line number Diff line number Diff line change @@ -29,5 +29,10 @@ exports.clean = {
29
29
var res = dircompare . compareSync ( 'test/expected/end_02' , 'tmp/end_02' ) ;
30
30
test . equal ( true , res . same , 'should match exclusions for sub' ) ;
31
31
test . done ( ) ;
32
+ } ,
33
+ symlink : function ( test ) {
34
+ var res = grunt . file . exists ( 'tmp/symlink' ) ;
35
+ test . equal ( false , res , 'should delete broken symlink' ) ;
36
+ test . done ( ) ;
32
37
}
33
38
} ;
You can’t perform that action at this time.
0 commit comments