- npm workspaces 루트 (apps/*, packages/*) 세팅 - V1 전체를 apps/desktop/으로 git mv (src, resources, tests, sidecar, scripts, electron.vite.config.ts, electron-builder.yml, vitest.config.ts, tsconfig.node.json, tsconfig.web.json) - apps/desktop/package.json 신규 (name=@d3ro/desktop) - productName: 'd3ro-voice' 명시 — app.getName()을 고정하여 userData 경로 %APPDATA%\d3ro-voice\ 그대로 유지 (기존 DB/설정 연속성 보장) - 루트 package.json을 workspace 루트로 재구성, 공통 devDep만 유지 (typescript, eslint, prettier) - turbo.json, tsconfig.base.json 추가 (Turborepo 자체 설치는 별도 sub-phase) - memory/project_status.md 생성 (규칙 13) 검증: - npm run typecheck 통과 - npm run build 통과 (electron-vite main+preload+renderer) - npm run dev 실제 실행 → DB/핫키/Ollama 자동 실행 모두 정상
73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
// tests/setup.ts
|
|
// vitest 글로벌 셋업: electron 모듈 모킹
|
|
|
|
import { vi } from 'vitest'
|
|
|
|
// electron 모듈 모킹 — 테스트에서 electron import 시 에러 방지
|
|
vi.mock('electron', () => ({
|
|
app: {
|
|
getPath: vi.fn(() => ':memory:'),
|
|
getVersion: vi.fn(() => '1.0.0'),
|
|
quit: vi.fn(),
|
|
on: vi.fn(),
|
|
whenReady: vi.fn(() => Promise.resolve())
|
|
},
|
|
ipcMain: {
|
|
handle: vi.fn(),
|
|
on: vi.fn(),
|
|
removeHandler: vi.fn()
|
|
},
|
|
BrowserWindow: vi.fn(),
|
|
Tray: vi.fn(),
|
|
Menu: vi.fn(),
|
|
nativeImage: {
|
|
createFromPath: vi.fn()
|
|
},
|
|
dialog: {
|
|
showErrorBox: vi.fn()
|
|
},
|
|
screen: {
|
|
getPrimaryDisplay: vi.fn(() => ({
|
|
workArea: { x: 0, y: 0, width: 1920, height: 1080 }
|
|
}))
|
|
},
|
|
clipboard: {
|
|
readText: vi.fn(() => ''),
|
|
writeText: vi.fn(),
|
|
readHTML: vi.fn(() => ''),
|
|
readRTF: vi.fn(() => ''),
|
|
readImage: vi.fn(() => ({ isEmpty: () => true, toPNG: () => Buffer.alloc(0) })),
|
|
write: vi.fn()
|
|
}
|
|
}))
|
|
|
|
// WindowManager 모킹 — VoiceModeService가 import하므로 필요
|
|
vi.mock('../src/main/windows/WindowManager', () => ({
|
|
showRecordingTip: vi.fn(),
|
|
hideRecordingTip: vi.fn(),
|
|
updateRecordingTipState: vi.fn(),
|
|
sendAudioLevelToTip: vi.fn(),
|
|
showResultPopup: vi.fn(),
|
|
hideResultPopup: vi.fn(),
|
|
getMainWindow: vi.fn(),
|
|
createMainWindow: vi.fn(),
|
|
}))
|
|
|
|
// electron-log 모킹
|
|
vi.mock('electron-log', () => {
|
|
const noop = vi.fn()
|
|
return {
|
|
default: {
|
|
info: noop,
|
|
warn: noop,
|
|
error: noop,
|
|
debug: noop,
|
|
create: () => ({
|
|
info: noop,
|
|
warn: noop,
|
|
error: noop,
|
|
debug: noop
|
|
})
|
|
}
|
|
}
|
|
})
|