news
Adding Stack Traces
When you can't trace manually, add instrumentation: ```typescript // Before the problematic operation async function gitInit(directory: string) { const stack = new Error().stack; console.error('DEBUG git init:', { directory, cwd: process.cwd(), nodeEnv: process.env.NODE_ENV, stack, }); await execFileAsync('git', ['init'], { cwd: directory }); } ``` **Critical:** Use `console.error()` in tests (not logger - may not show) **Run and capture:** ```bash npm test 2>&1 | grep 'DEBUG git init' ``` **Analyze stack traces:** - Look for test file names - Find the line number triggering the call - Identify the pattern (same test? same parameter?)
← 返回教程列表
AI8899 · 内容仅供学习参考