Last active
July 27, 2016 08:19
-
-
Save iest/c9dc96809208b6c834e7eb83343f9350 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 glob = require('glob'); | |
// Setup babel so all future `require` calls are run through it | |
require("babel-register")({ | |
// Override babel's default behaviour of ignoring all `node_modules` | |
ignore: false, | |
only: [ | |
// Include all js/jsx files in ./src | |
"./src/**/*", | |
// We have a node_module called citymapper-js that requires babel transpilation | |
/citymapper-js/, | |
], | |
}); | |
process.argv.slice(2).forEach((arg) => { | |
glob(arg, (er, files) => { | |
if (er) throw er; | |
if (files.length === 0) throw new Error(`test-runner: No files at "${arg}"`); | |
files.forEach((file) => { | |
const filepath = path.resolve(process.cwd(), file); | |
require(filepath); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment