lib/sinon-doublist-fs/index.js
function sinonDoublistFs(test) {
  if (module.exports.trace) {
    nodeConsole = require('long-con').create();
    log = nodeConsole
      .set('nlFirst', true)
      .set('time', false)
      .set('traceDepth', true)
      .create(null, console.log); // eslint-disable-line no-console
    nodeConsole.traceMethods('FileStub', FileStub, log, null, /^prototype$/);
    nodeConsole.traceMethods('FileStub', FileStub.prototype, log, null, /^(get|set)$/);
    nodeConsole.traceMethods('wrapFs', wrapFs, log);
    nodeConsole.traceMethods('mixin', mixin, log);
  } else {
    log = function noOpLogger() {};
  }

  if (is.string(test)) { globalInjector[test](); return; } // Ex. 'mocha'
  if (is.fn(realFs.exists)) { return; } // Already doubled

  // Mix in stubFile(), stubTree(), etc.
  Object.keys(mixin).forEach(function forEachMixinMethod(method) { test[method] = mixin[method].bind(test); });

  // Replace a selection of `fs`
  Object.keys(wrapFs).forEach(function forEachWrapFsMethod(method) {
    realFs[method] = fs[method];
    fs[method] = wrapFs[method];
  });

  fileStubMap = {};
  context = test;
}
function sinonDoublistFs(test) {
  if (module.exports.trace) {
    nodeConsole = require('long-con').create();
    log = nodeConsole
      .set('nlFirst', true)
      .set('time', false)
      .set('traceDepth', true)
      .create(null, console.log); // eslint-disable-line no-console
    nodeConsole.traceMethods('FileStub', FileStub, log, null, /^prototype$/);
    nodeConsole.traceMethods('FileStub', FileStub.prototype, log, null, /^(get|set)$/);
    nodeConsole.traceMethods('wrapFs', wrapFs, log);
    nodeConsole.traceMethods('mixin', mixin, log);
  } else {
    log = function noOpLogger() {};
  }

  if (is.string(test)) { globalInjector[test](); return; } // Ex. 'mocha'
  if (is.fn(realFs.exists)) { return; } // Already doubled

  // Mix in stubFile(), stubTree(), etc.
  Object.keys(mixin).forEach(function forEachMixinMethod(method) { test[method] = mixin[method].bind(test); });

  // Replace a selection of `fs`
  Object.keys(wrapFs).forEach(function forEachWrapFsMethod(method) {
    realFs[method] = fs[method];
    fs[method] = wrapFs[method];
  });

  fileStubMap = {};
  context = test;
}
function sinonDoublistFs ( test ) { if ( module . exports . trace ) { nodeConsole = require ( 'long-con' ) . create ( ) ; log = nodeConsole . set ( 'nlFirst' , true ) . set ( 'time' , false ) . set ( 'traceDepth' , true ) . create ( null , console . log ) ; // eslint-disable-line no-console nodeConsole . traceMethods ( 'FileStub' , FileStub , log , null , / ^prototype$ / ) ; nodeConsole . traceMethods ( 'FileStub' , FileStub . prototype , log , null , / ^(get|set)$ / ) ; nodeConsole . traceMethods ( 'wrapFs' , wrapFs , log ) ; nodeConsole . traceMethods ( 'mixin' , mixin , log ) ; } else { log = function noOpLogger ( ) { } ; } if ( is . string ( test ) ) { globalInjector [ test ] ( ) ; return ; } // Ex. 'mocha' if ( is . fn ( realFs . exists ) ) { return ; } // Already doubled // Mix in stubFile(), stubTree(), etc. Object . keys ( mixin ) . forEach ( function forEachMixinMethod ( method ) { test [ method ] = mixin [ method ] . bind ( test ) ; } ) ; // Replace a selection of `fs` Object . keys ( wrapFs ) . forEach ( function forEachWrapFsMethod ( method ) { realFs [ method ] = fs [ method ] ; fs [ method ] = wrapFs [ method ] ; } ) ; fileStubMap = { } ; context = test ; }
Init `fs` stubs.

@param {object|string} test Test context *OR* name of supported test runner
- `{object}` Context object including `sandbox` from prior `sinonDoublist()` call
- `{string}` Named runner will be configured to automatically set-up/tear-down.
- Supported runners: 'mocha'
Init fs stubs .