mirror of
https://github.com/galacean/engine.git
synced 2026-06-21 21:52:48 +08:00
19 lines
458 B
TypeScript
19 lines
458 B
TypeScript
import fs from "fs";
|
|
import path from "path";
|
|
|
|
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")) {
|
|
require(filePath);
|
|
} else if (stat.isDirectory()) {
|
|
describe(file, () => {
|
|
searchTests(filePath);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
searchTests(path.join(__dirname, "src"));
|