Skip to content
Browse files

Fix Error while generating HTML report, issue #40

When istanbul module is commited in a SVN repository, generating a HTML report produce the error :

Fatal error: EISDIR, illegal operation on a directory

This is due to the presence of the .svn directory
  • Loading branch information...
1 parent c2ed15b commit 3ab0ca83e6438576ade5a56c74295290b9f58830 @ymainier ymainier committed Mar 27, 2013
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/report/html.js
View
12 lib/report/html.js
@@ -497,10 +497,16 @@ Report.mix(HtmlReport, {
});
tree = summarizer.getTreeSummary();
fs.readdirSync(path.resolve(__dirname, '..', 'vendor')).forEach(function (f) {
- if (opts.verbose) {
- console.log('Write asset: ' + path.resolve(dir, f));
+ var resolvedSource = path.resolve(__dirname, '..', 'vendor', f),
+ resolvedDestination = path.resolve(dir, f),
+ stat = fs.statSync(resolvedSource);
+
+ if (stat.isFile()) {
+ if (opts.verbose) {
+ console.log('Write asset: ' + resolvedDestination);
+ }
+ writer.copyFile(resolvedSource, resolvedDestination);
}
- writer.copyFile(path.resolve(__dirname, '..', 'vendor', f), path.resolve(dir, f));
});
//console.log(JSON.stringify(tree.root, undefined, 4));
this.writeFiles(writer, tree.root, dir, collector);

0 comments on commit 3ab0ca8

Please sign in to comment.
Something went wrong with that request. Please try again.