@vibe-validate/extractors 0.17.0-rc3 → 0.17.0

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.
Files changed (159) hide show
  1. package/dist/extractor-registry.d.ts +103 -0
  2. package/dist/extractor-registry.d.ts.map +1 -0
  3. package/dist/extractor-registry.js +278 -0
  4. package/dist/extractor-registry.js.map +1 -0
  5. package/dist/extractors/ava/index.d.ts +23 -0
  6. package/dist/extractors/ava/index.d.ts.map +1 -0
  7. package/dist/extractors/ava/index.js +507 -0
  8. package/dist/extractors/ava/index.js.map +1 -0
  9. package/dist/extractors/ava/index.test.d.ts +7 -0
  10. package/dist/extractors/ava/index.test.d.ts.map +1 -0
  11. package/dist/extractors/ava/index.test.js +408 -0
  12. package/dist/extractors/ava/index.test.js.map +1 -0
  13. package/dist/extractors/eslint/index.d.ts +18 -0
  14. package/dist/extractors/eslint/index.d.ts.map +1 -0
  15. package/dist/extractors/eslint/index.js +206 -0
  16. package/dist/extractors/eslint/index.js.map +1 -0
  17. package/dist/extractors/eslint/index.test.d.ts +9 -0
  18. package/dist/extractors/eslint/index.test.d.ts.map +1 -0
  19. package/dist/extractors/eslint/index.test.js +191 -0
  20. package/dist/extractors/eslint/index.test.js.map +1 -0
  21. package/dist/extractors/generic/index.d.ts +30 -0
  22. package/dist/extractors/generic/index.d.ts.map +1 -0
  23. package/dist/extractors/generic/index.js +140 -0
  24. package/dist/extractors/generic/index.js.map +1 -0
  25. package/dist/extractors/generic/index.test.d.ts +7 -0
  26. package/dist/extractors/generic/index.test.d.ts.map +1 -0
  27. package/dist/extractors/generic/index.test.js +61 -0
  28. package/dist/extractors/generic/index.test.js.map +1 -0
  29. package/dist/extractors/jasmine/index.d.ts +17 -0
  30. package/dist/extractors/jasmine/index.d.ts.map +1 -0
  31. package/dist/extractors/jasmine/index.js +254 -0
  32. package/dist/extractors/jasmine/index.js.map +1 -0
  33. package/dist/extractors/jasmine/index.test.d.ts +7 -0
  34. package/dist/extractors/jasmine/index.test.d.ts.map +1 -0
  35. package/dist/extractors/jasmine/index.test.js +345 -0
  36. package/dist/extractors/jasmine/index.test.js.map +1 -0
  37. package/dist/extractors/jest/index.d.ts +17 -0
  38. package/dist/extractors/jest/index.d.ts.map +1 -0
  39. package/dist/extractors/jest/index.js +278 -0
  40. package/dist/extractors/jest/index.js.map +1 -0
  41. package/dist/extractors/jest/index.test.d.ts +9 -0
  42. package/dist/extractors/jest/index.test.d.ts.map +1 -0
  43. package/dist/extractors/jest/index.test.js +353 -0
  44. package/dist/extractors/jest/index.test.js.map +1 -0
  45. package/dist/extractors/junit/index.d.ts +18 -0
  46. package/dist/extractors/junit/index.d.ts.map +1 -0
  47. package/dist/extractors/junit/index.js +259 -0
  48. package/dist/extractors/junit/index.js.map +1 -0
  49. package/dist/extractors/junit/index.test.d.ts +7 -0
  50. package/dist/extractors/junit/index.test.d.ts.map +1 -0
  51. package/dist/extractors/junit/index.test.js +341 -0
  52. package/dist/extractors/junit/index.test.js.map +1 -0
  53. package/dist/extractors/maven-checkstyle/index.d.ts +23 -0
  54. package/dist/extractors/maven-checkstyle/index.d.ts.map +1 -0
  55. package/dist/extractors/maven-checkstyle/index.js +263 -0
  56. package/dist/extractors/maven-checkstyle/index.js.map +1 -0
  57. package/dist/extractors/maven-checkstyle/index.test.d.ts +2 -0
  58. package/dist/extractors/maven-checkstyle/index.test.d.ts.map +1 -0
  59. package/dist/extractors/maven-checkstyle/index.test.js +197 -0
  60. package/dist/extractors/maven-checkstyle/index.test.js.map +1 -0
  61. package/dist/extractors/maven-compiler/index.d.ts +23 -0
  62. package/dist/extractors/maven-compiler/index.d.ts.map +1 -0
  63. package/dist/extractors/maven-compiler/index.js +271 -0
  64. package/dist/extractors/maven-compiler/index.js.map +1 -0
  65. package/dist/extractors/maven-compiler/index.test.d.ts +2 -0
  66. package/dist/extractors/maven-compiler/index.test.d.ts.map +1 -0
  67. package/dist/extractors/maven-compiler/index.test.js +189 -0
  68. package/dist/extractors/maven-compiler/index.test.js.map +1 -0
  69. package/dist/extractors/maven-surefire/index.d.ts +23 -0
  70. package/dist/extractors/maven-surefire/index.d.ts.map +1 -0
  71. package/dist/extractors/maven-surefire/index.js +292 -0
  72. package/dist/extractors/maven-surefire/index.js.map +1 -0
  73. package/dist/extractors/maven-surefire/index.test.d.ts +2 -0
  74. package/dist/extractors/maven-surefire/index.test.d.ts.map +1 -0
  75. package/dist/extractors/maven-surefire/index.test.js +169 -0
  76. package/dist/extractors/maven-surefire/index.test.js.map +1 -0
  77. package/dist/extractors/mocha/index.d.ts +17 -0
  78. package/dist/extractors/mocha/index.d.ts.map +1 -0
  79. package/dist/extractors/mocha/index.js +241 -0
  80. package/dist/extractors/mocha/index.js.map +1 -0
  81. package/dist/extractors/mocha/index.test.d.ts +7 -0
  82. package/dist/extractors/mocha/index.test.d.ts.map +1 -0
  83. package/dist/extractors/mocha/index.test.js +300 -0
  84. package/dist/extractors/mocha/index.test.js.map +1 -0
  85. package/dist/extractors/playwright/index.d.ts +17 -0
  86. package/dist/extractors/playwright/index.d.ts.map +1 -0
  87. package/dist/extractors/playwright/index.js +320 -0
  88. package/dist/extractors/playwright/index.js.map +1 -0
  89. package/dist/extractors/playwright/index.test.d.ts +7 -0
  90. package/dist/extractors/playwright/index.test.d.ts.map +1 -0
  91. package/dist/extractors/playwright/index.test.js +274 -0
  92. package/dist/extractors/playwright/index.test.js.map +1 -0
  93. package/dist/extractors/tap/index.d.ts +23 -0
  94. package/dist/extractors/tap/index.d.ts.map +1 -0
  95. package/dist/extractors/tap/index.js +352 -0
  96. package/dist/extractors/tap/index.js.map +1 -0
  97. package/dist/extractors/tap/index.test.d.ts +7 -0
  98. package/dist/extractors/tap/index.test.d.ts.map +1 -0
  99. package/dist/extractors/tap/index.test.js +100 -0
  100. package/dist/extractors/tap/index.test.js.map +1 -0
  101. package/dist/extractors/typescript/index.d.ts +17 -0
  102. package/dist/extractors/typescript/index.d.ts.map +1 -0
  103. package/dist/extractors/typescript/index.js +150 -0
  104. package/dist/extractors/typescript/index.js.map +1 -0
  105. package/dist/extractors/typescript/index.test.d.ts +9 -0
  106. package/dist/extractors/typescript/index.test.d.ts.map +1 -0
  107. package/dist/extractors/typescript/index.test.js +177 -0
  108. package/dist/extractors/typescript/index.test.js.map +1 -0
  109. package/dist/extractors/vitest/index.d.ts +17 -0
  110. package/dist/extractors/vitest/index.d.ts.map +1 -0
  111. package/dist/extractors/vitest/index.js +564 -0
  112. package/dist/extractors/vitest/index.js.map +1 -0
  113. package/dist/extractors/vitest/index.test.d.ts +9 -0
  114. package/dist/extractors/vitest/index.test.d.ts.map +1 -0
  115. package/dist/extractors/vitest/index.test.js +373 -0
  116. package/dist/extractors/vitest/index.test.js.map +1 -0
  117. package/dist/index.d.ts +27 -13
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +27 -13
  120. package/dist/index.js.map +1 -1
  121. package/dist/maven-compiler-extractor.d.ts +20 -0
  122. package/dist/maven-compiler-extractor.d.ts.map +1 -0
  123. package/dist/maven-compiler-extractor.js +218 -0
  124. package/dist/maven-compiler-extractor.js.map +1 -0
  125. package/dist/maven-utils.d.ts +24 -0
  126. package/dist/maven-utils.d.ts.map +1 -0
  127. package/dist/maven-utils.js +36 -0
  128. package/dist/maven-utils.js.map +1 -0
  129. package/dist/plugin-loader.d.ts +82 -0
  130. package/dist/plugin-loader.d.ts.map +1 -0
  131. package/dist/plugin-loader.js +201 -0
  132. package/dist/plugin-loader.js.map +1 -0
  133. package/dist/result-schema.d.ts +59 -9
  134. package/dist/result-schema.d.ts.map +1 -1
  135. package/dist/result-schema.js +3 -19
  136. package/dist/result-schema.js.map +1 -1
  137. package/dist/sandbox.d.ts +161 -0
  138. package/dist/sandbox.d.ts.map +1 -0
  139. package/dist/sandbox.js +254 -0
  140. package/dist/sandbox.js.map +1 -0
  141. package/dist/sandbox.test.d.ts +8 -0
  142. package/dist/sandbox.test.d.ts.map +1 -0
  143. package/dist/sandbox.test.js +395 -0
  144. package/dist/sandbox.test.js.map +1 -0
  145. package/dist/sandboxed-extractor.d.ts +46 -0
  146. package/dist/sandboxed-extractor.d.ts.map +1 -0
  147. package/dist/sandboxed-extractor.js +172 -0
  148. package/dist/sandboxed-extractor.js.map +1 -0
  149. package/dist/sandboxed-extractor.test.d.ts +5 -0
  150. package/dist/sandboxed-extractor.test.d.ts.map +1 -0
  151. package/dist/sandboxed-extractor.test.js +346 -0
  152. package/dist/sandboxed-extractor.test.js.map +1 -0
  153. package/dist/smart-extractor.d.ts +22 -10
  154. package/dist/smart-extractor.d.ts.map +1 -1
  155. package/dist/smart-extractor.js +116 -186
  156. package/dist/smart-extractor.js.map +1 -1
  157. package/dist/types.d.ts +94 -0
  158. package/dist/types.d.ts.map +1 -1
  159. package/package.json +3 -2
