fix: skip test files in webhook extraction

Test files often mock webhook patterns (e.g., constructEvent in Stripe
test mocks), causing false detection. Skip files in test directories.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test 2026-03-25 20:58:11 +01:00
parent 10c6646bc6
commit 0f06a65c94

View file

@ -1357,6 +1357,10 @@ export function extractORMQueries(
// ============================================================================
function extractWebhooks(filePath: string, content: string, out: ExtractedWebhook[]): void {
// Skip test files — they often mock webhook patterns
const lp = filePath.toLowerCase();
if (lp.includes('/test') || lp.includes('.test.') || lp.includes('.spec.') || lp.includes('__test')) return;
if (content.includes('constructEvent') || content.includes('webhooks.constructEvent')) {
const eventTypes: string[] = [];
const caseRe = /case\s+['"]([.\w-]+)['"]/g;