The code which creates the debugDirectory only checks if the directory does not exist, it does not check or create any parent directories and thus fails.
Steps to reproduce the issue:
set cover.instrument options: debugDirectory : "foo/bar/spam"
run gulp
The problem is near the fs.mkdirSync() calls in contrib/covers.js.
A simple solution would be to use a function which ensures all parent directories are created:
e.g.
function mkdirs(path){
var dirs = path.split('/');
for(var i=1,l=dirs.length; i<=l; i++){
path = dirs.slice(0, i).join('/');
if (! fs.existsSync(path) ) {
fs.mkdirSync(path);
}
}
}
The code which creates the debugDirectory only checks if the directory does not exist, it does not check or create any parent directories and thus fails.
Steps to reproduce the issue:
cover.instrument
options:debugDirectory : "foo/bar/spam"
The problem is near the
fs.mkdirSync()
calls incontrib/covers.js
. A simple solution would be to use a function which ensures all parent directories are created:e.g.