Last active
March 16, 2017 15:12
-
-
Save apaleslimghost/e7d05f497fe79e21d3a3c4e28be68fad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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