Skip to content

Commit 7ea6b85

Browse files
committedOct 31, 2017
fix docx test
- docx includes timestamp, so we cannot check assert-dir-equal - assume that everything is OK if test does not throw/error - add opts.encoding: 'binary' for pdf and docx output
1 parent 240d6f6 commit 7ea6b85

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
 

‎index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ function plugin(options){
3434
var from = options.from || 'markdown';
3535
var to = options.to || 'html5';
3636
var args = options.args || [];
37-
var opts = options.opts || [];
37+
var opts = options.opts || {};
3838
var pattern = options.pattern || '**/*.md';
3939
var extension = options.ext || '.html';
4040

41+
if (to === 'docx' || to === 'pdf') {
42+
opts.encoding = 'binary'
43+
}
44+
4145
return function(files, metalsmith, done){
4246
selectedFiles = match(Object.keys(files), pattern)
4347
async.eachLimit(selectedFiles, 100, function(file, cb){

‎test/expected-docx/simple.docx

9.5 KB
Binary file not shown.

‎test/test.js

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ describe('metalsmith-pandoc', function(){
3939
.destination('build-docx')
4040
.build(function(err){
4141
if (err) return done(err);
42-
equal('test/build-docx', 'test/expected-docx');
4342
done();
4443
});
4544
});

0 commit comments

Comments
 (0)
Please sign in to comment.