"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const typescript_1 = require("typescript");
const transpileFile_1 = require("../typescript/transpileFile");
function findTypedTestConfigs(compilerOptions, cwd = process.cwd()) {
    const configPath = typescript_1.findConfigFile(cwd, (fileName) => fs.existsSync(fileName), '.typed-test.ts');
    if (!configPath) {
        return [{}];
    }
    const configContents = fs.readFileSync(configPath).toString();
    const { content } = transpileFile_1.transpileFile(configContents, compilerOptions, cwd, configPath);
    // tslint:disable-next-line:no-eval
    const configModule = eval(content);
    return configModule.default ? toArrayIfNot(configModule.default) : toArrayIfNot(configModule);
}
exports.findTypedTestConfigs = findTypedTestConfigs;
function toArrayIfNot(x) {
    return Array.isArray(x) ? x : [x];
}
//# sourceMappingURL=findTypedTestConfigs.js.map