__mocks__/fs.js
function writePath(parentDir, path, data) {
    let files = path.split('/');
    let file = files.shift();

    // init file
    if(!parentDir[file]) parentDir[file] = {
        content: undefined,
        tree: {}
    };

    if(files.length > 0) {
        writePath(parentDir[file].tree, files.join('/'), data);
    } else if(data) {
        parentDir[file].content = data.toString();
    }
}
function writePath(parentDir, path, data) {
    let files = path.split('/');
    let file = files.shift();

    // init file
    if(!parentDir[file]) parentDir[file] = {
        content: undefined,
        tree: {}
    };

    if(files.length > 0) {
        writePath(parentDir[file].tree, files.join('/'), data);
    } else if(data) {
        parentDir[file].content = data.toString();
    }
}
function writePath ( parentDir , path , data ) { let files = path . split ( '/' ) ; let file = files . shift ( ) ; // init file if ( ! parentDir [ file ] ) parentDir [ file ] = { content : undefined , tree : { } } ; if ( files . length > 0 ) { writePath ( parentDir [ file ] . tree , files . join ( '/' ) , data ) ; } else if ( data ) { parentDir [ file ] . content = data . toString ( ) ; } }
Recursively creates a file
@param parentDir
@param path
@param data
Recursively creates a file