import * as fs from 'fs';
import * as path from 'path';
import lint from 'mocha-eslint';
export class TestCollector {
    static async requireTests(filePath) {
        if (fs.statSync(filePath).isDirectory()) {
            describe(filePath.split('/').pop() + '/', () => {
                fs.readdirSync(filePath).forEach((item) => {
                    this.requireTests(path.join(filePath, item));
                });
            });
        }
        else if (filePath.indexOf('.test.ts') === filePath.length - '.test.ts'.length) {
            await import(filePath);
        }
    }
    static eslintTests(directories = ['.'], fileExtensions = ['ts', 'js', 'json']) {
        lint([`{${directories}}/**/*.{${fileExtensions}}`], {
            alwaysWarn: false,
        });
    }
}
