mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
Fix diagnostics tests by adding workspace.getConfiguration mock
- Add mock for vscode.workspace.getConfiguration in diagnostics test - Update all test calls to include includeDiagnostics: true option - Tests now properly handle the configuration-based approach 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
23516a375b
commit
94e74027ab
2 changed files with 21 additions and 0 deletions
6
.claude/settings.local.json
Normal file
6
.claude/settings.local.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"permissions": {
|
||||
"allow": ["Bash(find:*)", "Bash(grep:*)", "Bash(mkdir:*)", "Bash(npm run:*)", "Bash(npx tsc:*)"],
|
||||
"deny": []
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,15 @@ vitest.mock("vscode", () => ({
|
|||
stat: vitest.fn(),
|
||||
},
|
||||
openTextDocument: vitest.fn(),
|
||||
getConfiguration: vitest.fn(() => ({
|
||||
get: vitest.fn((key, defaultValue) => {
|
||||
// Return default values for diagnostics configuration
|
||||
if (key === "includeDiagnostics") return false
|
||||
if (key === "maxDiagnosticsCount") return 50
|
||||
if (key === "diagnosticsFilter") return []
|
||||
return defaultValue
|
||||
}),
|
||||
})),
|
||||
},
|
||||
}))
|
||||
|
||||
|
|
@ -103,6 +112,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
[[fileUri, diagnostics]],
|
||||
[vscode.DiagnosticSeverity.Error, vscode.DiagnosticSeverity.Warning],
|
||||
"/path/to",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify only Error and Warning diagnostics are included
|
||||
|
|
@ -147,6 +157,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
[[dirUri, [diagnostic]]],
|
||||
[vscode.DiagnosticSeverity.Error],
|
||||
"/path/to",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify fs.stat was called with the directory URI
|
||||
|
|
@ -204,6 +215,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
[[fileUri, diagnostics]],
|
||||
[vscode.DiagnosticSeverity.Error, vscode.DiagnosticSeverity.Warning, vscode.DiagnosticSeverity.Information],
|
||||
"/path/to",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify all diagnostics are included in the output
|
||||
|
|
@ -277,6 +289,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
],
|
||||
[vscode.DiagnosticSeverity.Error, vscode.DiagnosticSeverity.Warning, vscode.DiagnosticSeverity.Information],
|
||||
"/path/to",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify file paths are correctly shown with relative paths
|
||||
|
|
@ -333,6 +346,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
[[fileUri, diagnostics]],
|
||||
[vscode.DiagnosticSeverity.Information, vscode.DiagnosticSeverity.Hint],
|
||||
"/path/to",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify empty string is returned
|
||||
|
|
@ -373,6 +387,7 @@ describe("diagnosticsToProblemsString", () => {
|
|||
[[fileUri, [diagnostic]]],
|
||||
[vscode.DiagnosticSeverity.Error],
|
||||
"/project/root",
|
||||
{ includeDiagnostics: true },
|
||||
)
|
||||
|
||||
// Verify exact output format
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue