@vibe-validate/extractors 0.16.1 → 0.17.0-rc.10

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 (167) 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 -11
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +27 -11
  120. package/dist/index.js.map +1 -1
  121. package/dist/maven-checkstyle-extractor.d.ts +20 -0
  122. package/dist/maven-checkstyle-extractor.d.ts.map +1 -0
  123. package/dist/maven-checkstyle-extractor.js +208 -0
  124. package/dist/maven-checkstyle-extractor.js.map +1 -0
  125. package/dist/maven-compiler-extractor.d.ts +20 -0
  126. package/dist/maven-compiler-extractor.d.ts.map +1 -0
  127. package/dist/maven-compiler-extractor.js +218 -0
  128. package/dist/maven-compiler-extractor.js.map +1 -0
  129. package/dist/maven-surefire-extractor.d.ts +20 -0
  130. package/dist/maven-surefire-extractor.d.ts.map +1 -0
  131. package/dist/maven-surefire-extractor.js +228 -0
  132. package/dist/maven-surefire-extractor.js.map +1 -0
  133. package/dist/maven-utils.d.ts +24 -0
  134. package/dist/maven-utils.d.ts.map +1 -0
  135. package/dist/maven-utils.js +36 -0
  136. package/dist/maven-utils.js.map +1 -0
  137. package/dist/plugin-loader.d.ts +82 -0
  138. package/dist/plugin-loader.d.ts.map +1 -0
  139. package/dist/plugin-loader.js +201 -0
  140. package/dist/plugin-loader.js.map +1 -0
  141. package/dist/result-schema.d.ts +59 -9
  142. package/dist/result-schema.d.ts.map +1 -1
  143. package/dist/result-schema.js +3 -19
  144. package/dist/result-schema.js.map +1 -1
  145. package/dist/sandbox.d.ts +161 -0
  146. package/dist/sandbox.d.ts.map +1 -0
  147. package/dist/sandbox.js +254 -0
  148. package/dist/sandbox.js.map +1 -0
  149. package/dist/sandbox.test.d.ts +8 -0
  150. package/dist/sandbox.test.d.ts.map +1 -0
  151. package/dist/sandbox.test.js +395 -0
  152. package/dist/sandbox.test.js.map +1 -0
  153. package/dist/sandboxed-extractor.d.ts +46 -0
  154. package/dist/sandboxed-extractor.d.ts.map +1 -0
  155. package/dist/sandboxed-extractor.js +172 -0
  156. package/dist/sandboxed-extractor.js.map +1 -0
  157. package/dist/sandboxed-extractor.test.d.ts +5 -0
  158. package/dist/sandboxed-extractor.test.d.ts.map +1 -0
  159. package/dist/sandboxed-extractor.test.js +346 -0
  160. package/dist/sandboxed-extractor.test.js.map +1 -0
  161. package/dist/smart-extractor.d.ts +22 -10
  162. package/dist/smart-extractor.d.ts.map +1 -1
  163. package/dist/smart-extractor.js +116 -163
  164. package/dist/smart-extractor.js.map +1 -1
  165. package/dist/types.d.ts +94 -0
  166. package/dist/types.d.ts.map +1 -1
  167. package/package.json +3 -2
