fileception

Mock FS module

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
fileception
0.3.27 years ago8 years agoMinified + gzip package size for fileception in KB

Readme

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.