@vibe-validate/extractors 0.12.0 → 0.12.2
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/LICENSE +21 -0
- package/README.md +68 -9
- package/dist/ava-extractor.d.ts +24 -0
- package/dist/ava-extractor.d.ts.map +1 -0
- package/dist/ava-extractor.js +367 -0
- package/dist/ava-extractor.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/jasmine-extractor.d.ts +23 -0
- package/dist/jasmine-extractor.d.ts.map +1 -0
- package/dist/jasmine-extractor.js +254 -0
- package/dist/jasmine-extractor.js.map +1 -0
- package/dist/jest-extractor.d.ts +29 -0
- package/dist/jest-extractor.d.ts.map +1 -0
- package/dist/jest-extractor.js +115 -0
- package/dist/jest-extractor.js.map +1 -0
- package/dist/junit-extractor.d.ts +24 -0
- package/dist/junit-extractor.d.ts.map +1 -0
- package/dist/junit-extractor.js +264 -0
- package/dist/junit-extractor.js.map +1 -0
- package/dist/mocha-extractor.d.ts +23 -0
- package/dist/mocha-extractor.d.ts.map +1 -0
- package/dist/mocha-extractor.js +263 -0
- package/dist/mocha-extractor.js.map +1 -0
- package/dist/playwright-extractor.d.ts +38 -0
- package/dist/playwright-extractor.d.ts.map +1 -0
- package/dist/playwright-extractor.js +230 -0
- package/dist/playwright-extractor.js.map +1 -0
- package/dist/smart-extractor.d.ts +14 -1
- package/dist/smart-extractor.d.ts.map +1 -1
- package/dist/smart-extractor.js +50 -1
- package/dist/smart-extractor.js.map +1 -1
- package/dist/tap-extractor.d.ts +24 -0
- package/dist/tap-extractor.d.ts.map +1 -0
- package/dist/tap-extractor.js +227 -0
- package/dist/tap-extractor.js.map +1 -0
- package/dist/types.d.ts +21 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vitest-extractor.d.ts +9 -1
- package/dist/vitest-extractor.d.ts.map +1 -1
- package/dist/vitest-extractor.js +112 -16
- package/dist/vitest-extractor.js.map +1 -1
- package/package.json +12 -14
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jeff Dutton
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -11,10 +11,22 @@ LLM-optimized error extractors for validation output.
|
|
|
11
11
|
|
|
12
12
|
## Supported Extractors
|
|
13
13
|
|
|
14
|
+
### Test Frameworks
|
|
15
|
+
- **Vitest**: Dual format support (Format 1 & 2), assertion errors, test hierarchy
|
|
16
|
+
- **Jest**: Comprehensive error extraction, all failure types supported
|
|
17
|
+
- **Mocha**: Native Mocha output format, stack trace parsing
|
|
18
|
+
- **Jasmine**: Angular ecosystem support, Message:/Stack: section parsing
|
|
19
|
+
- **TAP (Test Anything Protocol)**: Covers Tape, node-tap, YAML diagnostics parsing
|
|
20
|
+
- **Ava**: Node.js community favorite, detailed block parsing with quality metadata
|
|
21
|
+
- **Playwright**: Modern E2E testing, numbered failure blocks, stack trace extraction
|
|
22
|
+
- **JUnit XML**: Universal test format for any framework with XML output
|
|
23
|
+
|
|
24
|
+
### Code Quality Tools
|
|
14
25
|
- **TypeScript (tsc)**: Parses `file(line,col): error TSxxxx: message` format
|
|
15
26
|
- **ESLint**: Parses `file:line:col - severity message [rule]` format
|
|
16
|
-
- **Vitest/Jest**: Extracts test hierarchy, assertion errors, expected vs actual
|
|
17
27
|
- **OpenAPI**: Filters validation errors from specification validators
|
|
28
|
+
|
|
29
|
+
### Fallback
|
|
18
30
|
- **Generic**: Fallback for unknown tools (removes npm noise)
|
|
19
31
|
|
|
20
32
|
## Installation
|
|
@@ -42,18 +54,49 @@ console.log(result.errors); // Structured error array
|
|
|
42
54
|
|
|
43
55
|
### Direct Extractor Usage
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
Use direct extractors when:
|
|
58
|
+
- You know the exact tool being used
|
|
59
|
+
- You want explicit control over extraction
|
|
60
|
+
- You need tool-specific options
|
|
61
|
+
|
|
62
|
+
**Example: Using Jest extractor directly**
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { extractJestErrors } from '@vibe-validate/extractors';
|
|
66
|
+
import { execSync } from 'child_process';
|
|
67
|
+
|
|
68
|
+
const jestOutput = execSync('npx jest --no-coverage').toString();
|
|
69
|
+
const result = extractJestErrors(jestOutput);
|
|
70
|
+
|
|
71
|
+
console.log(`Found ${result.errors.length} test failures`);
|
|
72
|
+
console.log(`Quality: ${result.metadata?.confidence}% confidence`);
|
|
73
|
+
result.errors.forEach(error => {
|
|
74
|
+
console.log(` ${error.file}:${error.line} - ${error.message}`);
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**All available extractors:**
|
|
46
79
|
|
|
47
80
|
```typescript
|
|
48
81
|
import {
|
|
82
|
+
// Test framework extractors
|
|
83
|
+
extractVitestErrors,
|
|
84
|
+
extractJestErrors,
|
|
85
|
+
extractMochaErrors,
|
|
86
|
+
extractJasmineErrors,
|
|
87
|
+
extractTAPErrors,
|
|
88
|
+
extractAvaErrors,
|
|
89
|
+
extractPlaywrightErrors,
|
|
90
|
+
extractJUnitErrors,
|
|
91
|
+
|
|
92
|
+
// Code quality extractors
|
|
49
93
|
extractTypeScriptErrors,
|
|
50
94
|
extractESLintErrors,
|
|
51
|
-
|
|
52
|
-
formatOpenAPIErrors,
|
|
53
|
-
formatGenericErrors
|
|
54
|
-
} from '@vibe-validate/extractors';
|
|
95
|
+
extractOpenAPIErrors,
|
|
55
96
|
|
|
56
|
-
|
|
97
|
+
// Fallback
|
|
98
|
+
extractGenericErrors
|
|
99
|
+
} from '@vibe-validate/extractors';
|
|
57
100
|
```
|
|
58
101
|
|
|
59
102
|
### Utilities
|
|
@@ -74,7 +117,14 @@ Smart extractor with auto-detection.
|
|
|
74
117
|
**Detection rules:**
|
|
75
118
|
- TypeScript: Step name contains "TypeScript" or "typecheck"
|
|
76
119
|
- ESLint: Step name contains "ESLint" or "lint"
|
|
77
|
-
- Vitest
|
|
120
|
+
- Vitest: Output contains `❯` marker or `FAIL` keyword
|
|
121
|
+
- Jest: Output contains `FAIL` or `●` bullet pattern
|
|
122
|
+
- Mocha: Output contains Mocha's passing/failing summary format
|
|
123
|
+
- Jasmine: Output contains "Failures:" header
|
|
124
|
+
- TAP: Output contains "TAP version" or "not ok" format
|
|
125
|
+
- Ava: Output contains `✘ [fail]:` pattern
|
|
126
|
+
- Playwright: Output contains `✘` with `.spec.ts` references
|
|
127
|
+
- JUnit XML: Output starts with `<?xml` and contains `<testsuite>`
|
|
78
128
|
- OpenAPI: Step name contains "OpenAPI"
|
|
79
129
|
- Generic: Fallback for unknown types
|
|
80
130
|
|
|
@@ -82,13 +132,21 @@ Smart extractor with auto-detection.
|
|
|
82
132
|
|
|
83
133
|
```typescript
|
|
84
134
|
interface FormattedError {
|
|
85
|
-
file
|
|
135
|
+
file?: string;
|
|
86
136
|
line?: number;
|
|
87
137
|
column?: number;
|
|
88
138
|
message: string;
|
|
89
139
|
code?: string;
|
|
90
140
|
severity?: 'error' | 'warning';
|
|
91
141
|
context?: string;
|
|
142
|
+
guidance?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface ExtractionMetadata {
|
|
146
|
+
confidence: number; // 0-100: Based on pattern match quality
|
|
147
|
+
completeness: number; // % of failures with file + line + message
|
|
148
|
+
issues: string[]; // Problems encountered during extraction
|
|
149
|
+
suggestions?: string[]; // For developerFeedback mode only
|
|
92
150
|
}
|
|
93
151
|
|
|
94
152
|
interface ErrorExtractorResult {
|
|
@@ -97,6 +155,7 @@ interface ErrorExtractorResult {
|
|
|
97
155
|
totalCount: number; // Total error count
|
|
98
156
|
guidance?: string; // Actionable fixing guidance
|
|
99
157
|
cleanOutput: string; // Clean formatted output for YAML/JSON
|
|
158
|
+
metadata?: ExtractionMetadata; // Extraction quality metadata
|
|
100
159
|
}
|
|
101
160
|
```
|
|
102
161
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ava Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses Ava test output and formats failures for LLM consumption.
|
|
5
|
+
* Supports Ava v6+ output format with Unicode symbols and clean error formatting.
|
|
6
|
+
*
|
|
7
|
+
* @package @vibe-validate/extractors
|
|
8
|
+
*/
|
|
9
|
+
import type { ErrorExtractorResult } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Extract errors from Ava test output
|
|
12
|
+
*
|
|
13
|
+
* @param output - Ava text output
|
|
14
|
+
* @returns Structured error information
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const avaOutput = execSync('ava tests/**\/*.test.js', { encoding: 'utf-8' });
|
|
19
|
+
* const result = extractAvaErrors(avaOutput);
|
|
20
|
+
* console.log(result.summary); // "5 test(s) failed"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractAvaErrors(output: string): ErrorExtractorResult;
|
|
24
|
+
//# sourceMappingURL=ava-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ava-extractor.d.ts","sourceRoot":"","sources":["../src/ava-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAsC,MAAM,YAAY,CAAC;AAG3F;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAsErE"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ava Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses Ava test output and formats failures for LLM consumption.
|
|
5
|
+
* Supports Ava v6+ output format with Unicode symbols and clean error formatting.
|
|
6
|
+
*
|
|
7
|
+
* @package @vibe-validate/extractors
|
|
8
|
+
*/
|
|
9
|
+
import { stripAnsiCodes } from './utils.js';
|
|
10
|
+
/**
|
|
11
|
+
* Extract errors from Ava test output
|
|
12
|
+
*
|
|
13
|
+
* @param output - Ava text output
|
|
14
|
+
* @returns Structured error information
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const avaOutput = execSync('ava tests/**\/*.test.js', { encoding: 'utf-8' });
|
|
19
|
+
* const result = extractAvaErrors(avaOutput);
|
|
20
|
+
* console.log(result.summary); // "5 test(s) failed"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function extractAvaErrors(output) {
|
|
24
|
+
const cleanOutput = stripAnsiCodes(output);
|
|
25
|
+
// Extract all failures using two-pass approach:
|
|
26
|
+
// 1. Parse summary lines to get test names
|
|
27
|
+
// 2. Parse detailed blocks to get file locations and messages
|
|
28
|
+
const failures = extractFailures(cleanOutput);
|
|
29
|
+
if (failures.length === 0) {
|
|
30
|
+
return {
|
|
31
|
+
summary: '0 test(s) failed',
|
|
32
|
+
errors: [],
|
|
33
|
+
totalCount: 0,
|
|
34
|
+
cleanOutput: '',
|
|
35
|
+
guidance: '',
|
|
36
|
+
metadata: {
|
|
37
|
+
confidence: 100,
|
|
38
|
+
completeness: 100,
|
|
39
|
+
issues: []
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const errors = [];
|
|
44
|
+
let completeCount = 0;
|
|
45
|
+
for (const failure of failures) {
|
|
46
|
+
const file = failure.file || 'unknown';
|
|
47
|
+
// Use test name as fallback message if no explicit message extracted
|
|
48
|
+
const message = failure.message || failure.testName || 'Test failed';
|
|
49
|
+
const context = failure.testName || '';
|
|
50
|
+
const isComplete = file !== 'unknown' && failure.line && message && message !== 'Test failed';
|
|
51
|
+
if (isComplete) {
|
|
52
|
+
completeCount++;
|
|
53
|
+
}
|
|
54
|
+
errors.push({
|
|
55
|
+
file,
|
|
56
|
+
line: failure.line,
|
|
57
|
+
message,
|
|
58
|
+
context,
|
|
59
|
+
guidance: failure.guidance
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Generate summary
|
|
63
|
+
const summary = `${failures.length} test(s) failed`;
|
|
64
|
+
// Generate guidance
|
|
65
|
+
const guidance = generateGuidance(failures);
|
|
66
|
+
// Calculate quality metadata
|
|
67
|
+
const completeness = failures.length > 0 ? (completeCount / failures.length) * 100 : 100;
|
|
68
|
+
const confidence = failures.length > 0 ? 90 : 100; // High confidence for Ava's structured output
|
|
69
|
+
const metadata = {
|
|
70
|
+
confidence,
|
|
71
|
+
completeness,
|
|
72
|
+
issues: []
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
summary,
|
|
76
|
+
errors,
|
|
77
|
+
totalCount: failures.length,
|
|
78
|
+
cleanOutput: formatCleanOutput(errors),
|
|
79
|
+
guidance,
|
|
80
|
+
metadata
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Extract all failures from Ava output
|
|
85
|
+
* Strategy: Find detailed headers (test names with ›), then parse each block
|
|
86
|
+
*/
|
|
87
|
+
function extractFailures(output) {
|
|
88
|
+
const lines = output.split('\n');
|
|
89
|
+
const failures = [];
|
|
90
|
+
// Find all detailed block headers (clean test names with ›)
|
|
91
|
+
// These are the authoritative source - each one represents a failure
|
|
92
|
+
const headerIndices = [];
|
|
93
|
+
for (let i = 0; i < lines.length; i++) {
|
|
94
|
+
const trimmed = lines[i].trim();
|
|
95
|
+
// Detailed header: has ›, not a summary, not a file:// line, not code, reasonable length
|
|
96
|
+
if (trimmed.includes('›') &&
|
|
97
|
+
!trimmed.includes('[fail]:') &&
|
|
98
|
+
!trimmed.startsWith('›') &&
|
|
99
|
+
!trimmed.includes('file://') &&
|
|
100
|
+
!trimmed.match(/^\d+:/) &&
|
|
101
|
+
!trimmed.match(/^Error/) &&
|
|
102
|
+
!trimmed.includes('{') &&
|
|
103
|
+
!trimmed.includes('}') &&
|
|
104
|
+
trimmed.length > 10) {
|
|
105
|
+
headerIndices.push({ index: i, testName: trimmed });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// If we found detailed headers, parse each one
|
|
109
|
+
if (headerIndices.length > 0) {
|
|
110
|
+
for (const header of headerIndices) {
|
|
111
|
+
const failure = {
|
|
112
|
+
testName: header.testName
|
|
113
|
+
};
|
|
114
|
+
// Parse block starting from line after header
|
|
115
|
+
parseDetailedBlock(lines, header.index + 1, failure);
|
|
116
|
+
// Add error type detection and guidance
|
|
117
|
+
if (!failure.errorType && failure.message) {
|
|
118
|
+
failure.errorType = detectErrorType(failure.message);
|
|
119
|
+
}
|
|
120
|
+
if (failure.errorType) {
|
|
121
|
+
failure.guidance = getErrorGuidance(failure.errorType);
|
|
122
|
+
}
|
|
123
|
+
failures.push(failure);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Fallback: No detailed headers found (minimal format)
|
|
128
|
+
// Look for summary lines and parse content after them
|
|
129
|
+
for (let i = 0; i < lines.length; i++) {
|
|
130
|
+
const trimmed = lines[i].trim();
|
|
131
|
+
if (trimmed.includes('✘') && trimmed.includes('[fail]:')) {
|
|
132
|
+
const failure = {};
|
|
133
|
+
const summaryMatch = trimmed.match(/✘\s+\[fail\]:\s+(.+)/);
|
|
134
|
+
if (summaryMatch) {
|
|
135
|
+
failure.testName = summaryMatch[1];
|
|
136
|
+
}
|
|
137
|
+
// Parse block starting from next line
|
|
138
|
+
parseDetailedBlock(lines, i + 1, failure);
|
|
139
|
+
// Add error type detection and guidance
|
|
140
|
+
if (!failure.errorType && failure.message) {
|
|
141
|
+
failure.errorType = detectErrorType(failure.message);
|
|
142
|
+
}
|
|
143
|
+
if (failure.errorType) {
|
|
144
|
+
failure.guidance = getErrorGuidance(failure.errorType);
|
|
145
|
+
}
|
|
146
|
+
failures.push(failure);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return failures;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Parse a detailed error block to extract file, line, and message
|
|
154
|
+
*/
|
|
155
|
+
function parseDetailedBlock(lines, startIndex, failure) {
|
|
156
|
+
let i = startIndex;
|
|
157
|
+
let foundCodeSnippet = false;
|
|
158
|
+
let inErrorObject = false;
|
|
159
|
+
while (i < lines.length && i < startIndex + 60) {
|
|
160
|
+
const line = lines[i];
|
|
161
|
+
const trimmed = line.trim();
|
|
162
|
+
// Stop at next test header (clean test name with ›)
|
|
163
|
+
if (i > startIndex + 3 && trimmed.includes('›') && !trimmed.startsWith('›') &&
|
|
164
|
+
trimmed.length > 15 && !trimmed.includes('file://') &&
|
|
165
|
+
!trimmed.match(/^\d+:/) && !trimmed.match(/^Error/) &&
|
|
166
|
+
!trimmed.includes('{') && !trimmed.includes('}')) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
// Stop at separator
|
|
170
|
+
if (trimmed === '─') {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
// Extract file path: "tests/ava/test.js:28" (appears right after test name header)
|
|
174
|
+
const fileMatch = trimmed.match(/^([^:]+\.(?:js|ts|mjs|cjs)):(\d+)$/);
|
|
175
|
+
if (fileMatch && !failure.file) {
|
|
176
|
+
failure.file = fileMatch[1];
|
|
177
|
+
failure.line = parseInt(fileMatch[2], 10);
|
|
178
|
+
i++;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// Extract from file:// URL: "› file://tests/ava/test.js:28:5"
|
|
182
|
+
const urlMatch = trimmed.match(/^›\s+file:\/\/(.+?):(\d+):\d+$/);
|
|
183
|
+
if (urlMatch && !failure.file) {
|
|
184
|
+
failure.file = urlMatch[1];
|
|
185
|
+
failure.line = parseInt(urlMatch[2], 10);
|
|
186
|
+
i++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
// Code snippet marker (line numbers like " 28: code here")
|
|
190
|
+
if (trimmed.match(/^\d+:/)) {
|
|
191
|
+
foundCodeSnippet = true;
|
|
192
|
+
i++;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
// Error object start
|
|
196
|
+
if (trimmed.match(/^(?:TypeError|Error|.*Error)\s*\{$/)) {
|
|
197
|
+
inErrorObject = true;
|
|
198
|
+
i++;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
// Error object end
|
|
202
|
+
if (inErrorObject && trimmed === '}') {
|
|
203
|
+
inErrorObject = false;
|
|
204
|
+
i++;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
// Extract from error object properties
|
|
208
|
+
if (inErrorObject) {
|
|
209
|
+
// message property
|
|
210
|
+
const msgMatch = trimmed.match(/message:\s*'([^']+)'/);
|
|
211
|
+
if (msgMatch && !failure.message) {
|
|
212
|
+
failure.message = msgMatch[1];
|
|
213
|
+
}
|
|
214
|
+
// code property for error type detection
|
|
215
|
+
const codeMatch = trimmed.match(/code:\s*'([^']+)'/);
|
|
216
|
+
if (codeMatch) {
|
|
217
|
+
if (codeMatch[1] === 'ENOENT') {
|
|
218
|
+
failure.errorType = 'file-not-found';
|
|
219
|
+
}
|
|
220
|
+
else if (codeMatch[1] === 'ERR_MODULE_NOT_FOUND') {
|
|
221
|
+
failure.errorType = 'import-error';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
i++;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
// Extract error from Error: line (after error object)
|
|
228
|
+
const errorLineMatch = trimmed.match(/^(?:TypeError|Error|.*Error):\s+(.+)$/);
|
|
229
|
+
if (errorLineMatch && !inErrorObject) {
|
|
230
|
+
if (!failure.message) {
|
|
231
|
+
failure.message = errorLineMatch[1];
|
|
232
|
+
}
|
|
233
|
+
// Look for file in stack trace (next few lines)
|
|
234
|
+
if (!failure.file && i + 1 < lines.length) {
|
|
235
|
+
for (let j = i + 1; j < Math.min(i + 10, lines.length); j++) {
|
|
236
|
+
const stackLine = lines[j].trim();
|
|
237
|
+
// Match: at file:///path/to/file.js:110:24
|
|
238
|
+
// But skip node_modules and ava lib files
|
|
239
|
+
const stackMatch = stackLine.match(/at\s+(?:.*?\s+)?\(?file:\/\/([^:)]+):(\d+):\d+/);
|
|
240
|
+
if (stackMatch) {
|
|
241
|
+
const stackFile = stackMatch[1];
|
|
242
|
+
// Skip node_modules and ava library files
|
|
243
|
+
if (!stackFile.includes('node_modules') && !stackFile.includes('/ava/lib/')) {
|
|
244
|
+
failure.file = stackFile;
|
|
245
|
+
failure.line = parseInt(stackMatch[2], 10);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
i++;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
// Timeout marker
|
|
255
|
+
if (trimmed.includes('Test timeout exceeded')) {
|
|
256
|
+
if (!failure.message) {
|
|
257
|
+
failure.message = 'Test timeout exceeded';
|
|
258
|
+
}
|
|
259
|
+
failure.errorType = 'timeout';
|
|
260
|
+
i++;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
// Error markers
|
|
264
|
+
if (trimmed === 'Error thrown in test:' || trimmed === 'Rejected promise returned by test. Reason:') {
|
|
265
|
+
i++;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
// Detect assertion from Difference section
|
|
269
|
+
if (trimmed.startsWith('Difference') && trimmed.includes('actual') && trimmed.includes('expected')) {
|
|
270
|
+
if (!failure.message) {
|
|
271
|
+
failure.message = 'Assertion failed';
|
|
272
|
+
}
|
|
273
|
+
if (!failure.errorType) {
|
|
274
|
+
failure.errorType = 'assertion';
|
|
275
|
+
}
|
|
276
|
+
i++;
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
// Skip diff headers and diff lines
|
|
280
|
+
if (trimmed.startsWith('Difference') || trimmed.startsWith('Expected:') ||
|
|
281
|
+
trimmed.startsWith('Received:') || trimmed.match(/^[+-]\s/)) {
|
|
282
|
+
i++;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
// Assertion message (single line after code snippet, before Difference section)
|
|
286
|
+
if (foundCodeSnippet && !failure.message && trimmed.length > 0 && trimmed.length < 150 &&
|
|
287
|
+
!trimmed.match(/^\d+:/) && !trimmed.includes('Difference') &&
|
|
288
|
+
!trimmed.includes('{') && !trimmed.includes('}') &&
|
|
289
|
+
!trimmed.match(/^at\s+/) && !trimmed.includes('file://') &&
|
|
290
|
+
!trimmed.includes('.js:') && !trimmed.includes('.ts:')) {
|
|
291
|
+
failure.message = trimmed;
|
|
292
|
+
i++;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
i++;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Detect error type from message
|
|
300
|
+
*/
|
|
301
|
+
function detectErrorType(message) {
|
|
302
|
+
const lower = message.toLowerCase();
|
|
303
|
+
if (lower.includes('timeout') || lower.includes('timed out')) {
|
|
304
|
+
return 'timeout';
|
|
305
|
+
}
|
|
306
|
+
if (lower.includes('enoent') || lower.includes('no such file')) {
|
|
307
|
+
return 'file-not-found';
|
|
308
|
+
}
|
|
309
|
+
if (lower.includes('cannot read properties') || lower.includes('typeerror')) {
|
|
310
|
+
return 'type-error';
|
|
311
|
+
}
|
|
312
|
+
if (lower.includes('expected') || lower.includes('should') || lower.includes('difference')) {
|
|
313
|
+
return 'assertion';
|
|
314
|
+
}
|
|
315
|
+
if (lower.includes('cannot find module') || lower.includes('module not found')) {
|
|
316
|
+
return 'import-error';
|
|
317
|
+
}
|
|
318
|
+
return 'unknown';
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Get guidance for a specific error type
|
|
322
|
+
*/
|
|
323
|
+
function getErrorGuidance(errorType) {
|
|
324
|
+
const guidanceMap = {
|
|
325
|
+
assertion: 'Review the assertion logic and expected vs actual values',
|
|
326
|
+
timeout: 'Increase timeout limit with t.timeout() or optimize async operations',
|
|
327
|
+
'file-not-found': 'Verify file path exists and permissions are correct',
|
|
328
|
+
'type-error': 'Check for null/undefined values before accessing properties',
|
|
329
|
+
'import-error': 'Verify module path and ensure dependencies are installed'
|
|
330
|
+
};
|
|
331
|
+
return guidanceMap[errorType];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Generate overall guidance from all failures
|
|
335
|
+
*/
|
|
336
|
+
function generateGuidance(failures) {
|
|
337
|
+
if (failures.length === 0) {
|
|
338
|
+
return '';
|
|
339
|
+
}
|
|
340
|
+
const errorTypes = new Set(failures.map(f => f.errorType).filter(Boolean));
|
|
341
|
+
if (errorTypes.has('assertion')) {
|
|
342
|
+
return 'Review failing assertions - check expected vs actual values';
|
|
343
|
+
}
|
|
344
|
+
if (errorTypes.has('timeout')) {
|
|
345
|
+
return 'Tests are timing out - use t.timeout() to increase limit or optimize async operations';
|
|
346
|
+
}
|
|
347
|
+
if (errorTypes.has('type-error')) {
|
|
348
|
+
return 'Type errors detected - check for null/undefined values';
|
|
349
|
+
}
|
|
350
|
+
return 'Review test failures and fix the underlying issues';
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Format clean output for display
|
|
354
|
+
*/
|
|
355
|
+
function formatCleanOutput(errors) {
|
|
356
|
+
if (errors.length === 0) {
|
|
357
|
+
return '';
|
|
358
|
+
}
|
|
359
|
+
return errors
|
|
360
|
+
.map(e => {
|
|
361
|
+
const location = e.file && e.line ? `${e.file}:${e.line}` : e.file || 'unknown';
|
|
362
|
+
const context = e.context ? ` (${e.context})` : '';
|
|
363
|
+
return `${location}${context}: ${e.message}`;
|
|
364
|
+
})
|
|
365
|
+
.join('\n');
|
|
366
|
+
}
|
|
367
|
+
//# sourceMappingURL=ava-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ava-extractor.js","sourceRoot":"","sources":["../src/ava-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,gDAAgD;IAChD,2CAA2C;IAC3C,8DAA8D;IAC9D,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;YACL,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE;gBACR,UAAU,EAAE,GAAG;gBACf,YAAY,EAAE,GAAG;gBACjB,MAAM,EAAE,EAAE;aACX;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eScript (tsc)
|
|
8
8
|
* - ESLint
|
|
9
|
-
* - Vitest/Jest
|
|
9
|
+
* - Vitest/Jest/Mocha/Jasmine/TAP/Ava/Playwright
|
|
10
|
+
* - JUnit XML (auto-detected)
|
|
10
11
|
* - OpenAPI validators
|
|
11
12
|
* - Generic fallback
|
|
12
13
|
*
|
|
@@ -23,10 +24,17 @@
|
|
|
23
24
|
* @package @vibe-validate/extractors
|
|
24
25
|
* @version 0.1.0
|
|
25
26
|
*/
|
|
26
|
-
export type { FormattedError, ErrorExtractorResult, ErrorExtractor } from './types.js';
|
|
27
|
+
export type { FormattedError, ErrorExtractorResult, ErrorExtractor, ExtractionMetadata } from './types.js';
|
|
27
28
|
export { extractTypeScriptErrors } from './typescript-extractor.js';
|
|
28
29
|
export { extractESLintErrors } from './eslint-extractor.js';
|
|
29
30
|
export { extractVitestErrors } from './vitest-extractor.js';
|
|
31
|
+
export { extractJestErrors } from './jest-extractor.js';
|
|
32
|
+
export { extractJUnitErrors } from './junit-extractor.js';
|
|
33
|
+
export { extractMochaErrors } from './mocha-extractor.js';
|
|
34
|
+
export { extractJasmineErrors } from './jasmine-extractor.js';
|
|
35
|
+
export { extractTAPErrors } from './tap-extractor.js';
|
|
36
|
+
export { extractAvaErrors } from './ava-extractor.js';
|
|
37
|
+
export { extractPlaywrightErrors } from './playwright-extractor.js';
|
|
30
38
|
export { extractOpenAPIErrors } from './openapi-extractor.js';
|
|
31
39
|
export { extractGenericErrors } from './generic-extractor.js';
|
|
32
40
|
export { extractByStepName } from './smart-extractor.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Provides intelligent error parsing and formatting for common development tools:
|
|
7
7
|
* - TypeScript (tsc)
|
|
8
8
|
* - ESLint
|
|
9
|
-
* - Vitest/Jest
|
|
9
|
+
* - Vitest/Jest/Mocha/Jasmine/TAP/Ava/Playwright
|
|
10
|
+
* - JUnit XML (auto-detected)
|
|
10
11
|
* - OpenAPI validators
|
|
11
12
|
* - Generic fallback
|
|
12
13
|
*
|
|
@@ -27,6 +28,13 @@
|
|
|
27
28
|
export { extractTypeScriptErrors } from './typescript-extractor.js';
|
|
28
29
|
export { extractESLintErrors } from './eslint-extractor.js';
|
|
29
30
|
export { extractVitestErrors } from './vitest-extractor.js';
|
|
31
|
+
export { extractJestErrors } from './jest-extractor.js';
|
|
32
|
+
export { extractJUnitErrors } from './junit-extractor.js';
|
|
33
|
+
export { extractMochaErrors } from './mocha-extractor.js';
|
|
34
|
+
export { extractJasmineErrors } from './jasmine-extractor.js';
|
|
35
|
+
export { extractTAPErrors } from './tap-extractor.js';
|
|
36
|
+
export { extractAvaErrors } from './ava-extractor.js';
|
|
37
|
+
export { extractPlaywrightErrors } from './playwright-extractor.js';
|
|
30
38
|
export { extractOpenAPIErrors } from './openapi-extractor.js';
|
|
31
39
|
export { extractGenericErrors } from './generic-extractor.js';
|
|
32
40
|
// Smart extractor (auto-detection - recommended)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAUH,yCAAyC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,iDAAiD;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jasmine-extractor.d.ts","sourceRoot":"","sources":["../src/jasmine-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAsC,MAAM,YAAY,CAAC;AAG3F;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAsFzE"}
|