github / github/copilot-cli

npx vitest run hangs when running full test suites via Copilot CLI terminal

未關閉
#3,308 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:platform-windows area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

## Summary

Running `npx vitest run` for a full test suite hangs indefinitely when executed through the GitHub Copilot CLI terminal. The same command works fine in a regular PowerShell/cmd terminal.

## Environment

- **Tool**: GitHub Copilot CLI (VS Code)
- **OS**: Windows
- **Node**: v22.14.0
- **npm**: 10.9.2
- **Vitest**: v4.1.2

## Reproduction Steps

1. Open a Copilot CLI terminal session in VS Code
2. Run `npx vitest run`
3. Vitest starts, queues all test files, runs a few, then hangs with no further output
4. Typically nothing is seen piped back to the session window (the above has been deduced)

## What Works

- Running a **single test file** works fine: `npx vitest run some.test.ts`
- Running **batches of up to ~10 files** works fine
- Running with **JSON output to file** works and completes successfully:
```
npx vitest run --reporter=json --outputFile=test-results.json
```

## Root Cause

According to copilot which tried to diagnose this:
Vitest's default live reporter continuously rewrites terminal output using ANSI escape sequences (cursor movement, line clearing) for all queued files simultaneously. This high-volume ANSI output appears to overflow or deadlock the Copilot CLI's stdout pipe, causing the process to hang.

Redirecting output to a file bypasses the pipe entirely and the suite completes normally.

## Workaround

```bash
npx vitest run --reporter=json --outputFile=test-results.json
```

## Suggested Fix

### Affected version

vs code 1.120.0

### Steps to reproduce the behavior

1. Open a Copilot CLI terminal session in VS Code
2. Run `npx vitest run`
3. Vitest starts, queues all test files, runs a few, then hangs with no further output
4. Typically nothing is seen piped back to the session window (the above has been deduced)

### Expected behavior

See output of vitest

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

No repository file or test is named. Start by reproducing `npx vitest run` in the Windows Copilot CLI terminal, then compare the default reporter with `--reporter=json --outputFile=test-results.json`; done means the full suite completes and output is visible without the hang.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
node.js, shell, vscode
領域
cli, developer-experience, testing-qa
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。