Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Last active March 16, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apaleslimghost/e7d05f497fe79e21d3a3c4e28be68fad to your computer and use it in GitHub Desktop.
Save apaleslimghost/e7d05f497fe79e21d3a3c4e28be68fad to your computer and use it in GitHub Desktop.
const path = require('path');
const fs = require('fs');
delete require.cache[__filename];
module.exports = (name, extra = () => {}) => describe(name, function() {
extra.call(this);
const parent = module.parent.filename;
const parentDir = path.dirname(parent);
const files = fs.readdirSync(parentDir)
.map(file => path.join(parentDir, file))
.filter(file => file !== parent);
files.forEach(require);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment