mirror of
https://github.com/galacean/engine.git
synced 2026-05-10 00:39:31 +08:00
24 lines
593 B
TypeScript
24 lines
593 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
|
|
const { IS_COV } = process.env;
|
|
|
|
function searchTests(root: string) {
|
|
fs.readdirSync(root).forEach((file) => {
|
|
const filePath = path.join(root, file);
|
|
const stat = fs.statSync(filePath);
|
|
if (stat.isFile() && filePath.endsWith(".test.ts")) {
|
|
if (IS_COV && path.basename(filePath) === "KTX2Loader.test.ts") {
|
|
return;
|
|
}
|
|
describe(file, function () {
|
|
require(filePath);
|
|
});
|
|
} else if (stat.isDirectory()) {
|
|
searchTests(filePath);
|
|
}
|
|
});
|
|
}
|
|
|
|
searchTests(path.join(__dirname, "src"));
|