testgenius-ai
Version:
🚀 TestGenius AI - The Ultimate E2E Testing Framework for Everyone | No Coding Required • AI-Powered Automation • Beautiful Reports • Zero Complexity
33 lines • 1.66 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProjectInitializer = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
class ProjectInitializer {
constructor() { }
async init(options = {}) {
const dirs = ['src/tests', 'test-results', 'reports', 'screenshots', 'logs'];
for (const dir of dirs) {
await fs_extra_1.default.ensureDir(path_1.default.join(process.cwd(), dir));
}
// Copy env.example to .env if not present
const envPath = path_1.default.join(process.cwd(), '.env');
const envExample = path_1.default.join(process.cwd(), 'env.example');
if (!(await fs_extra_1.default.pathExists(envPath)) && (await fs_extra_1.default.pathExists(envExample))) {
await fs_extra_1.default.copyFile(envExample, envPath);
console.log('✅ .env file created from env.example');
}
// Create config if not present
const configPath = path_1.default.join(process.cwd(), 'testgenius.config.js');
if (!(await fs_extra_1.default.pathExists(configPath))) {
await fs_extra_1.default.writeFile(configPath, `module.exports = require('./src/types').defaultConfig;\n`, 'utf8');
console.log('✅ testgenius.config.js created');
}
console.log('✅ Project initialized!');
}
}
exports.ProjectInitializer = ProjectInitializer;
//# sourceMappingURL=ProjectInitializer.js.map