dylanb / gulp-coverage

Gulp coverage reporting for Node.js that is independent of the test runner
MIT License
60 stars 12 forks source link

build fails because debugDirectory cannot be created #31

Closed kollhof closed 9 years ago

kollhof commented 9 years ago

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:

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);
        }
    }
}
dylanb commented 9 years ago

@kollhof Can you test the latest commit and see whether that works for you?

kollhof commented 9 years ago

that works, thanks for the quick turnaround, and thanks for the plugin!

dylanb commented 9 years ago

my pleasure. If you like the plugin, please star it :-)