Skip to content

papandreou/fileception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fileception

Mock out the FS module during a test, experimentally extracted from unexpected-fs:

var fileception = require('fileception');
var assert = require('assert');
var fs = require('fs');

it('should read the contents of a file', function () {
    fileception({
        '/foo': {
            'bar.txt': 'quux'
        }
    });

    assert.equal(fs.readFileSync('/foo/bar.txt', 'utf-8'), 'quux');
});

When the test is done, the fs module will automatically be restored.