@vibe-validate/extractors 0.17.4 → 0.17.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extractor-registry.d.ts.map +1 -1
- package/dist/extractor-registry.js +8 -8
- package/dist/extractor-registry.js.map +1 -1
- package/dist/extractors/ava/index.d.ts.map +1 -1
- package/dist/extractors/ava/index.js +15 -14
- package/dist/extractors/ava/index.js.map +1 -1
- package/dist/extractors/ava/index.test.js +30 -20
- package/dist/extractors/ava/index.test.js.map +1 -1
- package/dist/extractors/eslint/index.d.ts.map +1 -1
- package/dist/extractors/eslint/index.js +1 -1
- package/dist/extractors/eslint/index.js.map +1 -1
- package/dist/extractors/eslint/index.test.js.map +1 -1
- package/dist/extractors/generic/index.test.js.map +1 -1
- package/dist/extractors/jasmine/index.test.js.map +1 -1
- package/dist/extractors/jest/index.d.ts.map +1 -1
- package/dist/extractors/jest/index.js.map +1 -1
- package/dist/extractors/jest/index.test.js.map +1 -1
- package/dist/extractors/junit/index.d.ts.map +1 -1
- package/dist/extractors/junit/index.js +5 -5
- package/dist/extractors/junit/index.js.map +1 -1
- package/dist/extractors/junit/index.test.js.map +1 -1
- package/dist/extractors/maven-checkstyle/index.d.ts.map +1 -1
- package/dist/extractors/maven-checkstyle/index.js +1 -1
- package/dist/extractors/maven-checkstyle/index.js.map +1 -1
- package/dist/extractors/maven-checkstyle/index.test.js +2 -2
- package/dist/extractors/maven-checkstyle/index.test.js.map +1 -1
- package/dist/extractors/maven-compiler/index.d.ts.map +1 -1
- package/dist/extractors/maven-compiler/index.js +1 -1
- package/dist/extractors/maven-compiler/index.js.map +1 -1
- package/dist/extractors/maven-compiler/index.test.js +1 -1
- package/dist/extractors/maven-compiler/index.test.js.map +1 -1
- package/dist/extractors/maven-surefire/index.d.ts.map +1 -1
- package/dist/extractors/maven-surefire/index.js.map +1 -1
- package/dist/extractors/maven-surefire/index.test.js.map +1 -1
- package/dist/extractors/mocha/index.test.js.map +1 -1
- package/dist/extractors/playwright/index.test.js.map +1 -1
- package/dist/extractors/tap/index.test.js +2 -2
- package/dist/extractors/tap/index.test.js.map +1 -1
- package/dist/extractors/typescript/index.d.ts.map +1 -1
- package/dist/extractors/typescript/index.js +16 -19
- package/dist/extractors/typescript/index.js.map +1 -1
- package/dist/extractors/typescript/index.test.js.map +1 -1
- package/dist/extractors/vitest/index.d.ts.map +1 -1
- package/dist/extractors/vitest/index.js +16 -7
- package/dist/extractors/vitest/index.js.map +1 -1
- package/dist/extractors/vitest/index.test.js +38 -0
- package/dist/extractors/vitest/index.test.js.map +1 -1
- package/dist/plugin-loader.d.ts.map +1 -1
- package/dist/plugin-loader.js +1 -1
- package/dist/plugin-loader.js.map +1 -1
- package/dist/result-schema-export.d.ts.map +1 -1
- package/dist/result-schema-export.js.map +1 -1
- package/dist/result-schema.d.ts.map +1 -1
- package/dist/result-schema.js +1 -1
- package/dist/result-schema.js.map +1 -1
- package/dist/sandboxed-extractor.d.ts +1 -1
- package/dist/sandboxed-extractor.d.ts.map +1 -1
- package/dist/sandboxed-extractor.js.map +1 -1
- package/dist/scripts/generate-result-schema.js +1 -1
- package/dist/scripts/generate-result-schema.js.map +1 -1
- package/dist/smart-extractor.d.ts.map +1 -1
- package/dist/smart-extractor.js.map +1 -1
- package/dist/utils/guidance-generator.d.ts.map +1 -1
- package/dist/utils/guidance-generator.js +4 -7
- package/dist/utils/guidance-generator.js.map +1 -1
- package/dist/utils/test-framework-utils.d.ts.map +1 -1
- package/dist/utils/test-framework-utils.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +8 -8
- package/dist/ava-extractor.d.ts +0 -24
- package/dist/ava-extractor.d.ts.map +0 -1
- package/dist/ava-extractor.js +0 -343
- package/dist/ava-extractor.js.map +0 -1
- package/dist/eslint-extractor.d.ts +0 -25
- package/dist/eslint-extractor.d.ts.map +0 -1
- package/dist/eslint-extractor.js +0 -145
- package/dist/eslint-extractor.js.map +0 -1
- package/dist/generic-extractor.d.ts +0 -35
- package/dist/generic-extractor.d.ts.map +0 -1
- package/dist/generic-extractor.js +0 -128
- package/dist/generic-extractor.js.map +0 -1
- package/dist/jasmine-extractor.d.ts +0 -23
- package/dist/jasmine-extractor.d.ts.map +0 -1
- package/dist/jasmine-extractor.js +0 -151
- package/dist/jasmine-extractor.js.map +0 -1
- package/dist/jest-extractor.d.ts +0 -29
- package/dist/jest-extractor.d.ts.map +0 -1
- package/dist/jest-extractor.js +0 -174
- package/dist/jest-extractor.js.map +0 -1
- package/dist/junit-extractor.d.ts +0 -24
- package/dist/junit-extractor.d.ts.map +0 -1
- package/dist/junit-extractor.js +0 -193
- package/dist/junit-extractor.js.map +0 -1
- package/dist/maven-checkstyle-extractor.d.ts +0 -20
- package/dist/maven-checkstyle-extractor.d.ts.map +0 -1
- package/dist/maven-checkstyle-extractor.js +0 -208
- package/dist/maven-checkstyle-extractor.js.map +0 -1
- package/dist/maven-compiler-extractor.d.ts +0 -20
- package/dist/maven-compiler-extractor.d.ts.map +0 -1
- package/dist/maven-compiler-extractor.js +0 -218
- package/dist/maven-compiler-extractor.js.map +0 -1
- package/dist/maven-surefire-extractor.d.ts +0 -20
- package/dist/maven-surefire-extractor.d.ts.map +0 -1
- package/dist/maven-surefire-extractor.js +0 -228
- package/dist/maven-surefire-extractor.js.map +0 -1
- package/dist/mocha-extractor.d.ts +0 -23
- package/dist/mocha-extractor.d.ts.map +0 -1
- package/dist/mocha-extractor.js +0 -160
- package/dist/mocha-extractor.js.map +0 -1
- package/dist/playwright-extractor.d.ts +0 -38
- package/dist/playwright-extractor.d.ts.map +0 -1
- package/dist/playwright-extractor.js +0 -239
- package/dist/playwright-extractor.js.map +0 -1
- package/dist/sandbox.test.d.ts +0 -8
- package/dist/sandbox.test.d.ts.map +0 -1
- package/dist/sandbox.test.js +0 -395
- package/dist/sandbox.test.js.map +0 -1
- package/dist/sandboxed-extractor.test.d.ts +0 -5
- package/dist/sandboxed-extractor.test.d.ts.map +0 -1
- package/dist/sandboxed-extractor.test.js +0 -346
- package/dist/sandboxed-extractor.test.js.map +0 -1
- package/dist/tap-extractor.d.ts +0 -24
- package/dist/tap-extractor.d.ts.map +0 -1
- package/dist/tap-extractor.js +0 -217
- package/dist/tap-extractor.js.map +0 -1
- package/dist/typescript-extractor.d.ts +0 -25
- package/dist/typescript-extractor.d.ts.map +0 -1
- package/dist/typescript-extractor.js +0 -96
- package/dist/typescript-extractor.js.map +0 -1
- package/dist/vitest-extractor.d.ts +0 -38
- package/dist/vitest-extractor.d.ts.map +0 -1
- package/dist/vitest-extractor.js +0 -540
- package/dist/vitest-extractor.js.map +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Fallback extractor for unknown validation step types.
|
|
5
|
-
* Intelligently extracts error keywords and relevant lines for LLM consumption.
|
|
6
|
-
*
|
|
7
|
-
* @package @vibe-validate/extractors
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Error keyword patterns for intelligent extraction
|
|
11
|
-
*
|
|
12
|
-
* Note: Case-insensitive matching done via toLowerCase() in logic
|
|
13
|
-
*/
|
|
14
|
-
const ERROR_KEYWORDS = [
|
|
15
|
-
'failed',
|
|
16
|
-
'fail',
|
|
17
|
-
'error',
|
|
18
|
-
'exception',
|
|
19
|
-
'traceback',
|
|
20
|
-
'assertionerror',
|
|
21
|
-
'typeerror',
|
|
22
|
-
'valueerror',
|
|
23
|
-
'panic:',
|
|
24
|
-
'fatal:',
|
|
25
|
-
'syntaxerror',
|
|
26
|
-
'referenceerror',
|
|
27
|
-
'comparisonerror', // JUnit
|
|
28
|
-
'comparisonfailure', // JUnit
|
|
29
|
-
'arithmeticexception', // Java
|
|
30
|
-
'at ', // Stack trace lines
|
|
31
|
-
'-->', // Rust error pointers
|
|
32
|
-
'undefined:', // Go/JS undefined errors
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Noise patterns to filter out
|
|
36
|
-
*/
|
|
37
|
-
const NOISE_PATTERNS = [
|
|
38
|
-
/^>/, // npm script headers
|
|
39
|
-
/npm ERR!/,
|
|
40
|
-
/^npm WARN/,
|
|
41
|
-
/^warning:/i, // Generic warnings (keep errors)
|
|
42
|
-
/node_modules/, // Dependency paths
|
|
43
|
-
/^Download/i,
|
|
44
|
-
/^Resolving packages/i,
|
|
45
|
-
/^Already up[- ]to[- ]date/i,
|
|
46
|
-
];
|
|
47
|
-
/**
|
|
48
|
-
* Generic error extractor (fallback)
|
|
49
|
-
*
|
|
50
|
-
* Intelligently extracts error information by:
|
|
51
|
-
* - Identifying lines with error keywords (FAILED, Error, Exception, etc.)
|
|
52
|
-
* - Extracting file paths with line numbers (test.py:42, main.go:15)
|
|
53
|
-
* - Capturing summary lines (X failed, Y passed)
|
|
54
|
-
* - Removing npm/package manager noise
|
|
55
|
-
* - Limiting to 15-20 most relevant lines for token efficiency
|
|
56
|
-
*
|
|
57
|
-
* @param output - Raw command output
|
|
58
|
-
* @returns Structured error information with keyword-extracted summary
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* // Python pytest output
|
|
63
|
-
* const result = extractGenericErrors(pytestOutput);
|
|
64
|
-
* // errorSummary contains only: FAILED lines, AssertionError, summary
|
|
65
|
-
*
|
|
66
|
-
* // Go test output
|
|
67
|
-
* const result = extractGenericErrors(goTestOutput);
|
|
68
|
-
* // errorSummary contains only: FAIL lines, panic:, file:line references
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export function extractGenericErrors(output) {
|
|
72
|
-
const lines = output.split('\n');
|
|
73
|
-
// Step 1: Extract lines with error keywords or file:line patterns
|
|
74
|
-
const relevantLines = [];
|
|
75
|
-
for (const line of lines) {
|
|
76
|
-
const trimmed = line.trim();
|
|
77
|
-
// Skip empty lines
|
|
78
|
-
if (trimmed === '')
|
|
79
|
-
continue;
|
|
80
|
-
// Skip noise patterns
|
|
81
|
-
if (NOISE_PATTERNS.some(pattern => pattern.test(line)))
|
|
82
|
-
continue;
|
|
83
|
-
// Include if contains error keywords (case-insensitive)
|
|
84
|
-
const lineLower = line.toLowerCase();
|
|
85
|
-
const hasErrorKeyword = ERROR_KEYWORDS.some(keyword => lineLower.includes(keyword));
|
|
86
|
-
// Include if looks like file:line reference (e.g., test.py:42, main.go:15:10)
|
|
87
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: matches file paths in validation output (controlled input), limited line length, simple pattern with no nested quantifiers
|
|
88
|
-
const hasFileLineRef = /\w+\.(py|go|rs|rb|java|cpp|c|h|js|ts|tsx|jsx):\d+/.test(line);
|
|
89
|
-
// Include if looks like a summary line (e.g., "2 failed, 3 passed", "X examples")
|
|
90
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: matches summary lines in validation output (controlled input), limited line length, simple pattern with no nested quantifiers
|
|
91
|
-
const isSummaryLine = /\d+\s+(failed|passed|error|success|example)/i.test(line);
|
|
92
|
-
if (hasErrorKeyword || hasFileLineRef || isSummaryLine) {
|
|
93
|
-
relevantLines.push(line);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Step 2: If we found relevant lines, use them; otherwise fall back to basic cleaning
|
|
97
|
-
let errorSummary;
|
|
98
|
-
if (relevantLines.length > 0) {
|
|
99
|
-
// Limit to first 20 relevant lines
|
|
100
|
-
errorSummary = relevantLines.slice(0, 20).join('\n');
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
// Fallback: Basic cleaning (remove noise, limit to 20 lines)
|
|
104
|
-
errorSummary = lines
|
|
105
|
-
.filter(line => {
|
|
106
|
-
if (line.trim() === '')
|
|
107
|
-
return false;
|
|
108
|
-
if (NOISE_PATTERNS.some(pattern => pattern.test(line)))
|
|
109
|
-
return false;
|
|
110
|
-
return true;
|
|
111
|
-
})
|
|
112
|
-
.slice(0, 20)
|
|
113
|
-
.join('\n');
|
|
114
|
-
}
|
|
115
|
-
// Determine if errors were detected based on extracted content
|
|
116
|
-
const hasErrors = relevantLines.length > 0;
|
|
117
|
-
return {
|
|
118
|
-
errors: [],
|
|
119
|
-
summary: hasErrors ? 'Command failed - see output' : 'No errors detected',
|
|
120
|
-
// CRITICAL: totalErrors must always equal errors.length (data integrity invariant)
|
|
121
|
-
// Generic extractor doesn't populate errors array, so totalErrors is always 0
|
|
122
|
-
// Error details are in errorSummary only
|
|
123
|
-
totalErrors: 0,
|
|
124
|
-
guidance: hasErrors ? 'Review the output above and fix the errors' : '',
|
|
125
|
-
errorSummary
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=generic-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generic-extractor.js","sourceRoot":"","sources":["../src/generic-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,MAAM;IACN,OAAO;IACP,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,gBAAgB;IAChB,iBAAiB,EAAG,QAAQ;IAC5B,mBAAmB,EAAG,QAAQ;IAC9B,qBAAqB,EAAG,OAAO;IAC/B,KAAK,EAAG,oBAAoB;IAC5B,KAAK,EAAG,sBAAsB;IAC9B,YAAY,EAAG,yBAAyB;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,IAAI,EAAG,qBAAqB;IAC5B,UAAU;IACV,WAAW;IACX,YAAY,EAAG,iCAAiC;IAChD,cAAc,EAAG,mBAAmB;IACpC,YAAY;IACZ,sBAAsB;IACtB,4BAA4B;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI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BAAE,OAAO,KAAK,CAAC;YACrC,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;YACrE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;aACZ,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,+DAA+D;IAC/D,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAE3C,OAAO;QACL,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,oBAAoB;QACzE,mFAAmF;QACnF,8EAA8E;QAC9E,yCAAyC;QACzC,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,EAAE;QACvE,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jasmine Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Parses Jasmine test output and formats failures for LLM consumption.
|
|
5
|
-
*
|
|
6
|
-
* @package @vibe-validate/extractors
|
|
7
|
-
*/
|
|
8
|
-
import type { ErrorExtractorResult } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Extract errors from Jasmine test output
|
|
11
|
-
*
|
|
12
|
-
* @param output - Jasmine text output
|
|
13
|
-
* @returns Structured error information
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const jasmineOutput = execSync('jasmine tests/**\/*.spec.js', { encoding: 'utf-8' });
|
|
18
|
-
* const result = extractJasmineErrors(jasmineOutput);
|
|
19
|
-
* console.log(result.summary); // "5 test(s) failed"
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function extractJasmineErrors(output: string): ErrorExtractorResult;
|
|
23
|
-
//# sourceMappingURL=jasmine-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jasmine-extractor.d.ts","sourceRoot":"","sources":["../src/jasmine-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAkCzE"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jasmine Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Parses Jasmine test output and formats failures for LLM consumption.
|
|
5
|
-
*
|
|
6
|
-
* @package @vibe-validate/extractors
|
|
7
|
-
*/
|
|
8
|
-
import { processTestFailures } from './utils/test-framework-utils.js';
|
|
9
|
-
/**
|
|
10
|
-
* Extract errors from Jasmine test output
|
|
11
|
-
*
|
|
12
|
-
* @param output - Jasmine text output
|
|
13
|
-
* @returns Structured error information
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const jasmineOutput = execSync('jasmine tests/**\/*.spec.js', { encoding: 'utf-8' });
|
|
18
|
-
* const result = extractJasmineErrors(jasmineOutput);
|
|
19
|
-
* console.log(result.summary); // "5 test(s) failed"
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export function extractJasmineErrors(output) {
|
|
23
|
-
// Note: ANSI codes are stripped centrally in smart-extractor.ts
|
|
24
|
-
// Check if this looks like Jasmine output
|
|
25
|
-
if (!output.includes('spec') && !output.includes('Failures:')) {
|
|
26
|
-
return {
|
|
27
|
-
summary: 'Unable to parse Jasmine output - invalid format',
|
|
28
|
-
errors: [],
|
|
29
|
-
totalErrors: 0,
|
|
30
|
-
errorSummary: output.trim(),
|
|
31
|
-
guidance: 'Ensure the input is valid Jasmine test output',
|
|
32
|
-
metadata: {
|
|
33
|
-
confidence: 0,
|
|
34
|
-
completeness: 0,
|
|
35
|
-
issues: ['Not Jasmine output format']
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Extract failure count
|
|
40
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Jasmine test framework summary (controlled output), not user input
|
|
41
|
-
const failureMatch = /(\d+) spec(?:s)?, (\d+) failure(?:s)?/.exec(output);
|
|
42
|
-
const failureCount = failureMatch ? Number.parseInt(failureMatch[2], 10) : 0;
|
|
43
|
-
// Extract all failures
|
|
44
|
-
const failures = extractFailures(output);
|
|
45
|
-
// Early return if no failures detected (but failure count suggested there should be)
|
|
46
|
-
if (failureCount === 0 && failures.length === 0) {
|
|
47
|
-
return processTestFailures([], 95);
|
|
48
|
-
}
|
|
49
|
-
// Process failures using shared utility
|
|
50
|
-
return processTestFailures(failures, 95);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Extract failure information from Jasmine output
|
|
54
|
-
*/
|
|
55
|
-
// eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 28 acceptable for Jasmine output parsing (handles numbered failures, message extraction, and stack trace parsing)
|
|
56
|
-
function extractFailures(output) {
|
|
57
|
-
const failures = [];
|
|
58
|
-
const lines = output.split('\n');
|
|
59
|
-
let i = 0;
|
|
60
|
-
while (i < lines.length) {
|
|
61
|
-
const line = lines[i];
|
|
62
|
-
// Look for numbered failure markers (e.g., "1) Test name")
|
|
63
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Jasmine test framework output (controlled output), not user input
|
|
64
|
-
const failureMatch = /^(\d+)\)\s+(.+)$/.exec(line);
|
|
65
|
-
if (failureMatch) {
|
|
66
|
-
// failureMatch[1] contains the failure number (not used - line number extracted from stack trace instead)
|
|
67
|
-
const testName = failureMatch[2].trim();
|
|
68
|
-
let j = i + 1;
|
|
69
|
-
let message;
|
|
70
|
-
let errorType;
|
|
71
|
-
let file;
|
|
72
|
-
let lineNumber;
|
|
73
|
-
// Scan for Message: and Stack: sections
|
|
74
|
-
while (j < lines.length && j < i + 30) {
|
|
75
|
-
const nextLine = lines[j];
|
|
76
|
-
// Stop if we hit the next failure
|
|
77
|
-
if (/^\d+\)\s+/.exec(nextLine)) {
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
// Extract message (comes after " Message:" line)
|
|
81
|
-
if (nextLine.trim() === 'Message:') {
|
|
82
|
-
j++;
|
|
83
|
-
// Collect message lines until we hit "Stack:" or empty line
|
|
84
|
-
const messageLines = [];
|
|
85
|
-
while (j < lines.length) {
|
|
86
|
-
const msgLine = lines[j];
|
|
87
|
-
if (msgLine.trim() === 'Stack:' || msgLine.trim() === '') {
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
messageLines.push(msgLine.trim());
|
|
91
|
-
j++;
|
|
92
|
-
}
|
|
93
|
-
message = messageLines.join(' ').trim();
|
|
94
|
-
// Extract error type if present (e.g., "TypeError:", "Error:")
|
|
95
|
-
const errorMatch = /^([A-Za-z]*Error):\s*/.exec(message);
|
|
96
|
-
if (errorMatch) {
|
|
97
|
-
errorType = errorMatch[1];
|
|
98
|
-
}
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
// Extract file location from stack trace
|
|
102
|
-
if (nextLine.trim() === 'Stack:') {
|
|
103
|
-
j++;
|
|
104
|
-
// Scan stack trace for file location
|
|
105
|
-
while (j < lines.length && j < i + 40) {
|
|
106
|
-
const stackLine = lines[j];
|
|
107
|
-
// Stop if we hit the next failure or empty section
|
|
108
|
-
if (/^\d+\)\s+/.exec(stackLine) || (stackLine.trim() === '' && /^\d+\)\s+/.exec(lines[j + 1] ?? ''))) {
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
// Extract file from UserContext.<anonymous> stack lines
|
|
112
|
-
if (stackLine.includes('UserContext.<anonymous>')) {
|
|
113
|
-
const locationMatch = /UserContext\.<anonymous> \(([^:)]+):(\d+)(?::(\d+))?\)/.exec(stackLine);
|
|
114
|
-
if (locationMatch) {
|
|
115
|
-
file = locationMatch[1];
|
|
116
|
-
lineNumber = Number.parseInt(locationMatch[2], 10);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Also try Object.* patterns
|
|
121
|
-
if (!file && stackLine.includes(' (') && stackLine.includes('.js:')) {
|
|
122
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Jasmine test framework stack traces (controlled output), not user input
|
|
123
|
-
const altMatch = /\(([^:)]+):(\d+)(?::(\d+))?\)/.exec(stackLine);
|
|
124
|
-
if (altMatch) {
|
|
125
|
-
file = altMatch[1];
|
|
126
|
-
lineNumber = Number.parseInt(altMatch[2], 10);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
j++;
|
|
131
|
-
}
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
j++;
|
|
135
|
-
}
|
|
136
|
-
failures.push({
|
|
137
|
-
testName,
|
|
138
|
-
message,
|
|
139
|
-
errorType,
|
|
140
|
-
file,
|
|
141
|
-
line: lineNumber
|
|
142
|
-
});
|
|
143
|
-
i = j; // Skip to after this failure
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
i++;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return failures;
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=jasmine-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jasmine-extractor.js","sourceRoot":"","sources":["../src/jasmine-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iCAAiC,CAAC;AAE5F;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,gEAAgE;IAEhE,0CAA0C;IAC1C,IAAI,CAAC,MAAM,CAA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3I,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;4BACjE,IAAI,QAAQ,EAAE,CAAC;gCACb,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;gCACnB,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gCAC9C,MAAM;4BACR,CAAC;wBACH,CAAC;wBAED,CAAC,EAAE,CAAC;oBACN,CAAC;oBACD,SAAS;gBACX,CAAC;gBAED,CAAC,EAAE,CAAC;YACN,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC;gBACZ,QAAQ;gBACR,OAAO;gBACP,SAAS;gBACT,IAAI;gBACJ,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,CAAC,GAAG,CAAC,CAAC,CAAC,6BAA6B;QACtC,CAAC;aAAM,CAAC;YACN,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/jest-extractor.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jest Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Parses and formats Jest test failure output for LLM consumption.
|
|
5
|
-
*
|
|
6
|
-
* @package @vibe-validate/extractors
|
|
7
|
-
*/
|
|
8
|
-
import type { ErrorExtractorResult } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Extract Jest test failures
|
|
11
|
-
*
|
|
12
|
-
* Parses Jest output format:
|
|
13
|
-
* - FAIL test/file.test.ts
|
|
14
|
-
* - ● Test Suite › test name
|
|
15
|
-
* - Error message
|
|
16
|
-
* - at file:line:col
|
|
17
|
-
*
|
|
18
|
-
* @param output - Raw Jest command output
|
|
19
|
-
* @returns Structured error information with test-specific guidance
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const result = extractJestErrors(jestOutput);
|
|
24
|
-
* console.log(result.summary); // "3 test failure(s)"
|
|
25
|
-
* console.log(result.guidance); // "Fix each failing test individually..."
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function extractJestErrors(output: string): ErrorExtractorResult;
|
|
29
|
-
//# sourceMappingURL=jest-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest-extractor.d.ts","sourceRoot":"","sources":["../src/jest-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA0IvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAoDtE"}
|
package/dist/jest-extractor.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jest Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Parses and formats Jest test failure output for LLM consumption.
|
|
5
|
-
*
|
|
6
|
-
* @package @vibe-validate/extractors
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Match FAIL line and extract file path
|
|
10
|
-
*/
|
|
11
|
-
function matchFailLine(line) {
|
|
12
|
-
const failMatch = /^\s*FAIL\s+(?:[\w-]+\s+)?([\w/-]+\.test\.\w+)/.exec(line);
|
|
13
|
-
return failMatch ? failMatch[1] : null;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Match inline failure (✕) and extract test name
|
|
17
|
-
*/
|
|
18
|
-
function matchInlineFailure(line) {
|
|
19
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Jest test framework output (controlled output), not user input
|
|
20
|
-
const failureMatch = /^\s+✕\s+(.+?)(?:\s+\(\d+\s*ms\))?$/.exec(line);
|
|
21
|
-
return failureMatch ? failureMatch[1].trim() : null;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Match detailed test format (●) and extract hierarchy
|
|
25
|
-
*/
|
|
26
|
-
function matchDetailedTest(line) {
|
|
27
|
-
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Jest test framework output (controlled output), not user input
|
|
28
|
-
const detailedTestMatch = /^\s*●\s+(.+)$/.exec(line);
|
|
29
|
-
return detailedTestMatch ? detailedTestMatch[1].trim() : null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Match test suite line and extract suite info
|
|
33
|
-
*/
|
|
34
|
-
function matchSuiteLine(line) {
|
|
35
|
-
const suiteMatch = /^\s+([A-Z][\w\s›-]+)$/.exec(line);
|
|
36
|
-
if (!suiteMatch || line.includes('✕') || line.includes('✓') || line.includes('ms)')) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const indentMatch = /^(\s*)/.exec(line);
|
|
40
|
-
const indent = indentMatch ? indentMatch[1].length : 0;
|
|
41
|
-
return { name: suiteMatch[1].trim(), indent };
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Adjust hierarchy stack based on indentation level
|
|
45
|
-
*/
|
|
46
|
-
function adjustHierarchyForIndent(hierarchyStack, indent) {
|
|
47
|
-
while (hierarchyStack.length > 0 && indent <= hierarchyStack.length * 2) {
|
|
48
|
-
hierarchyStack.pop();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Process a single line of Jest output
|
|
53
|
-
*/
|
|
54
|
-
function processLine(line, currentFile, hierarchyStack) {
|
|
55
|
-
const result = {};
|
|
56
|
-
// Check for FAIL line
|
|
57
|
-
const newFile = matchFailLine(line);
|
|
58
|
-
if (newFile) {
|
|
59
|
-
result.newFile = newFile;
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
// Skip lines before we have a file
|
|
63
|
-
if (!currentFile) {
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
// Check for inline failure (✕)
|
|
67
|
-
const inlineTest = matchInlineFailure(line);
|
|
68
|
-
if (inlineTest) {
|
|
69
|
-
const fullHierarchy = hierarchyStack.length > 0
|
|
70
|
-
? [...hierarchyStack, inlineTest].join(' › ')
|
|
71
|
-
: inlineTest;
|
|
72
|
-
result.failure = {
|
|
73
|
-
file: currentFile,
|
|
74
|
-
location: currentFile,
|
|
75
|
-
testHierarchy: fullHierarchy,
|
|
76
|
-
errorMessage: 'Test failed'
|
|
77
|
-
};
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
// Check for detailed test format (●)
|
|
81
|
-
const detailedHierarchy = matchDetailedTest(line);
|
|
82
|
-
if (detailedHierarchy) {
|
|
83
|
-
result.failure = {
|
|
84
|
-
file: currentFile,
|
|
85
|
-
location: currentFile,
|
|
86
|
-
testHierarchy: detailedHierarchy,
|
|
87
|
-
errorMessage: 'Test failed'
|
|
88
|
-
};
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
// Check for suite line
|
|
92
|
-
const suiteInfo = matchSuiteLine(line);
|
|
93
|
-
if (suiteInfo) {
|
|
94
|
-
result.newSuite = suiteInfo;
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Format failures into clean output string
|
|
100
|
-
*/
|
|
101
|
-
function formatJestFailures(failures) {
|
|
102
|
-
const errorSummaryLines = [];
|
|
103
|
-
for (const failure of failures) {
|
|
104
|
-
errorSummaryLines.push(`● ${failure.testHierarchy}`);
|
|
105
|
-
errorSummaryLines.push(` ${failure.errorMessage}`);
|
|
106
|
-
errorSummaryLines.push(` Location: ${failure.location}`);
|
|
107
|
-
errorSummaryLines.push('');
|
|
108
|
-
}
|
|
109
|
-
return errorSummaryLines.join('\n');
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Extract Jest test failures
|
|
113
|
-
*
|
|
114
|
-
* Parses Jest output format:
|
|
115
|
-
* - FAIL test/file.test.ts
|
|
116
|
-
* - ● Test Suite › test name
|
|
117
|
-
* - Error message
|
|
118
|
-
* - at file:line:col
|
|
119
|
-
*
|
|
120
|
-
* @param output - Raw Jest command output
|
|
121
|
-
* @returns Structured error information with test-specific guidance
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```typescript
|
|
125
|
-
* const result = extractJestErrors(jestOutput);
|
|
126
|
-
* console.log(result.summary); // "3 test failure(s)"
|
|
127
|
-
* console.log(result.guidance); // "Fix each failing test individually..."
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export function extractJestErrors(output) {
|
|
131
|
-
// Note: ANSI codes are stripped centrally in smart-extractor.ts
|
|
132
|
-
const lines = output.split('\n');
|
|
133
|
-
const failures = [];
|
|
134
|
-
let currentFile = '';
|
|
135
|
-
const hierarchyStack = [];
|
|
136
|
-
for (const line of lines) {
|
|
137
|
-
const result = processLine(line, currentFile, hierarchyStack);
|
|
138
|
-
if (result.newFile) {
|
|
139
|
-
currentFile = result.newFile;
|
|
140
|
-
hierarchyStack.length = 0;
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (result.failure) {
|
|
144
|
-
failures.push(result.failure);
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (result.newSuite) {
|
|
148
|
-
adjustHierarchyForIndent(hierarchyStack, result.newSuite.indent);
|
|
149
|
-
hierarchyStack.push(result.newSuite.name);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// Build formatted errors
|
|
153
|
-
const errors = failures.map(f => ({
|
|
154
|
-
file: f.file,
|
|
155
|
-
line: Number.parseInt(f.location.split(':')[1] || '0'),
|
|
156
|
-
column: Number.parseInt(f.location.split(':')[2] || '0'),
|
|
157
|
-
message: `${f.testHierarchy}: ${f.errorMessage}`,
|
|
158
|
-
severity: 'error'
|
|
159
|
-
}));
|
|
160
|
-
const summary = failures.length > 0
|
|
161
|
-
? `${failures.length} test failure(s)`
|
|
162
|
-
: 'No test failures detected';
|
|
163
|
-
const guidance = failures.length > 0
|
|
164
|
-
? 'Fix each failing test individually. Check test setup, mocks, and assertions.'
|
|
165
|
-
: '';
|
|
166
|
-
return {
|
|
167
|
-
errors,
|
|
168
|
-
summary,
|
|
169
|
-
totalErrors: failures.length,
|
|
170
|
-
guidance,
|
|
171
|
-
errorSummary: formatJestFailures(failures)
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=jest-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest-extractor.js","sourceRoot":"","sources":["../src/jest-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH;;GAEG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,SAAS,GAAG,+CAA+C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACtC,kIAAkI;IAClI,MAAM,YAAY,GAAG,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,IAAY;IACrC,kIAAkI;IAClI,MAAM,iBAAiB,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,UAAU,IAAI,IAAI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AC,IAAI,GAAG,CAAC;QACxD,OAAO,EAAE,GAAG,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC,YAAY,EAAE;QAChD,QAAQ,EAAE,OAAgB;KAC3B,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,kBAAkB;QACtC,CAAC,CAAC,2BAA2B,CAAC;IAEhC,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC;QAClC,CAAC,CAAC,8EAA8E;QAChF,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;QACL,MAAM;QACN,OAAO;QACP,WAAW,EAAE,QAAQ,CAAC,MAAM;QAC5B,QAAQ;QACR,YAAY,EAAE,kBAAkB,CAAC,QAAQ,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JUnit XML Error Extractor
|
|
3
|
-
*
|
|
4
|
-
* Parses JUnit XML test reports and formats failures for LLM consumption.
|
|
5
|
-
* Supports Vitest, Jest, and other test frameworks that output JUnit XML.
|
|
6
|
-
*
|
|
7
|
-
* @package @vibe-validate/extractors
|
|
8
|
-
*/
|
|
9
|
-
import type { ErrorExtractorResult } from './types.js';
|
|
10
|
-
/**
|
|
11
|
-
* Extract errors from JUnit XML test output
|
|
12
|
-
*
|
|
13
|
-
* @param output - JUnit XML string
|
|
14
|
-
* @returns Structured error information
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const junitXml = fs.readFileSync('junit.xml', 'utf-8');
|
|
19
|
-
* const result = extractJUnitErrors(junitXml);
|
|
20
|
-
* console.log(result.summary); // "5 test(s) failed"
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function extractJUnitErrors(output: string): ErrorExtractorResult;
|
|
24
|
-
//# sourceMappingURL=junit-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"junit-extractor.d.ts","sourceRoot":"","sources":["../src/junit-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAsC,MAAM,YAAY,CAAC;AAI3F;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAgGvE"}
|