mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-28 04:23:15 +00:00
8070135e0d
closes #387
24 lines
655 B
JavaScript
24 lines
655 B
JavaScript
const glob = require("glob");
|
|
const fs = require("fs");
|
|
const { posix } = 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(posix.resolve(__dirname, tests));
|
|
var reqString = files.map(r => `import "${r}";`).join("\n");
|
|
fs.writeFileSync(posix.resolve(__dirname, "../test/test.js"), reqString);
|
|
}
|
|
|
|
collectTests();
|