@vibe-validate/extractors 0.16.0 → 0.17.0-rc.5
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 +104 -0
- package/dist/extractor-registry.d.ts.map +1 -0
- package/dist/extractor-registry.js +278 -0
- package/dist/extractor-registry.js.map +1 -0
- package/dist/extractors/ava/index.d.ts +23 -0
- package/dist/extractors/ava/index.d.ts.map +1 -0
- package/dist/extractors/ava/index.js +507 -0
- package/dist/extractors/ava/index.js.map +1 -0
- package/dist/extractors/ava/index.test.d.ts +7 -0
- package/dist/extractors/ava/index.test.d.ts.map +1 -0
- package/dist/extractors/ava/index.test.js +408 -0
- package/dist/extractors/ava/index.test.js.map +1 -0
- package/dist/extractors/eslint/index.d.ts +18 -0
- package/dist/extractors/eslint/index.d.ts.map +1 -0
- package/dist/extractors/eslint/index.js +206 -0
- package/dist/extractors/eslint/index.js.map +1 -0
- package/dist/extractors/eslint/index.test.d.ts +9 -0
- package/dist/extractors/eslint/index.test.d.ts.map +1 -0
- package/dist/extractors/eslint/index.test.js +191 -0
- package/dist/extractors/eslint/index.test.js.map +1 -0
- package/dist/extractors/generic/index.d.ts +30 -0
- package/dist/extractors/generic/index.d.ts.map +1 -0
- package/dist/extractors/generic/index.js +140 -0
- package/dist/extractors/generic/index.js.map +1 -0
- package/dist/extractors/generic/index.test.d.ts +7 -0
- package/dist/extractors/generic/index.test.d.ts.map +1 -0
- package/dist/extractors/generic/index.test.js +61 -0
- package/dist/extractors/generic/index.test.js.map +1 -0
- package/dist/extractors/jasmine/index.d.ts +17 -0
- package/dist/extractors/jasmine/index.d.ts.map +1 -0
- package/dist/extractors/jasmine/index.js +242 -0
- package/dist/extractors/jasmine/index.js.map +1 -0
- package/dist/extractors/jasmine/index.test.d.ts +7 -0
- package/dist/extractors/jasmine/index.test.d.ts.map +1 -0
- package/dist/extractors/jasmine/index.test.js +318 -0
- package/dist/extractors/jasmine/index.test.js.map +1 -0
- package/dist/extractors/jest/index.d.ts +17 -0
- package/dist/extractors/jest/index.d.ts.map +1 -0
- package/dist/extractors/jest/index.js +273 -0
- package/dist/extractors/jest/index.js.map +1 -0
- package/dist/extractors/jest/index.test.d.ts +9 -0
- package/dist/extractors/jest/index.test.d.ts.map +1 -0
- package/dist/extractors/jest/index.test.js +338 -0
- package/dist/extractors/jest/index.test.js.map +1 -0
- package/dist/extractors/junit/index.d.ts +18 -0
- package/dist/extractors/junit/index.d.ts.map +1 -0
- package/dist/extractors/junit/index.js +259 -0
- package/dist/extractors/junit/index.js.map +1 -0
- package/dist/extractors/junit/index.test.d.ts +7 -0
- package/dist/extractors/junit/index.test.d.ts.map +1 -0
- package/dist/extractors/junit/index.test.js +341 -0
- package/dist/extractors/junit/index.test.js.map +1 -0
- package/dist/extractors/maven-checkstyle/index.d.ts +23 -0
- package/dist/extractors/maven-checkstyle/index.d.ts.map +1 -0
- package/dist/extractors/maven-checkstyle/index.js +263 -0
- package/dist/extractors/maven-checkstyle/index.js.map +1 -0
- package/dist/extractors/maven-checkstyle/index.test.d.ts +2 -0
- package/dist/extractors/maven-checkstyle/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-checkstyle/index.test.js +197 -0
- package/dist/extractors/maven-checkstyle/index.test.js.map +1 -0
- package/dist/extractors/maven-compiler/index.d.ts +23 -0
- package/dist/extractors/maven-compiler/index.d.ts.map +1 -0
- package/dist/extractors/maven-compiler/index.js +271 -0
- package/dist/extractors/maven-compiler/index.js.map +1 -0
- package/dist/extractors/maven-compiler/index.test.d.ts +2 -0
- package/dist/extractors/maven-compiler/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-compiler/index.test.js +189 -0
- package/dist/extractors/maven-compiler/index.test.js.map +1 -0
- package/dist/extractors/maven-surefire/index.d.ts +23 -0
- package/dist/extractors/maven-surefire/index.d.ts.map +1 -0
- package/dist/extractors/maven-surefire/index.js +292 -0
- package/dist/extractors/maven-surefire/index.js.map +1 -0
- package/dist/extractors/maven-surefire/index.test.d.ts +2 -0
- package/dist/extractors/maven-surefire/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-surefire/index.test.js +163 -0
- package/dist/extractors/maven-surefire/index.test.js.map +1 -0
- package/dist/extractors/mocha/index.d.ts +17 -0
- package/dist/extractors/mocha/index.d.ts.map +1 -0
- package/dist/extractors/mocha/index.js +241 -0
- package/dist/extractors/mocha/index.js.map +1 -0
- package/dist/extractors/mocha/index.test.d.ts +7 -0
- package/dist/extractors/mocha/index.test.d.ts.map +1 -0
- package/dist/extractors/mocha/index.test.js +300 -0
- package/dist/extractors/mocha/index.test.js.map +1 -0
- package/dist/extractors/playwright/index.d.ts +17 -0
- package/dist/extractors/playwright/index.d.ts.map +1 -0
- package/dist/extractors/playwright/index.js +320 -0
- package/dist/extractors/playwright/index.js.map +1 -0
- package/dist/extractors/playwright/index.test.d.ts +7 -0
- package/dist/extractors/playwright/index.test.d.ts.map +1 -0
- package/dist/extractors/playwright/index.test.js +274 -0
- package/dist/extractors/playwright/index.test.js.map +1 -0
- package/dist/extractors/tap/index.d.ts +23 -0
- package/dist/extractors/tap/index.d.ts.map +1 -0
- package/dist/extractors/tap/index.js +352 -0
- package/dist/extractors/tap/index.js.map +1 -0
- package/dist/extractors/tap/index.test.d.ts +7 -0
- package/dist/extractors/tap/index.test.d.ts.map +1 -0
- package/dist/extractors/tap/index.test.js +100 -0
- package/dist/extractors/tap/index.test.js.map +1 -0
- package/dist/extractors/typescript/index.d.ts +17 -0
- package/dist/extractors/typescript/index.d.ts.map +1 -0
- package/dist/extractors/typescript/index.js +150 -0
- package/dist/extractors/typescript/index.js.map +1 -0
- package/dist/extractors/typescript/index.test.d.ts +9 -0
- package/dist/extractors/typescript/index.test.d.ts.map +1 -0
- package/dist/extractors/typescript/index.test.js +177 -0
- package/dist/extractors/typescript/index.test.js.map +1 -0
- package/dist/extractors/vitest/index.d.ts +17 -0
- package/dist/extractors/vitest/index.d.ts.map +1 -0
- package/dist/extractors/vitest/index.js +564 -0
- package/dist/extractors/vitest/index.js.map +1 -0
- package/dist/extractors/vitest/index.test.d.ts +9 -0
- package/dist/extractors/vitest/index.test.d.ts.map +1 -0
- package/dist/extractors/vitest/index.test.js +373 -0
- package/dist/extractors/vitest/index.test.js.map +1 -0
- package/dist/index.d.ts +27 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/maven-checkstyle-extractor.d.ts +20 -0
- package/dist/maven-checkstyle-extractor.d.ts.map +1 -0
- package/dist/maven-checkstyle-extractor.js +193 -0
- package/dist/maven-checkstyle-extractor.js.map +1 -0
- package/dist/maven-compiler-extractor.d.ts +20 -0
- package/dist/maven-compiler-extractor.d.ts.map +1 -0
- package/dist/maven-compiler-extractor.js +218 -0
- package/dist/maven-compiler-extractor.js.map +1 -0
- package/dist/maven-surefire-extractor.d.ts +20 -0
- package/dist/maven-surefire-extractor.d.ts.map +1 -0
- package/dist/maven-surefire-extractor.js +228 -0
- package/dist/maven-surefire-extractor.js.map +1 -0
- package/dist/maven-utils.d.ts +24 -0
- package/dist/maven-utils.d.ts.map +1 -0
- package/dist/maven-utils.js +36 -0
- package/dist/maven-utils.js.map +1 -0
- package/dist/plugin-loader.d.ts +82 -0
- package/dist/plugin-loader.d.ts.map +1 -0
- package/dist/plugin-loader.js +200 -0
- package/dist/plugin-loader.js.map +1 -0
- package/dist/sandbox.d.ts +161 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +254 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/sandbox.test.d.ts +8 -0
- package/dist/sandbox.test.d.ts.map +1 -0
- package/dist/sandbox.test.js +395 -0
- package/dist/sandbox.test.js.map +1 -0
- package/dist/sandboxed-extractor.d.ts +46 -0
- package/dist/sandboxed-extractor.d.ts.map +1 -0
- package/dist/sandboxed-extractor.js +172 -0
- package/dist/sandboxed-extractor.js.map +1 -0
- package/dist/sandboxed-extractor.test.d.ts +5 -0
- package/dist/sandboxed-extractor.test.d.ts.map +1 -0
- package/dist/sandboxed-extractor.test.js +346 -0
- package/dist/sandboxed-extractor.test.js.map +1 -0
- package/dist/smart-extractor.d.ts +22 -10
- package/dist/smart-extractor.d.ts.map +1 -1
- package/dist/smart-extractor.js +116 -163
- package/dist/smart-extractor.js.map +1 -1
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mocha Error Extractor Plugin
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats Mocha test output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import { processTestFailures } from '../../utils/test-framework-utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* Extract failure information from Mocha output
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 30 acceptable for Mocha output parsing (handles test hierarchies, error messages, and stack trace extraction)
|
|
13
|
+
function extractFailures(output) {
|
|
14
|
+
const failures = [];
|
|
15
|
+
const lines = output.split('\n');
|
|
16
|
+
let i = 0;
|
|
17
|
+
while (i < lines.length) {
|
|
18
|
+
const line = lines[i];
|
|
19
|
+
// Look for numbered failure markers (e.g., " 1) ")
|
|
20
|
+
// Only match detailed format (2 spaces), not summary format (6+ spaces)
|
|
21
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Mocha test framework output (controlled output), not user input
|
|
22
|
+
const failureMatch = /^ {2}(\d+)\)\s+(.*)$/.exec(line);
|
|
23
|
+
if (failureMatch) {
|
|
24
|
+
// failureMatch[1] contains the failure number (not used - test name is more important)
|
|
25
|
+
const firstPart = failureMatch[2].trim();
|
|
26
|
+
// Collect test hierarchy lines
|
|
27
|
+
const testNameParts = [];
|
|
28
|
+
// Check if first part ends with colon (simple format: "1) Test:")
|
|
29
|
+
const isSimpleFormat = firstPart.endsWith(':');
|
|
30
|
+
if (firstPart) {
|
|
31
|
+
testNameParts.push(firstPart.replace(/:$/, '')); // Remove trailing colon
|
|
32
|
+
}
|
|
33
|
+
let j = i + 1;
|
|
34
|
+
// If simple format, don't try to collect more hierarchy
|
|
35
|
+
if (!isSimpleFormat) {
|
|
36
|
+
// Continue collecting hierarchy lines until we hit blank line or error
|
|
37
|
+
while (j < lines.length) {
|
|
38
|
+
const nextLine = lines[j];
|
|
39
|
+
// Blank line marks end of hierarchy
|
|
40
|
+
if (nextLine.trim() === '') {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
// Error line marks end of hierarchy
|
|
44
|
+
if (/^\s+(Error|AssertionError|TypeError)/.exec(nextLine)) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
// Indented lines are part of hierarchy (at least 5 spaces for Mocha)
|
|
48
|
+
if (/^\s{5,}\S/.exec(nextLine)) {
|
|
49
|
+
const part = nextLine.trim().replace(/:$/, ''); // Remove trailing colon
|
|
50
|
+
testNameParts.push(part);
|
|
51
|
+
}
|
|
52
|
+
j++;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const testName = testNameParts.join(' > ');
|
|
56
|
+
// Now scan for error message and stack trace
|
|
57
|
+
let message;
|
|
58
|
+
let errorType;
|
|
59
|
+
let file;
|
|
60
|
+
let lineNumber;
|
|
61
|
+
// Continue from where we left off
|
|
62
|
+
while (j < lines.length && j < i + 40) {
|
|
63
|
+
const nextLine = lines[j];
|
|
64
|
+
// Stop if we hit the next failure
|
|
65
|
+
if (/^\s+\d+\)\s+/.exec(nextLine)) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
// Extract error type and message
|
|
69
|
+
// Pattern 1: " AssertionError [ERR_ASSERTION]: Expected..."
|
|
70
|
+
// Pattern 2: " Error: ENOENT: no such file..."
|
|
71
|
+
// Pattern 3: " TypeError: Cannot read..."
|
|
72
|
+
if (!message) {
|
|
73
|
+
// Match plain "Error" or prefixed errors like "TypeError", "AssertionError"
|
|
74
|
+
const errorMatch = /^\s+([A-Za-z]*Error)(?:\s\[\w+\])?\s*:\s*(.+)/.exec(nextLine);
|
|
75
|
+
if (errorMatch) {
|
|
76
|
+
errorType = errorMatch[1];
|
|
77
|
+
message = errorMatch[2].trim();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Extract file location from stack trace
|
|
81
|
+
if (!file && nextLine.includes('at Context.<anonymous>')) {
|
|
82
|
+
// Match various path formats:
|
|
83
|
+
// - file:///path/to/file.js:10:20
|
|
84
|
+
// - /absolute/path/file.js:10:20
|
|
85
|
+
// - relative/path/file.js:10:20
|
|
86
|
+
const locationMatch = /at Context\.<anonymous> \((?:file:\/\/)?([^:)]+):(\d+)(?::(\d+))?\)/.exec(nextLine);
|
|
87
|
+
if (locationMatch) {
|
|
88
|
+
file = locationMatch[1];
|
|
89
|
+
lineNumber = Number.parseInt(locationMatch[2], 10);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Extract file from timeout error messages: "Error: Timeout... (/path/to/file.js)"
|
|
93
|
+
if (!file && message?.includes('Timeout')) {
|
|
94
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Mocha test framework timeout messages (controlled output), not user input
|
|
95
|
+
const timeoutFileMatch = /\(([^)]+\.(?:js|ts|mjs|cjs))\)/.exec(message);
|
|
96
|
+
if (timeoutFileMatch) {
|
|
97
|
+
file = timeoutFileMatch[1];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
j++;
|
|
101
|
+
}
|
|
102
|
+
failures.push({
|
|
103
|
+
testName,
|
|
104
|
+
message,
|
|
105
|
+
errorType,
|
|
106
|
+
file,
|
|
107
|
+
line: lineNumber
|
|
108
|
+
});
|
|
109
|
+
i = j; // Skip to after this failure
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
i++;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return failures;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Extract errors from Mocha test output
|
|
119
|
+
*
|
|
120
|
+
* @param output - Mocha text output
|
|
121
|
+
* @returns Structured error information
|
|
122
|
+
*/
|
|
123
|
+
function extract(output) {
|
|
124
|
+
// Check if this looks like Mocha output
|
|
125
|
+
if (!output.includes('failing') && !output.includes('passing')) {
|
|
126
|
+
return {
|
|
127
|
+
summary: 'Unable to parse Mocha output - invalid format',
|
|
128
|
+
errors: [],
|
|
129
|
+
totalErrors: 0,
|
|
130
|
+
errorSummary: output.trim(),
|
|
131
|
+
guidance: 'Ensure the input is valid Mocha test output',
|
|
132
|
+
metadata: {
|
|
133
|
+
confidence: 0,
|
|
134
|
+
completeness: 0,
|
|
135
|
+
issues: ['Not Mocha output format']
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Extract failure count
|
|
140
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Mocha test framework summary (controlled output), not user input
|
|
141
|
+
const failingMatch = /(\d+) failing/.exec(output);
|
|
142
|
+
const failureCount = failingMatch ? Number.parseInt(failingMatch[1], 10) : 0;
|
|
143
|
+
// Extract all failures
|
|
144
|
+
const failures = extractFailures(output);
|
|
145
|
+
// Early return if no failures detected (but failure count suggested there should be)
|
|
146
|
+
if (failureCount === 0 && failures.length === 0) {
|
|
147
|
+
return processTestFailures([], 95);
|
|
148
|
+
}
|
|
149
|
+
// Process failures using shared utility
|
|
150
|
+
return processTestFailures(failures, 95);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Detect if output is from Mocha test framework
|
|
154
|
+
*
|
|
155
|
+
* @param output - Command output to analyze
|
|
156
|
+
* @returns Detection result with confidence and patterns
|
|
157
|
+
*/
|
|
158
|
+
function detect(output) {
|
|
159
|
+
if (output.includes('failing') || output.includes('passing')) {
|
|
160
|
+
return {
|
|
161
|
+
confidence: 85,
|
|
162
|
+
patterns: ['failing/passing pattern'],
|
|
163
|
+
reason: 'Mocha test framework output detected',
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return { confidence: 0, patterns: [], reason: '' };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Sample test cases for Mocha extractor
|
|
170
|
+
*/
|
|
171
|
+
const samples = [
|
|
172
|
+
{
|
|
173
|
+
name: 'single-assertion-error',
|
|
174
|
+
description: 'Single Mocha test failure with AssertionError',
|
|
175
|
+
input: `
|
|
176
|
+
Vibe-Validate Mocha Test Matrix
|
|
177
|
+
Failure Type 1: Assertion Errors
|
|
178
|
+
1) should match expected value
|
|
179
|
+
|
|
180
|
+
0 passing (10ms)
|
|
181
|
+
1 failing
|
|
182
|
+
|
|
183
|
+
1) Vibe-Validate Mocha Test Matrix
|
|
184
|
+
Failure Type 1: Assertion Errors
|
|
185
|
+
should match expected value:
|
|
186
|
+
|
|
187
|
+
AssertionError [ERR_ASSERTION]: Expected 4 to equal 5
|
|
188
|
+
at Context.<anonymous> (file:///tmp/test.js:16:14)
|
|
189
|
+
`,
|
|
190
|
+
expectedErrors: 1,
|
|
191
|
+
expectedPatterns: ['AssertionError', 'Expected 4 to equal 5'],
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'multiple-test-failures',
|
|
195
|
+
description: 'Multiple Mocha test failures with different error types',
|
|
196
|
+
input: `
|
|
197
|
+
0 passing (20ms)
|
|
198
|
+
3 failing
|
|
199
|
+
|
|
200
|
+
1) Suite > Test 1:
|
|
201
|
+
Error: First error
|
|
202
|
+
at Context.<anonymous> (test.js:10:15)
|
|
203
|
+
|
|
204
|
+
2) Suite > Test 2:
|
|
205
|
+
TypeError: Cannot read properties of null
|
|
206
|
+
at Context.<anonymous> (test.js:20:15)
|
|
207
|
+
|
|
208
|
+
3) Suite > Test 3:
|
|
209
|
+
AssertionError: Values not equal
|
|
210
|
+
at Context.<anonymous> (test.js:30:15)
|
|
211
|
+
`,
|
|
212
|
+
expectedErrors: 3,
|
|
213
|
+
expectedPatterns: ['First error', 'TypeError', 'AssertionError'],
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
/**
|
|
217
|
+
* Mocha Error Extractor Plugin
|
|
218
|
+
*
|
|
219
|
+
* Extracts Mocha test framework errors with 85% confidence.
|
|
220
|
+
* Parses test hierarchies, error types, and stack traces.
|
|
221
|
+
*/
|
|
222
|
+
const mochaPlugin = {
|
|
223
|
+
metadata: {
|
|
224
|
+
name: 'mocha',
|
|
225
|
+
version: '1.0.0',
|
|
226
|
+
author: 'vibe-validate',
|
|
227
|
+
description: 'Extracts Mocha test framework errors',
|
|
228
|
+
repository: 'https://github.com/jdutton/vibe-validate',
|
|
229
|
+
tags: ['mocha', 'testing', 'javascript'],
|
|
230
|
+
},
|
|
231
|
+
hints: {
|
|
232
|
+
required: ['failing'],
|
|
233
|
+
anyOf: ['passing'],
|
|
234
|
+
},
|
|
235
|
+
priority: 85,
|
|
236
|
+
detect,
|
|
237
|
+
extract,
|
|
238
|
+
samples,
|
|
239
|
+
};
|
|
240
|
+
export default mochaPlugin;
|
|
241
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/mocha/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,qCAAqC,CAAC;AAEhG;;GAEG;AACH,oLAAoL;AACpL,SAAS,eAAe,CAAC,MAAc;IACrC,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,oDAAoD;QACpD,wEAAwE;QACxE,mIAAmI;QACnI,MAAM,YAAY,GAAG,sBAAsB,CAAC,IAA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E,OAAO;QACb,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,eAAe;QACvB,WAAW,EAAE,sCAAsC;QACnD,UAAU,EAAE,0CAA0C;QACtD,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC;KACzC;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,KAAK,EAAE,CAAC,SAAS,CAAC;KACnB;IACD,QAAQ,EAAE,EAAE;IACZ,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/extractors/mocha/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mocha Error Extractor Plugin Tests
|
|
3
|
+
*
|
|
4
|
+
* @package @vibe-validate/extractors
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
import mochaPlugin from './index.js';
|
|
8
|
+
describe('mocha extractor plugin', () => {
|
|
9
|
+
describe('detect', () => {
|
|
10
|
+
it('should detect Mocha output with failing tests', () => {
|
|
11
|
+
const output = `
|
|
12
|
+
1 failing
|
|
13
|
+
5 passing
|
|
14
|
+
`;
|
|
15
|
+
const result = mochaPlugin.detect(output);
|
|
16
|
+
expect(result.confidence).toBe(85);
|
|
17
|
+
expect(result.reason).toContain('Mocha');
|
|
18
|
+
});
|
|
19
|
+
it('should detect Mocha output with only passing tests', () => {
|
|
20
|
+
const output = `
|
|
21
|
+
0 failing
|
|
22
|
+
10 passing
|
|
23
|
+
`;
|
|
24
|
+
const result = mochaPlugin.detect(output);
|
|
25
|
+
expect(result.confidence).toBe(85);
|
|
26
|
+
});
|
|
27
|
+
it('should not detect non-Mocha output', () => {
|
|
28
|
+
const output = 'Some random text without Mocha patterns';
|
|
29
|
+
const result = mochaPlugin.detect(output);
|
|
30
|
+
expect(result.confidence).toBe(0);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('extract', () => {
|
|
34
|
+
describe('Basic Extraction', () => {
|
|
35
|
+
it('should extract single test failure from Mocha output', () => {
|
|
36
|
+
const input = `
|
|
37
|
+
Vibe-Validate Mocha Test Matrix
|
|
38
|
+
Failure Type 1: Assertion Errors
|
|
39
|
+
1) should match expected value
|
|
40
|
+
|
|
41
|
+
0 passing (10ms)
|
|
42
|
+
1 failing
|
|
43
|
+
|
|
44
|
+
1) Vibe-Validate Mocha Test Matrix
|
|
45
|
+
Failure Type 1: Assertion Errors
|
|
46
|
+
should match expected value:
|
|
47
|
+
|
|
48
|
+
AssertionError [ERR_ASSERTION]: Expected 4 to equal 5
|
|
49
|
+
at Context.<anonymous> (file:///tmp/test.js:16:14)
|
|
50
|
+
`;
|
|
51
|
+
const result = mochaPlugin.extract(input);
|
|
52
|
+
expect(result.summary).toBe('1 test(s) failed');
|
|
53
|
+
expect(result.errors).toHaveLength(1);
|
|
54
|
+
expect(result.errors[0]).toMatchObject({
|
|
55
|
+
// eslint-disable-next-line sonarjs/publicly-writable-directories -- Test fixture path, not actual file operation
|
|
56
|
+
file: '/tmp/test.js',
|
|
57
|
+
line: 16,
|
|
58
|
+
message: 'Expected 4 to equal 5'
|
|
59
|
+
});
|
|
60
|
+
expect(result.errors[0].context).toContain('should match expected value');
|
|
61
|
+
});
|
|
62
|
+
it('should extract multiple test failures', () => {
|
|
63
|
+
const input = `
|
|
64
|
+
0 passing (20ms)
|
|
65
|
+
3 failing
|
|
66
|
+
|
|
67
|
+
1) Suite > Test 1:
|
|
68
|
+
Error: First error
|
|
69
|
+
at Context.<anonymous> (test.js:10:15)
|
|
70
|
+
|
|
71
|
+
2) Suite > Test 2:
|
|
72
|
+
Error: Second error
|
|
73
|
+
at Context.<anonymous> (test.js:20:15)
|
|
74
|
+
|
|
75
|
+
3) Suite > Test 3:
|
|
76
|
+
Error: Third error
|
|
77
|
+
at Context.<anonymous> (test.js:30:15)
|
|
78
|
+
`;
|
|
79
|
+
const result = mochaPlugin.extract(input);
|
|
80
|
+
expect(result.summary).toBe('3 test(s) failed');
|
|
81
|
+
expect(result.errors).toHaveLength(3);
|
|
82
|
+
expect(result.errors[0].line).toBe(10);
|
|
83
|
+
expect(result.errors[1].line).toBe(20);
|
|
84
|
+
expect(result.errors[2].line).toBe(30);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe('Error Type Detection', () => {
|
|
88
|
+
it('should detect AssertionError', () => {
|
|
89
|
+
const input = `
|
|
90
|
+
1 failing
|
|
91
|
+
|
|
92
|
+
1) Test:
|
|
93
|
+
AssertionError [ERR_ASSERTION]: Values not equal
|
|
94
|
+
at Context.<anonymous> (test.js:10:14)
|
|
95
|
+
`;
|
|
96
|
+
const result = mochaPlugin.extract(input);
|
|
97
|
+
expect(result.errors[0].message).toContain('Values not equal');
|
|
98
|
+
});
|
|
99
|
+
it('should detect TypeError', () => {
|
|
100
|
+
const input = `
|
|
101
|
+
1 failing
|
|
102
|
+
|
|
103
|
+
1) Test:
|
|
104
|
+
TypeError: Cannot read properties of null (reading 'foo')
|
|
105
|
+
at Context.<anonymous> (test.js:15:20)
|
|
106
|
+
`;
|
|
107
|
+
const result = mochaPlugin.extract(input);
|
|
108
|
+
expect(result.errors[0].message).toContain('Cannot read properties of null');
|
|
109
|
+
});
|
|
110
|
+
it('should detect ENOENT errors', () => {
|
|
111
|
+
const input = `
|
|
112
|
+
1 failing
|
|
113
|
+
|
|
114
|
+
1) Test:
|
|
115
|
+
Error: ENOENT: no such file or directory
|
|
116
|
+
at Context.<anonymous> (test.js:20:10)
|
|
117
|
+
`;
|
|
118
|
+
const result = mochaPlugin.extract(input);
|
|
119
|
+
expect(result.errors[0].message).toContain('ENOENT');
|
|
120
|
+
});
|
|
121
|
+
it('should detect timeout errors', () => {
|
|
122
|
+
const input = `
|
|
123
|
+
1 failing
|
|
124
|
+
|
|
125
|
+
1) Test:
|
|
126
|
+
Error: Timeout of 100ms exceeded
|
|
127
|
+
at listOnTimeout (node:internal/timers:608:17)
|
|
128
|
+
`;
|
|
129
|
+
const result = mochaPlugin.extract(input);
|
|
130
|
+
expect(result.errors[0].message).toContain('Timeout');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
describe('Location Extraction', () => {
|
|
134
|
+
it('should extract file:line:column format', () => {
|
|
135
|
+
const input = `
|
|
136
|
+
1 failing
|
|
137
|
+
|
|
138
|
+
1) Test:
|
|
139
|
+
Error: Test error
|
|
140
|
+
at Context.<anonymous> (file:///path/to/test.js:42:15)
|
|
141
|
+
`;
|
|
142
|
+
const result = mochaPlugin.extract(input);
|
|
143
|
+
expect(result.errors[0].file).toBe('/path/to/test.js');
|
|
144
|
+
expect(result.errors[0].line).toBe(42);
|
|
145
|
+
});
|
|
146
|
+
it('should handle relative paths', () => {
|
|
147
|
+
const input = `
|
|
148
|
+
1 failing
|
|
149
|
+
|
|
150
|
+
1) Test:
|
|
151
|
+
Error: Test error
|
|
152
|
+
at Context.<anonymous> (tests/unit/helpers.test.js:128:30)
|
|
153
|
+
`;
|
|
154
|
+
const result = mochaPlugin.extract(input);
|
|
155
|
+
expect(result.errors[0].file).toBe('tests/unit/helpers.test.js');
|
|
156
|
+
expect(result.errors[0].line).toBe(128);
|
|
157
|
+
});
|
|
158
|
+
it('should handle absolute paths without file:// prefix', () => {
|
|
159
|
+
const input = `
|
|
160
|
+
1 failing
|
|
161
|
+
|
|
162
|
+
1) Test:
|
|
163
|
+
Error: Test error
|
|
164
|
+
at Context.<anonymous> (/Users/jeff/project/test.js:50:10)
|
|
165
|
+
`;
|
|
166
|
+
const result = mochaPlugin.extract(input);
|
|
167
|
+
expect(result.errors[0].file).toBe('/Users/jeff/project/test.js');
|
|
168
|
+
expect(result.errors[0].line).toBe(50);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('Test Hierarchy', () => {
|
|
172
|
+
it('should preserve test hierarchy in context', () => {
|
|
173
|
+
const input = `
|
|
174
|
+
1 failing
|
|
175
|
+
|
|
176
|
+
1) Outer Suite
|
|
177
|
+
Inner Suite
|
|
178
|
+
Deep Suite
|
|
179
|
+
should do something:
|
|
180
|
+
Error: Test error
|
|
181
|
+
at Context.<anonymous> (test.js:10:20)
|
|
182
|
+
`;
|
|
183
|
+
const result = mochaPlugin.extract(input);
|
|
184
|
+
expect(result.errors[0].context).toContain('Outer Suite');
|
|
185
|
+
expect(result.errors[0].context).toContain('should do something');
|
|
186
|
+
});
|
|
187
|
+
it('should handle deeply nested describe blocks', () => {
|
|
188
|
+
const input = `
|
|
189
|
+
1 failing
|
|
190
|
+
|
|
191
|
+
1) Level 1
|
|
192
|
+
Level 2
|
|
193
|
+
Level 3
|
|
194
|
+
should work at deep nesting:
|
|
195
|
+
AssertionError: Deep failure
|
|
196
|
+
at Context.<anonymous> (test.js:100:15)
|
|
197
|
+
`;
|
|
198
|
+
const result = mochaPlugin.extract(input);
|
|
199
|
+
expect(result.errors[0].context).toContain('Level 3');
|
|
200
|
+
expect(result.errors[0].context).toContain('should work at deep nesting');
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
describe('Edge Cases', () => {
|
|
204
|
+
it('should handle output with no failures', () => {
|
|
205
|
+
const input = `
|
|
206
|
+
5 passing (20ms)
|
|
207
|
+
0 failing
|
|
208
|
+
`;
|
|
209
|
+
const result = mochaPlugin.extract(input);
|
|
210
|
+
expect(result.summary).toBe('0 test(s) failed');
|
|
211
|
+
expect(result.errors).toHaveLength(0);
|
|
212
|
+
});
|
|
213
|
+
it('should handle missing stack trace', () => {
|
|
214
|
+
const input = `
|
|
215
|
+
1 failing
|
|
216
|
+
|
|
217
|
+
1) Test:
|
|
218
|
+
Error: Something went wrong
|
|
219
|
+
`;
|
|
220
|
+
const result = mochaPlugin.extract(input);
|
|
221
|
+
expect(result.errors[0].message).toContain('Something went wrong');
|
|
222
|
+
// Should still extract even without file/line
|
|
223
|
+
});
|
|
224
|
+
it('should handle malformed output gracefully', () => {
|
|
225
|
+
const input = 'Not valid Mocha output';
|
|
226
|
+
const result = mochaPlugin.extract(input);
|
|
227
|
+
expect(result.summary).toContain('Unable to parse');
|
|
228
|
+
expect(result.errors).toHaveLength(0);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
describe('Guidance Generation', () => {
|
|
232
|
+
it('should provide assertion error guidance', () => {
|
|
233
|
+
const input = `
|
|
234
|
+
1 failing
|
|
235
|
+
|
|
236
|
+
1) Test:
|
|
237
|
+
AssertionError: Expected values to be equal
|
|
238
|
+
at Context.<anonymous> (test.js:10:14)
|
|
239
|
+
`;
|
|
240
|
+
const result = mochaPlugin.extract(input);
|
|
241
|
+
expect(result.guidance).toContain('assertion');
|
|
242
|
+
});
|
|
243
|
+
it('should provide timeout guidance', () => {
|
|
244
|
+
const input = `
|
|
245
|
+
1 failing
|
|
246
|
+
|
|
247
|
+
1) Test:
|
|
248
|
+
Error: Timeout of 100ms exceeded
|
|
249
|
+
at listOnTimeout (node:internal/timers:608:17)
|
|
250
|
+
`;
|
|
251
|
+
const result = mochaPlugin.extract(input);
|
|
252
|
+
expect(result.guidance).toContain('timeout');
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
describe('Quality Metadata', () => {
|
|
256
|
+
it('should include extraction metadata', () => {
|
|
257
|
+
const input = `
|
|
258
|
+
1 failing
|
|
259
|
+
|
|
260
|
+
1) Test:
|
|
261
|
+
Error: Test error
|
|
262
|
+
at Context.<anonymous> (test.js:10:20)
|
|
263
|
+
`;
|
|
264
|
+
const result = mochaPlugin.extract(input);
|
|
265
|
+
expect(result.metadata).toBeDefined();
|
|
266
|
+
expect(result.metadata?.confidence).toBeGreaterThan(0);
|
|
267
|
+
expect(result.metadata?.completeness).toBeGreaterThan(0);
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
describe('samples', () => {
|
|
272
|
+
it('should have at least 2 sample test cases', () => {
|
|
273
|
+
expect(mochaPlugin.samples).toBeDefined();
|
|
274
|
+
expect(mochaPlugin.samples.length).toBeGreaterThanOrEqual(2);
|
|
275
|
+
});
|
|
276
|
+
it('should successfully parse all sample inputs', () => {
|
|
277
|
+
for (const sample of mochaPlugin.samples) {
|
|
278
|
+
const result = mochaPlugin.extract(sample.input);
|
|
279
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
280
|
+
expect(result.errors.length).toBe(sample.expectedErrors);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
describe('metadata', () => {
|
|
285
|
+
it('should have complete plugin metadata', () => {
|
|
286
|
+
expect(mochaPlugin.metadata.name).toBe('mocha');
|
|
287
|
+
expect(mochaPlugin.metadata.version).toBe('1.0.0');
|
|
288
|
+
expect(mochaPlugin.metadata.description).toBeTruthy();
|
|
289
|
+
expect(mochaPlugin.metadata.tags).toContain('mocha');
|
|
290
|
+
});
|
|
291
|
+
it('should have appropriate priority', () => {
|
|
292
|
+
expect(mochaPlugin.priority).toBe(85);
|
|
293
|
+
});
|
|
294
|
+
it('should have detection hints', () => {
|
|
295
|
+
expect(mochaPlugin.hints.required).toContain('failing');
|
|
296
|
+
expect(mochaPlugin.hints.anyOf).toContain('passing');
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/extractors/mocha/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,WAAW,MAAM,YAAY,CAAC;AAErC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,EAAE,CAAC,+CAA+C,EAAE,GAAG,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,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;YACtD,MAAM,CAAC,WAAW,CAAC,QAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,WAAW,CAAC,KAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACzD,MAAM,CAAC,WAAW,CAAC,KAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playwright Error Extractor Plugin
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats Playwright test output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtractorPlugin } from '../../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Playwright Error Extractor Plugin
|
|
11
|
+
*
|
|
12
|
+
* Extracts Playwright test framework errors with 90% confidence.
|
|
13
|
+
* Parses numbered failures with › separator and .spec.ts files.
|
|
14
|
+
*/
|
|
15
|
+
declare const playwrightPlugin: ExtractorPlugin;
|
|
16
|
+
export default playwrightPlugin;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/playwright/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,gBAAgB,CAAC;AA8UxB;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,eAiBvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|