Skip to content

Instantly share code, notes, and snippets.

@iest
Last active July 27, 2016 08:19
Show Gist options
  • Save iest/c9dc96809208b6c834e7eb83343f9350 to your computer and use it in GitHub Desktop.
Save iest/c9dc96809208b6c834e7eb83343f9350 to your computer and use it in GitHub Desktop.
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