mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-26 18:35:05 +00:00
fix(inspection): normalize diagnostic-looking Windows filenames
This commit is contained in:
2 files changed
+19
-1
No files matched your search
@@ -27,7 +27,7 @@ function normalizeFailureReason(reason) {
|
|||||||
// Directories may contain spaces, but trailing whitespace separates diagnostic prose.
|
// Directories may contain spaces, but trailing whitespace separates diagnostic prose.
|
||||||
// Unquoted spaced leaves allow one final dotted token; longer prose stays diagnostic.
|
// Unquoted spaced leaves allow one final dotted token; longer prose stays diagnostic.
|
||||||
// Quote paths with multiple spaces in the final filename to remove ambiguity.
|
// Quote paths with multiple spaces in the final filename to remove ambiguity.
|
||||||
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: (?!failed\b|timed\b|could\b|cannot\b|unable\b|error\b)[^\s\\/:*?"<>|]+\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
|
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: [^\s\\/:*?"<>|]+\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
|
||||||
// Strip remaining file paths
|
// Strip remaining file paths
|
||||||
.replace(/(?:\b[a-z]:)?[\\/][\w./\\-]+/g, '<path>')
|
.replace(/(?:\b[a-z]:)?[\\/][\w./\\-]+/g, '<path>')
|
||||||
// Collapse whitespace
|
// Collapse whitespace
|
||||||
|
|||||||
@@ -185,6 +185,24 @@ async function runTests() {
|
|||||||
assert.strictEqual(groupFailures(runs).size, 2);
|
assert.strictEqual(groupFailures(runs).size, 2);
|
||||||
})) passed += 1; else failed += 1;
|
})) passed += 1; else failed += 1;
|
||||||
|
|
||||||
|
if (await test('groups Windows filenames with diagnostic-looking words', async () => {
|
||||||
|
const reasons = [
|
||||||
|
String.raw`Command C:\work\app error.log: permission denied`,
|
||||||
|
String.raw`Command D:\work\app output.log: permission denied`,
|
||||||
|
String.raw`Command E:\work\my failed-test.js: permission denied`,
|
||||||
|
];
|
||||||
|
assert.deepStrictEqual(reasons.map(normalizeFailureReason), [
|
||||||
|
'command <path>: permission denied',
|
||||||
|
'command <path>: permission denied',
|
||||||
|
'command <path>: permission denied',
|
||||||
|
]);
|
||||||
|
const runs = reasons.map((failureReason, index) => makeSkillRun({ id: `filename-${index}`, failureReason }));
|
||||||
|
assert.strictEqual(groupFailures(runs).size, 1);
|
||||||
|
const patterns = detectPatterns(runs);
|
||||||
|
assert.strictEqual(patterns.length, 1);
|
||||||
|
assert.strictEqual(patterns[0].count, 3);
|
||||||
|
})) passed += 1; else failed += 1;
|
||||||
|
|
||||||
if (await test('groupFailures handles mixed outcome casing', async () => {
|
if (await test('groupFailures handles mixed outcome casing', async () => {
|
||||||
const runs = [
|
const runs = [
|
||||||
makeSkillRun({ id: 'r1', outcome: 'FAILURE', failureReason: 'timeout' }),
|
makeSkillRun({ id: 'r1', outcome: 'FAILURE', failureReason: 'timeout' }),
|
||||||
|
|||||||
Reference in new issue
Block a user