Tone.js/scripts/collect_tests.js
tambien ed71d8141b amd to es6 import/export
no longer using AMD (require.js) style imports, and beginning to move to es6 "import/export" statements everywhere.
2019-01-27 13:05:20 -05:00

24 lines
645 B
JavaScript

const glob = require("glob");
const fs = require("fs");
const { resolve } = require("path");
const argv = require("yargs")
.alias("i", "file")
.alias("d", "dir")
.argv;
/**
* COLLECT TESTS
*/
function collectTests(){
var tests = "../test/!(helper|deps|examples|html)/*.js";
if (typeof argv.file === "string"){
tests = `../test/*/${argv.file}.js`;
} else if (typeof argv.dir === "string"){
tests = `../test/${argv.dir}/*.js`;
}
const files = glob.sync(resolve(__dirname, tests));
var reqString = files.map(r => `import "${r}";`).join("\n");
fs.writeFileSync(resolve(__dirname, "../test/test.js"), reqString);
}
collectTests();