fix: 通知ユーティリティのテストモック追加と check:release の通知対応
通知機能(notifySuccess/notifyError/playWarningSound)追加に伴い、 テストの vi.mock を修正。重複モックの統合、vitest 環境変数の追加、 GH API の recursive パラメータ修正、check:release に macOS 通知を追加。
This commit is contained in:
parent
4ee69f857a
commit
6a28929497
@ -40,7 +40,7 @@ function fixtureHasManifest(repo: string, ref: string, filename: string): boolea
|
||||
try {
|
||||
const out = execFileSync(
|
||||
'gh',
|
||||
['api', `/repos/${repo}/git/trees/${ref}`, '--recursive'],
|
||||
['api', `/repos/${repo}/git/trees/${ref}?recursive=1`],
|
||||
{ encoding: 'utf-8', stdio: 'pipe' },
|
||||
);
|
||||
const tree = JSON.parse(out) as { tree: { path: string }[] };
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
"test:e2e:codex": "npm run test:e2e:provider:codex",
|
||||
"test:e2e:opencode": "npm run test:e2e:provider:opencode",
|
||||
"lint": "eslint src/",
|
||||
"check:release": "npm run build && npm run lint && npm run test && npm run test:e2e",
|
||||
"check:release": "npm run build && npm run lint && npm run test && npm run test:e2e; code=$?; if [ \"$code\" -eq 0 ]; then msg='check:release passed'; else msg=\"check:release failed (exit=$code)\"; fi; if command -v osascript >/dev/null 2>&1; then osascript -e \"display notification \\\"$msg\\\" with title \\\"takt\\\" subtitle \\\"Release Check\\\"\" >/dev/null 2>&1 || true; fi; echo \"[takt] $msg\"; exit $code",
|
||||
"prepublishOnly": "npm run lint && npm run build && npm run test"
|
||||
},
|
||||
"keywords": [
|
||||
|
||||
@ -24,6 +24,9 @@ vi.mock('../core/piece/phase-runner.js', () => ({
|
||||
|
||||
vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
notifySuccess: vi.fn(),
|
||||
notifyError: vi.fn(),
|
||||
playWarningSound: vi.fn(),
|
||||
generateReportDir: vi.fn().mockReturnValue('test-report-dir'),
|
||||
}));
|
||||
|
||||
|
||||
@ -86,10 +86,6 @@ vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
notifySuccess: vi.fn(),
|
||||
notifyError: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
generateSessionId: vi.fn().mockReturnValue('test-session-id'),
|
||||
createSessionLog: vi.fn().mockReturnValue({
|
||||
startTime: new Date().toISOString(),
|
||||
|
||||
@ -68,10 +68,6 @@ vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
notifySuccess: vi.fn(),
|
||||
notifyError: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
generateSessionId: vi.fn().mockReturnValue('test-session-id'),
|
||||
createSessionLog: vi.fn().mockReturnValue({
|
||||
startTime: new Date().toISOString(),
|
||||
|
||||
@ -68,6 +68,9 @@ vi.mock('../shared/utils/index.js', async (importOriginal) => ({
|
||||
debug: vi.fn(),
|
||||
error: vi.fn(),
|
||||
}),
|
||||
notifySuccess: vi.fn(),
|
||||
notifyError: vi.fn(),
|
||||
playWarningSound: vi.fn(),
|
||||
getSlackWebhookUrl: (...args: unknown[]) => mockGetSlackWebhookUrl(...args as []),
|
||||
sendSlackNotification: (...args: unknown[]) => mockSendSlackNotification(...(args as [string, string])),
|
||||
buildSlackRunSummary: (...args: unknown[]) => mockBuildSlackRunSummary(...(args as [unknown])),
|
||||
|
||||
@ -4,6 +4,7 @@ export default defineConfig({
|
||||
test: {
|
||||
env: {
|
||||
TAKT_CONFIG_DIR: '',
|
||||
TAKT_NOTIFY_WEBHOOK: '',
|
||||
},
|
||||
include: ['src/__tests__/**/*.test.ts'],
|
||||
environment: 'node',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user