|
4 | 4 | fixturesDir = path.join(__dirname, 'fixtures'), |
5 | 5 | tdir = path.join(fixturesDir, 'testdir'), |
6 | 6 | tdir2 = path.join(fixturesDir, 'testdir2'), |
7 | | - tdir3 = path.join(fixturesDir, 'testdir3'); |
| 7 | + tdir3 = path.join(fixturesDir, 'testdir3'), |
| 8 | + tdir4 = path.join(fixturesDir, 'testdir4'); |
8 | 9 |
|
9 | 10 | describe('readfiles method', function() { |
10 | 11 |
|
@@ -1139,6 +1140,36 @@ describe("files method", function() { |
1139 | 1140 | }); |
1140 | 1141 | }); |
1141 | 1142 |
|
| 1143 | + it("should return broken symlinks as files", function(done) { |
| 1144 | + dir.files(tdir3, function(err, files) { |
| 1145 | + should.not.exist(err); |
| 1146 | + var relFiles = files.map(function(curPath) { |
| 1147 | + return path.relative(fixturesDir, curPath); |
| 1148 | + }); |
| 1149 | + relFiles.sort().should.eql([ |
| 1150 | + 'testdir3/broken_link.txt', |
| 1151 | + 'testdir3/file1.txt' |
| 1152 | + ]); |
| 1153 | + done(); |
| 1154 | + }); |
| 1155 | + }); |
| 1156 | + |
| 1157 | + it("should iterate files of symlinked directories (recursively)", function(done) { |
| 1158 | + dir.files(tdir4, function(err, files) { |
| 1159 | + should.not.exist(err); |
| 1160 | + var relFiles = files.map(function(curPath) { |
| 1161 | + return path.relative(fixturesDir, curPath); |
| 1162 | + }); |
| 1163 | + relFiles.sort().should.eql([ |
| 1164 | + 'testdir4/testdir/file1.txt', |
| 1165 | + 'testdir4/testdir/file2.text', |
| 1166 | + 'testdir4/testdir/subdir/file3.txt', |
| 1167 | + 'testdir4/testdir/subdir/file4.text' |
| 1168 | + ]); |
| 1169 | + done(); |
| 1170 | + }); |
| 1171 | + }); |
| 1172 | + |
1142 | 1173 | }); |
1143 | 1174 |
|
1144 | 1175 |
|
|
0 commit comments