Files
minecraft-bedrock-json-schemas/test/src/utillity.ts
Daan Verstraten 8e59f63167 Feature/jest2 (#322)
* Adding more tests
* adding jest
* fixing tests
* fixing linting
* removing 1 slash less
* fixing more tests
* fixing last test
* more last fixes
2024-11-09 10:08:30 +01:00

36 lines
914 B
TypeScript

import * as FastGlob from "fast-glob";
import * as path from "path";
export namespace Files {
export function TestFolder(): string {
return path.join(__dirname, "..", "..", "test");
}
export function RootFolder(): string {
return path.join(TestFolder(), "..");
}
export function FilesFolder(): string {
return path.join(TestFolder(), "files");
}
export function CorrectFilesFolder(): string {
return path.join(FilesFolder(), "correct");
}
export function InCorrectFilesFolder(): string {
return path.join(FilesFolder(), "incorrect");
}
export function GetFiles(cwd: string): string[] {
if (!cwd.endsWith("/") && !cwd.endsWith("\\")) cwd += "/";
cwd = cwd.replace("\\", "/");
const options: FastGlob.Options = { onlyFiles: true, absolute: true, cwd: cwd };
const entries = FastGlob.sync(["*.json", "**/*.json"], options);
return entries;
}
}