Skip to content

Commit

Permalink
Merge pull request #229 from edrex/read_symbolic_link_dir_test
Browse files Browse the repository at this point in the history
erroring test reading symbolic link to dir
  • Loading branch information
Ajedi32 committed Aug 22, 2016
2 parents 6b4db3e + 2776570 commit 2d91dd2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Expand Up @@ -213,7 +213,7 @@ Ignore files/paths from being loaded into Metalsmith.
Strings use the glob syntax from
[minimatch](https://github.com/isaacs/minimatch) to match files and directories
to ignore. Functions are called with the full path to the file as their first
argument, and the `lstat` object returned by Node's `fs.lstat` function as their
argument, and the `stat` object returned by Node's `fs.stat` function as their
second argument, and must return either `true` to ignore the file, or `false` to
keep it.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -23,7 +23,7 @@
"has-generators": "^1.0.1",
"is": "^2.2.0",
"is-utf8": "~0.2.0",
"recursive-readdir": "^1.3.0",
"recursive-readdir": "^2.0.0",
"rimraf": "^2.2.8",
"stat-mode": "^0.2.0",
"thunkify": "^2.1.2",
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/read-symbolic-link/dir/index.md
@@ -0,0 +1,4 @@
---
title: A Title
---
body
1 change: 1 addition & 0 deletions test/fixtures/read-symbolic-link/src/dir
17 changes: 17 additions & 0 deletions test/index.js
Expand Up @@ -246,6 +246,23 @@ describe('Metalsmith', function(){
});
});

it('should traverse a symbolic link to a directory', function(done){
var m = Metalsmith(fixture('read-symbolic-link'));
var stats = fs.statSync(fixture('read-symbolic-link/src/dir/index.md'));
m.read(function(err, files){
if (err) return done(err);
assert.deepEqual(files, {
'dir/index.md': {
title: 'A Title',
contents: new Buffer('body'),
mode: stats.mode.toString(8).slice(-4),
stats: stats
}
});
done();
});
});

it('should read from a provided directory', function(done){
var m = Metalsmith(fixture('read-dir'));
var stats = fs.statSync(fixture('read-dir/dir/index.md'));
Expand Down

0 comments on commit 2d91dd2

Please sign in to comment.