MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / constructor

Method constructor

apps/desktop/main/index.ts:45–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43 mainWindow: BrowserWindow | null
44 isTestMode: boolean
45 constructor() {
46 // 主窗口
47 this.mainWindow = null
48
49 // E2E 测试模式检查:跳过遗留数据迁移和其他测试无关的初始化
50 this.isTestMode = process.env.TEST_MODE === 'true'
51
52 // E2E 测试隔离:为并行测试实例设置独立的用户数据目录
53 // 这防止了并发进程的状态泄漏、死锁和数据库冲突
54 const e2eUserDataDir = process.env.CHATLAB_E2E_USER_DATA_DIR
55 if (this.isTestMode && e2eUserDataDir) {
56 app.setPath('userData', e2eUserDataDir)
57 } else if (!this.isTestMode && e2eUserDataDir) {
58 console.warn('[Main] Ignored CHATLAB_E2E_USER_DATA_DIR because TEST_MODE is not enabled')
59 }
60
61 // 设置应用程序名称
62 if (process.platform === 'win32') app.setAppUserModelId(app.getName())
63 // 初始化
64 this.checkApp().then(async (lockObtained) => {
65 if (lockObtained) {
66 await this.init()
67 }
68 })
69 }
70
71 // 单例锁
72 async checkApp() {

Callers

nothing calls this directly

Calls 3

checkAppMethod · 0.95
initMethod · 0.95
warnMethod · 0.65

Tested by

no test coverage detected