✨ feat(vscode): 问 AI 输入框能粘贴、拖进图片随问题发给 Claude Code,缩略图能点开看大图,图片存进 .spx/code-qa 跟着问答删
This commit is contained in:
1 parent
d9a5c3673e
commit
36d842e18e
28 files changed
+825
-121
No files matched your search
@@ -29,6 +29,16 @@ describe('跑 claude、逐行交出 stdout', () => {
|
||||
expect(lines).toEqual(['{"a":1}', '{"b":2}', await fsp.realpath(dir), '-p|带 空格 的问题|'])
|
||||
})
|
||||
|
||||
it('给了 input 就写进 stdin 再关上(stream-json 的消息);不给时 stdin 是空的,读 stdin 的也不会卡住', async () => {
|
||||
const bin = await fakeBin('cat; echo end')
|
||||
const withInput: string[] = []
|
||||
await runClaudeLines({ bin, args: [], cwd: dir, input: '{"type":"user"}\n', onLine: item => withInput.push(item) })
|
||||
expect(withInput).toEqual(['{"type":"user"}', 'end'])
|
||||
const without: string[] = []
|
||||
await runClaudeLines({ bin, args: [], cwd: dir, timeoutMs: 2000, onLine: item => without.push(item) })
|
||||
expect(without).toEqual(['end'])
|
||||
})
|
||||
|
||||
it('退出码非零:带上 stderr 的原话', async () => {
|
||||
const bin = await fakeBin('echo "No conversation found with session ID: x" >&2; exit 1')
|
||||
const error = await runClaudeLines({ bin, args: [], cwd: dir, onLine: () => {} }).catch((err: unknown) => err)
|
||||
|
||||
Reference in new issue
Block a user