@@ -0,0 +1,189 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { readFileSync } from 'node:fs';
3
+ import { join, dirname } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import mavenCompilerExtractor from './index.js';
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ describe('Maven Compiler Extractor', () => {
8
+ describe('detectMavenCompiler', () => {
9
+ it('should detect Maven compiler output with high confidence', () => {
10
+ const output = `[INFO] Compiling 45 source files to target/classes
11
+ [ERROR] COMPILATION ERROR :
12
+ [ERROR] /path/to/File.java:[42,25] cannot find symbol
13
+ [INFO] 2 errors
14
+ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile`;
15
+ const result = mavenCompilerExtractor.detect(output);
16
+ expect(result.confidence).toBe(100);
17
+ expect(result.patterns).toContain('[ERROR] COMPILATION ERROR marker');
18
+ expect(result.patterns).toContain('maven-compiler-plugin reference');
19
+ expect(result.patterns).toContain('file:[line,column] format');
20
+ expect(result.patterns).toContain('error count summary');
21
+ expect(result.patterns).toContain('Java compiler error pattern');
22
+ expect(result.reason).toBe('Maven compiler plugin output detected');
23
+ });
24
+ it('should have low confidence for non-compiler output', () => {
25
+ const output = `Some random build output
26
+ No compilation errors here
27
+ Just normal text`;
28
+ const result = mavenCompilerExtractor.detect(output);
29
+ expect(result.confidence).toBeLessThan(40);
30
+ });
31
+ it('should detect compilation error marker alone (partial match)', () => {
32
+ const output = `[INFO] Building project
33
+ [ERROR] COMPILATION ERROR :
34
+ [ERROR] Some compilation issue occurred`;
35
+ const result = mavenCompilerExtractor.detect(output);
36
+ // COMPILATION ERROR marker is worth 30 points, so this is correct
37
+ expect(result.confidence).toBe(30);
38
+ expect(result.patterns).toContain('[ERROR] COMPILATION ERROR marker');
39
+ });
40
+ });
41
+ describe('extractMavenCompiler', () => {
42
+ it('should extract "cannot find symbol" errors', () => {
43
+ const output = `[INFO] Compiling 45 source files
44
+ [ERROR] COMPILATION ERROR :
45
+ [ERROR] /Users/dev/project/src/main/java/com/example/Foo.java:[42,25] cannot find symbol
46
+ symbol: method extractComponent()
47
+ location: class com.example.RefactoringActions
48
+ [INFO] 1 error`;
49
+ const result = mavenCompilerExtractor.extract(output);
50
+ expect(result.totalErrors).toBe(1);
51
+ expect(result.errors).toHaveLength(1);
52
+ expect(result.errors[0]).toMatchObject({
53
+ file: 'src/main/java/com/example/Foo.java',
54
+ line: 42,
55
+ column: 25,
56
+ message: expect.stringContaining('cannot find symbol'),
57
+ });
58
+ expect(result.errors[0]?.message).toContain('symbol: method extractComponent()');
59
+ expect(result.errors[0]?.message).toContain('location: class com.example.RefactoringActions');
60
+ });
61
+ it('should extract "incompatible types" errors', () => {
62
+ const output = `[ERROR] COMPILATION ERROR :
63
+ [ERROR] /project/src/main/java/com/example/Bar.java:[15,8] incompatible types: java.lang.String cannot be converted to int
64
+ [INFO] 1 error`;
65
+ const result = mavenCompilerExtractor.extract(output);
66
+ expect(result.totalErrors).toBe(1);
67
+ expect(result.errors[0]).toMatchObject({
68
+ file: 'src/main/java/com/example/Bar.java',
69
+ line: 15,
70
+ column: 8,
71
+ message: expect.stringContaining('incompatible types'),
72
+ });
73
+ });
74
+ it('should extract multiple compilation errors', () => {
75
+ const output = `[ERROR] COMPILATION ERROR :
76
+ [ERROR] /path/to/Foo.java:[42,25] cannot find symbol
77
+ [ERROR] /path/to/Bar.java:[15,8] incompatible types: String cannot be converted to int
78
+ [ERROR] /path/to/Baz.java:[8,1] class, interface, or enum expected
79
+ [INFO] 3 errors`;
80
+ const result = mavenCompilerExtractor.extract(output);
81
+ expect(result.totalErrors).toBe(3);
82
+ expect(result.errors).toHaveLength(3);
83
+ expect(result.summary).toContain('3 compilation error(s)');
84
+ });
85
+ it('should deduplicate identical errors', () => {
86
+ const output = `[ERROR] COMPILATION ERROR :
87
+ [ERROR] /path/to/Foo.java:[42,25] cannot find symbol
88
+ [ERROR] /path/to/Foo.java:[42,25] cannot find symbol
89
+ [INFO] 2 errors`;
90
+ const result = mavenCompilerExtractor.extract(output);
91
+ // Should only report once, not twice
92
+ expect(result.totalErrors).toBe(1);
93
+ });
94
+ it('should limit errors to MAX_ERRORS_IN_ARRAY', () => {
95
+ // Create 20 compilation errors
96
+ const errors = Array.from({ length: 20 }, (_, i) => `[ERROR] /path/File${i}.java:[${i + 1},1] error ${i}`).join('\n');
97
+ const output = `[ERROR] COMPILATION ERROR :\n${errors}\n[INFO] 20 errors`;
98
+ const result = mavenCompilerExtractor.extract(output);
99
+ expect(result.totalErrors).toBe(20); // All counted
100
+ expect(result.errors.length).toBeLessThanOrEqual(10); // But array limited
101
+ });
102
+ it('should provide guidance', () => {
103
+ const output = `[ERROR] COMPILATION ERROR :
104
+ [ERROR] /path/Foo.java:[1,1] cannot find symbol
105
+ [INFO] 1 error`;
106
+ const result = mavenCompilerExtractor.extract(output);
107
+ expect(result.guidance).toBeDefined();
108
+ expect(result.guidance).toContain('compilation error');
109
+ });
110
+ it('should return 0 errors for low confidence detection', () => {
111
+ const output = 'Some random text with no compilation errors';
112
+ const result = mavenCompilerExtractor.extract(output);
113
+ expect(result.totalErrors).toBe(0);
114
+ expect(result.errors).toHaveLength(0);
115
+ expect(result.summary).toBe('Not Maven compiler output');
116
+ });
117
+ it('should extract errors from real-world test data', () => {
118
+ // Use co-located sample data
119
+ const testDataPath = join(__dirname, 'samples/maven-compile-error.txt');
120
+ const output = readFileSync(testDataPath, 'utf-8');
121
+ const result = mavenCompilerExtractor.extract(output);
122
+ // Real-world data should have 2 errors
123
+ expect(result.totalErrors).toBe(2);
124
+ expect(result.errors).toHaveLength(2);
125
+ // First error: cannot find symbol
126
+ expect(result.errors[0]).toMatchObject({
127
+ file: expect.stringContaining('Foo.java'),
128
+ line: 42,
129
+ column: 25,
130
+ });
131
+ expect(result.errors[0]?.message).toContain('cannot find symbol');
132
+ expect(result.errors[0]?.message).toContain('extractComponent()');
133
+ // Second error: incompatible types
134
+ expect(result.errors[1]).toMatchObject({
135
+ file: expect.stringContaining('Bar.java'),
136
+ line: 15,
137
+ column: 8,
138
+ });
139
+ expect(result.errors[1]?.message).toContain('incompatible types');
140
+ });
141
+ it('should extract relative paths correctly', () => {
142
+ const output = `[ERROR] COMPILATION ERROR :
143
+ [ERROR] /Users/jeff/workspace/project/src/main/java/com/example/Test.java:[10,5] error message
144
+ [INFO] 1 error`;
145
+ const result = mavenCompilerExtractor.extract(output);
146
+ expect(result.errors[0]?.file).toBe('src/main/java/com/example/Test.java');
147
+ });
148
+ it('should handle errors without column numbers', () => {
149
+ const output = `[ERROR] COMPILATION ERROR :
150
+ [ERROR] /path/to/File.java:[42] some error without column
151
+ [INFO] 1 error`;
152
+ const result = mavenCompilerExtractor.extract(output);
153
+ expect(result.errors[0]).toMatchObject({
154
+ file: expect.any(String),
155
+ line: 42,
156
+ message: 'some error without column',
157
+ });
158
+ expect(result.errors[0]?.column).toBeUndefined();
159
+ });
160
+ it('should group errors by file in summary', () => {
161
+ const output = `[ERROR] COMPILATION ERROR :
162
+ [ERROR] /path/to/Foo.java:[1,1] error 1
163
+ [ERROR] /path/to/Foo.java:[2,1] error 2
164
+ [ERROR] /path/to/Bar.java:[1,1] error 3
165
+ [INFO] 3 errors`;
166
+ const result = mavenCompilerExtractor.extract(output);
167
+ expect(result.summary).toContain('3 compilation error(s)');
168
+ expect(result.summary).toContain('2 file(s)');
169
+ });
170
+ });
171
+ describe('plugin metadata', () => {
172
+ it('should have correct metadata', () => {
173
+ expect(mavenCompilerExtractor.metadata.name).toBe('maven-compiler');
174
+ expect(mavenCompilerExtractor.metadata.version).toBeDefined();
175
+ expect(mavenCompilerExtractor.metadata.description).toContain('Maven');
176
+ });
177
+ it('should have hints for fast filtering', () => {
178
+ expect(mavenCompilerExtractor.hints).toBeDefined();
179
+ expect(mavenCompilerExtractor.hints?.required).toContain('[ERROR]');
180
+ expect(mavenCompilerExtractor.hints?.required).toContain('[INFO]');
181
+ expect(mavenCompilerExtractor.hints?.anyOf).toBeDefined();
182
+ });
183
+ it('should have samples for testing', () => {
184
+ expect(mavenCompilerExtractor.samples).toBeDefined();
185
+ expect(mavenCompilerExtractor.samples.length).toBeGreaterThan(0);
186
+ });
187
+ });
188
+ });
189
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/extractors/maven-compiler/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,M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E,GAAG,EAAE;QAC/B,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpE,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9D,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YACnD,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACpE,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACnE,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;YACzC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YACrD,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Maven Surefire/Failsafe Test Extractor Plugin
3
+ *
4
+ * Extracts test failures from Maven Surefire and Failsafe plugin output.
5
+ * Supports JUnit 4, JUnit 5, and AssertJ assertion failures.
6
+ *
7
+ * @package @vibe-validate/extractors
8
+ */
9
+ import type { ExtractorPlugin, DetectionResult, ErrorExtractorResult } from '../../types.js';
10
+ /**
11
+ * Detects if output is from Maven Surefire/Failsafe
12
+ */
13
+ export declare function detectMavenSurefire(output: string): DetectionResult;
14
+ /**
15
+ * Extracts test failures from Maven Surefire/Failsafe output
16
+ */
17
+ export declare function extractMavenSurefire(output: string, command?: string): ErrorExtractorResult;
18
+ /**
19
+ * Maven Surefire/Failsafe Extractor Plugin
20
+ */
21
+ declare const mavenSurefireExtractor: ExtractorPlugin;
22
+ export default mavenSurefireExtractor;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/maven-surefire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,EAErB,MAAM,gBAAgB,CAAC;AA4CxB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CA2CnE;AAED;;GAEG;AAEH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,oBAAoB,CAsLtB;AAED;;GAEG;AACH,QAAA,MAAM,sBAAsB,EAAE,eA6D7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,292 @@
1
+ /**
2
+ * Maven Surefire/Failsafe Test Extractor Plugin
3
+ *
4
+ * Extracts test failures from Maven Surefire and Failsafe plugin output.
5
+ * Supports JUnit 4, JUnit 5, and AssertJ assertion failures.
6
+ *
7
+ * @package @vibe-validate/extractors
8
+ */
9
+ import { MAX_ERRORS_IN_ARRAY } from '../../result-schema.js';
10
+ /* eslint-disable sonarjs/slow-regex -- All regexes safe: Maven Surefire output is structured with limited line length */
11
+ const SUREFIRE_PATTERNS = {
12
+ // [ERROR] Tests run: 12, Failures: 8, Errors: 3, Skipped: 1
13
+ testSummary: /^\[ERROR\]\s+Tests run:\s+(\d+),\s+Failures:\s+(\d+),\s+Errors:\s+(\d+)/,
14
+ // [ERROR] com.example.FooTest.testBar:42 Expected 5 but was 3
15
+ errorShort: /^\[ERROR\]\s+([^:]+)\.([^:]+):(\d+)\s+(\w+(?:Error|Exception|Failure))?\s*(.+)$/,
16
+ // [ERROR] com.example.FooTest.testBar -- Time elapsed: 0.123 s <<< FAILURE!
17
+ errorHeader: /^\[ERROR\]\s+([^.]+)\.([^\s]+)\s+.*<<<\s+(FAILURE|ERROR)!/,
18
+ // Exception type line
19
+ exceptionType: /^([\w.]+(?:Error|Exception|AssertionError|AssertionFailedError)):\s*(.*)$/,
20
+ // "at package.Class.method(File.java:123)"
21
+ stackTraceLine: /^\s+at\s+([^(]+)\(([^:]+):(\d+)\)/,
22
+ };
23
+ /* eslint-enable sonarjs/slow-regex */
24
+ /**
25
+ * Detects if output is from Maven Surefire/Failsafe
26
+ */
27
+ export function detectMavenSurefire(output) {
28
+ const lines = output.split('\n');
29
+ let score = 0;
30
+ const foundPatterns = [];
31
+ for (const line of lines) {
32
+ if (line.includes('maven-surefire-plugin') || line.includes('maven-failsafe-plugin')) {
33
+ score += 40;
34
+ foundPatterns.push('Maven test plugin reference');
35
+ }
36
+ if (SUREFIRE_PATTERNS.testSummary.exec(line)) {
37
+ score += 40;
38
+ foundPatterns.push('Test summary (Tests run, Failures, Errors)');
39
+ }
40
+ if (line.includes('<<< FAILURE!') || line.includes('<<< ERROR!')) {
41
+ score += 20;
42
+ foundPatterns.push('Test failure markers');
43
+ }
44
+ if (line.includes('[ERROR] Failures:') || line.includes('[ERROR] Errors:')) {
45
+ score += 15;
46
+ foundPatterns.push('Test failure section headers');
47
+ }
48
+ if (/AssertionError|AssertionFailedError/.exec(line)) {
49
+ score += 10;
50
+ foundPatterns.push('JUnit assertion errors');
51
+ }
52
+ }
53
+ // Determine reason based on score
54
+ let reason;
55
+ if (score >= 70) {
56
+ reason = 'Maven Surefire/Failsafe test output detected';
57
+ }
58
+ else if (score >= 40) {
59
+ reason = 'Possible Maven test output';
60
+ }
61
+ else {
62
+ reason = 'Not Maven test output';
63
+ }
64
+ return {
65
+ confidence: Math.min(score, 100),
66
+ patterns: foundPatterns,
67
+ reason,
68
+ };
69
+ }
70
+ /**
71
+ * Extracts test failures from Maven Surefire/Failsafe output
72
+ */
73
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 43 acceptable for Maven Surefire parser (handles multiple test output formats with state machine)
74
+ export function extractMavenSurefire(output, command) {
75
+ const detection = detectMavenSurefire(output);
76
+ if (detection.confidence < 40) {
77
+ return {
78
+ summary: 'Not Maven test output',
79
+ totalErrors: 0,
80
+ errors: [],
81
+ metadata: {
82
+ detection: {
83
+ extractor: 'maven-surefire',
84
+ confidence: detection.confidence,
85
+ patterns: detection.patterns,
86
+ reason: detection.reason,
87
+ },
88
+ confidence: detection.confidence,
89
+ completeness: 100,
90
+ issues: [],
91
+ },
92
+ };
93
+ }
94
+ const failures = [];
95
+ const lines = output.split('\n');
96
+ // Extract test summary for metadata
97
+ let totalFailures = 0;
98
+ let totalErrors = 0;
99
+ for (const line of lines) {
100
+ const summaryMatch = SUREFIRE_PATTERNS.testSummary.exec(line);
101
+ if (summaryMatch) {
102
+ // totalTests would be summaryMatch[1] if needed
103
+ totalFailures = Number.parseInt(summaryMatch[2], 10);
104
+ totalErrors = Number.parseInt(summaryMatch[3], 10);
105
+ }
106
+ }
107
+ // Parse failure details
108
+ let currentFailure = null;
109
+ let inStackTrace = false;
110
+ for (const line of lines) {
111
+ // Check for error header: [ERROR] Class.method -- Time elapsed: ... <<< FAILURE!
112
+ const headerMatch = SUREFIRE_PATTERNS.errorHeader.exec(line);
113
+ if (headerMatch) {
114
+ // Save previous failure if exists
115
+ if (currentFailure?.testClass && currentFailure?.testMethod) {
116
+ failures.push(currentFailure);
117
+ }
118
+ const [, testClass, testMethod, errorType] = headerMatch;
119
+ currentFailure = {
120
+ testClass: testClass.trim(),
121
+ testMethod: testMethod.trim(),
122
+ errorType: errorType,
123
+ message: '',
124
+ stackTrace: [],
125
+ };
126
+ inStackTrace = false;
127
+ continue;
128
+ }
129
+ // Check for short error format: [ERROR] Class.method:line Message
130
+ const shortMatch = SUREFIRE_PATTERNS.errorShort.exec(line);
131
+ if (shortMatch && !currentFailure) {
132
+ const [, fullMethod, testMethod, lineStr, exceptionType, message] = shortMatch;
133
+ const testClass = fullMethod.substring(0, fullMethod.lastIndexOf('.'));
134
+ failures.push({
135
+ testClass,
136
+ testMethod,
137
+ line: Number.parseInt(lineStr, 10),
138
+ errorType: 'FAILURE',
139
+ exceptionType: exceptionType ?? undefined,
140
+ message: message.trim(),
141
+ });
142
+ continue;
143
+ }
144
+ // Parse exception type and message
145
+ if (currentFailure && !currentFailure.message) {
146
+ const exceptionMatch = SUREFIRE_PATTERNS.exceptionType.exec(line);
147
+ if (exceptionMatch) {
148
+ const [, exceptionType, message] = exceptionMatch;
149
+ currentFailure.exceptionType = exceptionType;
150
+ currentFailure.message = message.trim();
151
+ inStackTrace = true;
152
+ continue;
153
+ }
154
+ }
155
+ // Parse stack trace
156
+ if (currentFailure && inStackTrace) {
157
+ const stackMatch = SUREFIRE_PATTERNS.stackTraceLine.exec(line);
158
+ if (stackMatch) {
159
+ const [, method, file, lineStr] = stackMatch;
160
+ // Extract file and line from first stack frame
161
+ if (!currentFailure.file && file.endsWith('.java')) {
162
+ currentFailure.file = file;
163
+ currentFailure.line = Number.parseInt(lineStr, 10);
164
+ }
165
+ currentFailure.stackTrace = currentFailure.stackTrace ?? [];
166
+ currentFailure.stackTrace.push(` at ${method}(${file}:${lineStr})`);
167
+ // Limit stack trace depth
168
+ if (currentFailure.stackTrace.length >= 3) {
169
+ inStackTrace = false;
170
+ }
171
+ }
172
+ }
173
+ // End of error block
174
+ if (line.trim() === '' && currentFailure) {
175
+ inStackTrace = false;
176
+ }
177
+ }
178
+ // Save last failure
179
+ if (currentFailure?.testClass && currentFailure?.testMethod) {
180
+ failures.push(currentFailure);
181
+ }
182
+ // Convert to FormattedError format
183
+ const errors = failures.slice(0, MAX_ERRORS_IN_ARRAY).map((f) => {
184
+ const testId = `${f.testClass}.${f.testMethod}`;
185
+ let message = f.message ?? 'Test failed';
186
+ // Include exception type if available
187
+ if (f.exceptionType && !message.includes(f.exceptionType)) {
188
+ message = `${f.exceptionType}: ${message}`;
189
+ }
190
+ // Add stack trace preview (first line only)
191
+ if (f.stackTrace && f.stackTrace.length > 0) {
192
+ message += `\n${f.stackTrace[0]}`;
193
+ }
194
+ return {
195
+ file: f.file ?? `${f.testClass.replaceAll('.', '/')}.java`,
196
+ line: f.line,
197
+ message: `Test: ${testId}\n${message}`,
198
+ };
199
+ });
200
+ const failureCount = totalFailures ?? failures.filter((f) => f.errorType === 'FAILURE').length;
201
+ const errorCount = totalErrors ?? failures.filter((f) => f.errorType === 'ERROR').length;
202
+ const summary = `${failureCount + errorCount} test failure(s): ${failureCount} failures, ${errorCount} errors`;
203
+ // Generate guidance
204
+ const guidance = failures.length > 0
205
+ ? `Fix test failures. Run ${command ?? 'mvn test'} to see full details.`
206
+ : undefined;
207
+ // Create error summary
208
+ const errorSummary = errors.length > 0
209
+ ? errors.map((e, i) => `[Test ${i + 1}/${errors.length}] ${e.file}:${e.line ?? '?'}\n${e.message}`).join('\n\n')
210
+ : undefined;
211
+ return {
212
+ summary,
213
+ totalErrors: failures.length,
214
+ errors,
215
+ guidance,
216
+ errorSummary,
217
+ metadata: {
218
+ detection: {
219
+ extractor: 'maven-surefire',
220
+ confidence: detection.confidence,
221
+ patterns: detection.patterns,
222
+ reason: detection.reason,
223
+ },
224
+ confidence: 95,
225
+ completeness: 90,
226
+ issues: failures.length > 20 ? ['Many test failures - output may be truncated'] : [],
227
+ },
228
+ };
229
+ }
230
+ /**
231
+ * Maven Surefire/Failsafe Extractor Plugin
232
+ */
233
+ const mavenSurefireExtractor = {
234
+ metadata: {
235
+ name: 'maven-surefire',
236
+ version: '1.0.0',
237
+ author: 'Jeff Dutton <jeff@duckcreek.com>',
238
+ description: 'Extracts test failures from Maven Surefire and Failsafe plugin output',
239
+ repository: 'https://github.com/jdutton/vibe-validate',
240
+ tags: ['maven', 'java', 'junit', 'testing', 'surefire', 'failsafe'],
241
+ },
242
+ hints: {
243
+ required: ['[ERROR]', 'Tests run:'],
244
+ anyOf: ['FAILURE!', 'ERROR!', 'maven-surefire-plugin', 'maven-failsafe-plugin'],
245
+ },
246
+ priority: 95, // Higher than Jasmine (90) to avoid false matches
247
+ detect: detectMavenSurefire,
248
+ extract: extractMavenSurefire,
249
+ samples: [
250
+ {
251
+ name: 'basic-assertion-failure',
252
+ description: 'Simple JUnit assertion failure',
253
+ input: `[ERROR] Tests run: 1, Failures: 1, Errors: 0
254
+ [ERROR] com.example.FooTest.testBar -- Time elapsed: 0.123 s <<< FAILURE!
255
+ java.lang.AssertionError: Expected 5 but was 3
256
+ \tat com.example.FooTest.testBar(FooTest.java:42)
257
+ \tat java.base/java.lang.reflect.Method.invoke(Method.java:565)`,
258
+ expected: {
259
+ totalErrors: 1,
260
+ },
261
+ },
262
+ {
263
+ name: 'null-pointer-exception',
264
+ description: 'NullPointerException during test',
265
+ input: `[ERROR] Tests run: 1, Failures: 0, Errors: 1
266
+ [ERROR] com.example.FooTest.testNull -- Time elapsed: 0.01 s <<< ERROR!
267
+ java.lang.NullPointerException: Cannot invoke "String.length()" because "value" is null
268
+ \tat com.example.FooTest.testNull(FooTest.java:77)`,
269
+ expected: {
270
+ totalErrors: 1,
271
+ },
272
+ },
273
+ {
274
+ name: 'assertj-failure',
275
+ description: 'AssertJ assertion with multi-line message',
276
+ input: `[ERROR] Tests run: 1, Failures: 1, Errors: 0
277
+ [ERROR] com.example.Test.testAssertJ -- <<< FAILURE!
278
+ java.lang.AssertionError:
279
+
280
+ Expecting actual:
281
+ "Hello World"
282
+ to contain:
283
+ "Goodbye"
284
+ \tat com.example.Test.testAssertJ(Test.java:25)`,
285
+ expected: {
286
+ totalErrors: 1,
287
+ },
288
+ },
289
+ ],
290
+ };
291
+ export default mavenSurefireExtractor;
292
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/maven-surefire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAuB7D,yHAAyH;AACzH,MAAM,iBAAiB,GAAG;IACxB,4DAA4D;IAC5D,WAAW,EAAE,yEAAyE;IAEtF,8DAA8D;IAC9D,UAAU,EACR,iFAAiF;IAEnF,4EAA4E;IAC5E,WAAW,EAAE,2DAA2D;IAExE,sBAAsB;IACtB,aAAa,EAAE,2EAA2E;IAE1F,2CAA2C;IAC3C,cAAc,EAAE,mCAAmC;CACpD,CAAC;AACF,sCAAsC;AAEtC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;YACrF,KAAK,IAAI,EAAE,CAAC;YACZ,aAAa,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,KAAK,IAAI,EAAE,CAAC;YACZ,aAAa,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjE,KAAK,IAAI,EA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EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;KACpE;IAED,KAAK,EAAE;QACL,QAAQ,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC;QACnC,KAAK,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;KAChF;IAED,QAAQ,EAAE,EAAE,EAAE,kDAAkD;IAEhE,MAAM,EAAE,mBAAmB;IAC3B,OAAO,EAAE,oBAAoB;IAE7B,OAAO,EAAE;QACP;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,gCAAgC;YAC7C,KAAK,EAAE;;;;gEAImD;YAC1D,QAAQ,EAAE;gBACR,WAAW,EAAE,CAAC;aACf;SACF;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EAAE,kCAAkC;YAC/C,KAAK,EAAE;;;mDAGsC;YAC7C,QAAQ,EAAE;gBACR,WAAW,EAAE,CAAC;aACf;SACF;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,2CAA2C;YACxD,KAAK,EAAE;;;;;;;;gDAQmC;YAC1C,QAAQ,EAAE;gBACR,WAAW,EAAE,CAAC;aACf;SACF;KACF;CACF,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/extractors/maven-surefire/index.test.ts"],"names":[],"mappings":""}