2018-08-23 04:17:35 +00:00
|
|
|
const glob = require("glob");
|
|
|
|
const fs = require("fs");
|
2019-02-02 19:08:21 +00:00
|
|
|
const { posix } = require("path");
|
2018-08-23 04:17:35 +00:00
|
|
|
const argv = require("yargs")
|
|
|
|
.alias("i", "file")
|
|
|
|
.alias("d", "dir")
|
|
|
|
.argv;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* COLLECT TESTS
|
|
|
|
*/
|
|
|
|
function collectTests(){
|
2019-01-27 18:05:20 +00:00
|
|
|
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`;
|
|
|
|
}
|
2019-02-02 19:08:21 +00:00
|
|
|
const files = glob.sync(posix.resolve(__dirname, tests));
|
2019-01-27 18:05:20 +00:00
|
|
|
var reqString = files.map(r => `import "${r}";`).join("\n");
|
2019-02-02 19:08:21 +00:00
|
|
|
fs.writeFileSync(posix.resolve(__dirname, "../test/test.js"), reqString);
|
2018-08-23 04:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
collectTests();
|