function Barrels(sourceFolder) {
  if (!(this instanceof Barrels))
    return new Barrels(sourceFolder);

  // Fixture objects loaded from the JSON files
  this.data = {};

  // Map fixture positions in JSON files to the real DB IDs
  this.idMap = {};

  // The list of associations by model
  this.associations = {};

  // Load the fixtures
  sourceFolder = sourceFolder || process.cwd() + '/test/fixtures';
  var files = fs.readdirSync(sourceFolder);

  for (var i = 0; i < files.length; i++) {
    if (['.json', '.js'].indexOf(path.extname(files[i]).toLowerCase()) !== -1) {
      var modelName = path.basename(files[i]).split('.')[0].toLowerCase();
      this.data[modelName] = require(path.join(sourceFolder, files[i]));
    }
  }

  // The list of the fixtures model names
  this.modelNames = Object.keys(this.data);
}
function Barrels(sourceFolder) {
  if (!(this instanceof Barrels))
    return new Barrels(sourceFolder);

  
  this.data = {};

  
  this.idMap = {};

  
  this.associations = {};

  
  sourceFolder = sourceFolder || process.cwd() + '/test/fixtures';
  var files = fs.readdirSync(sourceFolder);

  for (var i = 0; i < files.length; i++) {
    if (['.json', '.js'].indexOf(path.extname(files[i]).toLowerCase()) !== -1) {
      var modelName = path.basename(files[i]).split('.')[0].toLowerCase();
      this.data[modelName] = require(path.join(sourceFolder, files[i]));
    }
  }

  
  this.modelNames = Object.keys(this.data);
}
function Barrels ( sourceFolder ) { if ( ! ( this instanceof Barrels ) ) return new Barrels ( sourceFolder ) ; // Fixture objects loaded from the JSON files this . data = { } ; // Map fixture positions in JSON files to the real DB IDs this . idMap = { } ; // The list of associations by model this . associations = { } ; // Load the fixtures sourceFolder = sourceFolder || process . cwd ( ) + '/test/fixtures' ; var files = fs . readdirSync ( sourceFolder ) ; for ( var i = 0 ; i < files . length ; i ++ ) { if ( [ '.json' , '.js' ] . indexOf ( path . extname ( files [ i ] ) . toLowerCase ( ) ) !== - 1 ) { var modelName = path . basename ( files [ i ] ) . split ( '.' ) [ 0 ] . toLowerCase ( ) ; this . data [ modelName ] = require ( path . join ( sourceFolder , files [ i ] ) ) ; } } // The list of the fixtures model names this . modelNames = Object . keys ( this . data ) ; }
Barrels module
@param {string} sourceFolder defaults to <project root>/test/fixtures
Barrels module