Skip to content

Instantly share code, notes, and snippets.

@otissv
Created January 6, 2016 09:33
Show Gist options
  • Select an option

  • Save otissv/6125bfd8e1c80ed0a933 to your computer and use it in GitHub Desktop.

Select an option

Save otissv/6125bfd8e1c80ed0a933 to your computer and use it in GitHub Desktop.
Tape test runner es6
{
"scripts": {
"test": "babel-node test-runner.js | tap-min && date|| true && date",
"test:spec": "babel-node test-runner.js | tap-difflet || true && date",
"test:watch": "watch 'npm run test' ./"
},
"devDependencies": {
"babel-core": "~6.2.1",
"babel-preset-es2015": "~6.1.18",
"babel-preset-stage-0": "~6.1.18",
"babel-runtime": "~6.2.0",
"tape": "~4.2.2",
"cheerio": "~0.19.0",
"faucet": "~0.0.1",
"glob": "~6.0.1",
"tap-difflet": "~0.4.0",
"tap-min": "~1.0.0",
"watch": "~0.16.0"
}
}
'use strict';
import glob from 'glob';
import path from 'path';
const config = {
base: './',
folder : './__tests__/**/*-test.js',
options : {
ignore: './node_modules/**'
}
};
const resolveBase = (base, filePath) => {
return path.resolve(__dirname, `${base}${filePath}`);
};
const requireFiles = (config) => {
return glob(config.folder, config.options, (err, files) => {
if (err) {
return err;
}
files.forEach(f => {
const tests = resolveBase(config.base, f);
require(`${tests}`);
});
});
};
export default requireFiles(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment