Created
January 6, 2016 09:33
-
-
Save otissv/6125bfd8e1c80ed0a933 to your computer and use it in GitHub Desktop.
Tape test runner es6
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
| { | |
| "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" | |
| } | |
| } |
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
| '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