@@ -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.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
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"}
@@ -0,0 +1,320 @@
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
+ /**
9
+ * Detect error type from error message and block
10
+ */
11
+ function detectErrorType(message, block) {
12
+ // Element not found (waiting for locator with timeout)
13
+ // Check this BEFORE generic timeout to avoid false positives
14
+ if (block.includes('waiting for locator') && (message.includes('timeout') || message.includes('exceeded'))) {
15
+ return 'element-not-found';
16
+ }
17
+ // Navigation errors
18
+ if (message.includes('net::ERR') || message.includes('page.goto:')) {
19
+ return 'navigation-error';
20
+ }
21
+ // Timeout errors (generic)
22
+ if (message.includes('timeout') || message.includes('exceeded')) {
23
+ return 'timeout';
24
+ }
25
+ // Assertion errors (expect())
26
+ if (message.includes('expect(') ||
27
+ message.includes('toBe') ||
28
+ message.includes('toContain') ||
29
+ message.includes('toBeVisible') ||
30
+ message.includes('toHaveValue') ||
31
+ message.includes('toHaveCount')) {
32
+ return 'assertion-error';
33
+ }
34
+ // Generic error
35
+ return 'error';
36
+ }
37
+ /**
38
+ * Generate guidance for common error types
39
+ */
40
+ function generateGuidance(type, _message) {
41
+ switch (type) {
42
+ case 'assertion-error':
43
+ return 'Check the assertion expectation and ensure the actual value matches. Review the test logic and the application state.';
44
+ case 'timeout':
45
+ return 'The operation exceeded the timeout limit. Consider increasing the timeout, checking for slow operations, or verifying the application is responding correctly.';
46
+ case 'element-not-found':
47
+ return 'The element was not found on the page. Verify the selector is correct, the element exists, and it is rendered when expected.';
48
+ case 'navigation-error':
49
+ return 'Failed to navigate to the page. Check the URL is correct, the server is running, and the page exists.';
50
+ default:
51
+ return undefined;
52
+ }
53
+ }
54
+ /**
55
+ * Calculate quality metadata
56
+ */
57
+ function calculateQualityMetadata(errors, issues) {
58
+ if (errors.length === 0 && issues.length === 0) {
59
+ // No errors and no issues = perfect extraction (or no failures)
60
+ return {
61
+ confidence: 100,
62
+ completeness: 100,
63
+ issues: [],
64
+ };
65
+ }
66
+ // Calculate completeness: % of errors with file + line + message
67
+ const completeErrors = errors.filter(e => e.file &&
68
+ e.line !== undefined &&
69
+ e.line > 0 &&
70
+ e.message).length;
71
+ const completeness = errors.length > 0
72
+ ? Math.round((completeErrors / errors.length) * 100)
73
+ : 100;
74
+ // Calculate confidence based on pattern matching quality
75
+ let confidence = 90; // Base confidence for Playwright (distinctive format)
76
+ // Reduce confidence if we have issues
77
+ if (issues.length > 0) {
78
+ confidence -= Math.min(issues.length * 10, 40);
79
+ }
80
+ // Reduce confidence if completeness is low
81
+ if (completeness < 80) {
82
+ confidence -= (100 - completeness) / 2;
83
+ }
84
+ confidence = Math.max(0, Math.min(100, confidence));
85
+ return {
86
+ confidence: Math.round(confidence),
87
+ completeness,
88
+ issues,
89
+ };
90
+ }
91
+ /**
92
+ * Extract errors from Playwright test output
93
+ *
94
+ * @param output - Playwright text output
95
+ * @returns Structured error information
96
+ */
97
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 22 acceptable for Playwright output parsing (handles numbered failures, error blocks, and file path normalization)
98
+ function extract(output) {
99
+ const errors = [];
100
+ const issues = [];
101
+ // Split into lines for processing
102
+ const lines = output.split('\n');
103
+ // Parse numbered failure blocks: " 1) tests/path/test.spec.ts:10:5 › test name"
104
+ let i = 0;
105
+ while (i < lines.length) {
106
+ const line = lines[i];
107
+ // Match numbered failure header: " 1) tests/path/test.spec.ts:10:5 › test name"
108
+ // File path can include directories: "tests/playwright/test.spec.ts" or just "test.spec.ts"
109
+ // Allow trailing whitespace
110
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Playwright test framework output (controlled output), not user input
111
+ const failureMatch = /^\s+(\d+)\)\s+(.*\.spec\.ts):(\d+):(\d+)\s+›\s+(.+?)\s*$/.exec(line);
112
+ if (failureMatch) {
113
+ const [, , file, , , testName] = failureMatch;
114
+ // Extract error block (everything until next numbered failure or end)
115
+ const errorLines = [];
116
+ i++;
117
+ while (i < lines.length) {
118
+ const nextLine = lines[i];
119
+ // Stop at next numbered failure
120
+ if (/^\s+\d+\)\s+/.exec(nextLine)) {
121
+ break;
122
+ }
123
+ errorLines.push(nextLine);
124
+ i++;
125
+ }
126
+ // Parse the error block
127
+ const errorBlock = errorLines.join('\n');
128
+ // Extract error message (first Error: line and subsequent details)
129
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Playwright test framework error messages (controlled output), not user input
130
+ const errorMessageMatch = /Error:\s*(.+?)(?:\n\n|\n(?=\s+at\s))/s.exec(errorBlock);
131
+ const errorMessage = errorMessageMatch ? errorMessageMatch[1].trim() : testName;
132
+ // Extract file location from stack trace (last line with "at file:line:col")
133
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses Playwright test framework stack traces (controlled output), not user input
134
+ const stackMatch = /at\s+(.*\.spec\.ts):(\d+):(\d+)/.exec(errorBlock);
135
+ let errorFile = file;
136
+ let errorLine = 0;
137
+ let errorColumn = 0;
138
+ if (stackMatch) {
139
+ errorFile = stackMatch[1];
140
+ errorLine = Number.parseInt(stackMatch[2], 10);
141
+ errorColumn = Number.parseInt(stackMatch[3], 10);
142
+ }
143
+ else {
144
+ // No stack trace found - track as an issue
145
+ issues.push(`No stack trace found for failure: ${testName}`);
146
+ }
147
+ // Normalize file path (remove absolute path prefix if present, keep relative paths)
148
+ // If it's an absolute path, extract just the tests/... part or the filename
149
+ if (errorFile.includes('/') && !errorFile.startsWith('tests')) {
150
+ // Absolute path - extract relative part
151
+ const testsMatch = /(tests?\/.+\.spec\.ts)/i.exec(errorFile);
152
+ if (testsMatch) {
153
+ errorFile = testsMatch[1];
154
+ }
155
+ else {
156
+ // Just keep filename if no tests/ path found
157
+ errorFile = errorFile.replace(/^.*\/([^/]+\.spec\.ts)$/i, '$1');
158
+ }
159
+ }
160
+ // If it already starts with tests/ or is just a filename, keep it as-is
161
+ // Detect error type
162
+ const type = detectErrorType(errorMessage, errorBlock);
163
+ // Generate guidance
164
+ const guidance = generateGuidance(type, errorMessage);
165
+ // Build complete error message
166
+ const completeMessage = `${testName}\n${errorMessage}`;
167
+ errors.push({
168
+ file: errorFile,
169
+ line: errorLine,
170
+ column: errorColumn,
171
+ message: completeMessage,
172
+ context: testName,
173
+ guidance,
174
+ });
175
+ }
176
+ else {
177
+ i++;
178
+ }
179
+ }
180
+ // Calculate quality metadata
181
+ const metadata = calculateQualityMetadata(errors, issues);
182
+ // Generate summary
183
+ const summary = errors.length > 0
184
+ ? `${errors.length} test(s) failed`
185
+ : '0 test(s) failed';
186
+ // Generate guidance
187
+ const guidance = errors.length > 0
188
+ ? 'Review test failures and fix the underlying issues. Check assertions, selectors, and test logic.'
189
+ : '';
190
+ // Generate clean output
191
+ const formattedOutput = errors
192
+ .map(e => {
193
+ const location = e.file && e.line ? `${e.file}:${e.line}` : e.file ?? 'unknown';
194
+ return `${location}: ${e.message}`;
195
+ })
196
+ .join('\n');
197
+ return {
198
+ errors,
199
+ summary,
200
+ totalErrors: errors.length,
201
+ guidance,
202
+ errorSummary: formattedOutput,
203
+ metadata,
204
+ };
205
+ }
206
+ /**
207
+ * Detect if output is from Playwright test framework
208
+ *
209
+ * @param output - Command output to analyze
210
+ * @returns Detection result with confidence and patterns
211
+ */
212
+ function detect(output) {
213
+ // Playwright uses ✘ symbol and .spec.ts files
214
+ const hasPlaywrightMarker = output.includes('✘') && output.includes('.spec.ts');
215
+ // Or has numbered failures with › separator
216
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only tests Playwright output format (controlled test framework output), not user input
217
+ const hasNumberedFailures = /^\s+\d+\)\s+.+\.spec\.ts:\d+:\d+\s+›/.test(output);
218
+ if (hasPlaywrightMarker || hasNumberedFailures) {
219
+ return {
220
+ confidence: 90,
221
+ patterns: ['✘ + .spec.ts pattern', '› separator'],
222
+ reason: 'Playwright test framework output detected',
223
+ };
224
+ }
225
+ return { confidence: 0, patterns: [], reason: '' };
226
+ }
227
+ /**
228
+ * Sample test cases for Playwright extractor
229
+ */
230
+ const samples = [
231
+ {
232
+ name: 'single-assertion-error',
233
+ description: 'Single Playwright test failure with assertion error',
234
+ input: `
235
+ Running 1 test using 1 worker
236
+
237
+ ✘ 1 tests/example.spec.ts:10:5 › should fail (100ms)
238
+
239
+
240
+ 1) tests/example.spec.ts:10:5 › should fail
241
+
242
+ Error: expect(received).toBe(expected)
243
+
244
+ Expected: "foo"
245
+ Received: "bar"
246
+
247
+ 10 | test('should fail', async () => {
248
+ 11 | const value = 'bar';
249
+ > 12 | expect(value).toBe('foo');
250
+ | ^
251
+ 13 | });
252
+
253
+ at tests/example.spec.ts:12:21
254
+
255
+ 1 failed
256
+ `,
257
+ expectedErrors: 1,
258
+ expectedPatterns: ['expect(received).toBe(expected)', 'should fail'],
259
+ },
260
+ {
261
+ name: 'multiple-test-failures',
262
+ description: 'Multiple Playwright test failures with different error types',
263
+ input: `
264
+ Running 3 tests using 1 worker
265
+
266
+ ✘ 1 tests/example.spec.ts:10:5 › first failure (100ms)
267
+ ✘ 2 tests/example.spec.ts:20:5 › second failure (150ms)
268
+ ✘ 3 tests/example.spec.ts:30:5 › third failure (200ms)
269
+
270
+
271
+ 1) tests/example.spec.ts:10:5 › first failure
272
+
273
+ Error: First error
274
+
275
+ at tests/example.spec.ts:12:21
276
+
277
+ 2) tests/example.spec.ts:20:5 › second failure
278
+
279
+ Error: Second error
280
+
281
+ at tests/example.spec.ts:22:21
282
+
283
+ 3) tests/example.spec.ts:30:5 › third failure
284
+
285
+ Error: Third error
286
+
287
+ at tests/example.spec.ts:32:21
288
+
289
+ 3 failed
290
+ `,
291
+ expectedErrors: 3,
292
+ expectedPatterns: ['First error', 'Second error', 'Third error'],
293
+ },
294
+ ];
295
+ /**
296
+ * Playwright Error Extractor Plugin
297
+ *
298
+ * Extracts Playwright test framework errors with 90% confidence.
299
+ * Parses numbered failures with › separator and .spec.ts files.
300
+ */
301
+ const playwrightPlugin = {
302
+ metadata: {
303
+ name: 'playwright',
304
+ version: '1.0.0',
305
+ author: 'vibe-validate',
306
+ description: 'Extracts Playwright test framework errors',
307
+ repository: 'https://github.com/jdutton/vibe-validate',
308
+ tags: ['playwright', 'testing', 'javascript', 'e2e'],
309
+ },
310
+ hints: {
311
+ required: ['.spec.ts'],
312
+ anyOf: ['✘', '›'],
313
+ },
314
+ priority: 90,
315
+ detect,
316
+ extract,
317
+ samples,
318
+ };
319
+ export default playwrightPlugin;
320
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/playwright/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe,EAAE,KAAa;IACrD,uDAAuD;IACvD,6DAA6D;IAC7D,IAAI,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC3G,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,oBAAoB;IACpB,IAA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AC;QACtB,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;KAClB;IACD,QAAQ,EAAE,EAAE;IACZ,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Playwright Error Extractor Plugin Tests
3
+ *
4
+ * @package @vibe-validate/extractors
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.test.d.ts.map