'use strict';
import { npxCommands, npmCommands } from '../constants/npm-commands.js';
import { toolboxCoreEnvVars } from '../../../fd-toolbox-core/constants/environment-variables-constants.js';
import { ciLogMessages, nodeMaxMemory } from '../constants/ci-constants.js';
import { execSyncCommand } from '../tools/exec.js';
import { installLocalSaasKit } from '../setup/install-local-saaskit.js';
import { initDb } from '../setup/init-db.js';
import { copyPlaywrightReport } from '../setup/copy-playwright-report.js';
import { cliLogInfo, cliLogSubtitle, cliLogSuccess, cliLogError } from '../../../fd-toolbox/logging/cli-logger.js';
import { cleanup } from '../setup/cleanup.js';
import { importBuildFromSubmodule } from '../setup/sync-build-artifacts.js';
import { packagesPath } from '../../../base-repo/app-constants/project-paths.js';

var __defProp=Object['defineProperty'],__name=(_0x1009a0,_0x550b1e)=>__defProp(_0x1009a0,'name',{'value':_0x550b1e,'configurable':!![]});async function buildAndTest(){try{cliLogInfo(ciLogMessages['runningSetupPackage']),await importBuildFromSubmodule(),await installLocalSaasKit(),await initDb(),process['env'][toolboxCoreEnvVars['nodeOptions']]=nodeMaxMemory,execSyncCommand(npxCommands['buildAll']),execSyncCommand(npmCommands['build']),cliLogSubtitle(ciLogMessages['playwrightTestsStarting']),execSyncCommand(npmCommands['genMeta'],{'cwd':packagesPath['packagesTest']}),execSyncCommand(npmCommands['genSchema'],{'cwd':packagesPath['packagesTest']}),execSyncCommand(npxCommands['testStringDuplication']),execSyncCommand(npxCommands['test']),cliLogSuccess(ciLogMessages['playwrightTestsFinishedSuccessfully']);}finally{try{await copyPlaywrightReport(),cliLogInfo(ciLogMessages['runningCleanupScript']),cleanup();}catch(_0x1d6c2d){cliLogError(ciLogMessages['cleanupScriptFailed'],_0x1d6c2d);}}}__name(buildAndTest,'buildAndTest');

export { buildAndTest };
