Skip to content

Commit 490d9a9

Browse files
feggeclaude
andcommitted
fix: resolve CI test failures for extension tests
- Fix configuration property tests to handle package.json configuration as an array of sections instead of a single object - Fix toggleTreeViewMode test to get fresh config object after toggle - Fix performance test to create .vscode directory if it doesn't exist - Fix addPartiallyAudited test to use non-zero end character to prevent line decrement behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e67b939 commit 490d9a9

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

test/extension/suite/decorations.test.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ suite("Editor Decorations", () => {
7474
const relativePath = "src/sample.ts";
7575

7676
// Use lines that are not already partially audited
77+
// Note: When selection ends at character 0, the extension decrements endLine by 1
78+
// So we set the end position with a non-zero character to preserve the exact line
7779
const startLine = 30;
7880
const endLine = 35;
7981
const start = new vscode.Position(startLine, 0);
80-
const end = new vscode.Position(endLine, 0);
82+
const end = new vscode.Position(endLine, 1);
8183
editor.selection = new vscode.Selection(start, end);
8284

8385
// Get the initial state
@@ -126,9 +128,23 @@ suite("Editor Decorations", () => {
126128
assert.ok(extension, "Extension should be present");
127129

128130
const packageJson = extension.packageJSON;
129-
const configProps = packageJson?.contributes?.configuration?.properties;
131+
const configuration = packageJson?.contributes?.configuration;
132+
133+
assert.ok(configuration, "Configuration should exist");
134+
135+
// Configuration can be an array or an object - combine all properties
136+
let configProps: Record<string, unknown> = {};
137+
if (Array.isArray(configuration)) {
138+
for (const section of configuration) {
139+
if (section.properties) {
140+
configProps = { ...configProps, ...section.properties };
141+
}
142+
}
143+
} else if (configuration?.properties) {
144+
configProps = configuration.properties;
145+
}
130146

131-
assert.ok(configProps, "Configuration properties should exist");
147+
assert.ok(Object.keys(configProps).length > 0, "Configuration properties should exist");
132148
assert.ok(configProps["weAudit.ownFindingColor"], "ownFindingColor should be configured");
133149
assert.ok(configProps["weAudit.otherFindingColor"], "otherFindingColor should be configured");
134150
assert.ok(configProps["weAudit.ownNoteColor"], "ownNoteColor should be configured");

test/extension/suite/performance.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ suite("Performance", () => {
8989
const perfTestFile = path.join(vscodeDir, "perftest.weaudit");
9090

9191
try {
92+
// Ensure the .vscode directory exists
93+
if (!fs.existsSync(vscodeDir)) {
94+
fs.mkdirSync(vscodeDir, { recursive: true });
95+
}
9296
fs.writeFileSync(perfTestFile, JSON.stringify(testData, null, 2));
9397

9498
const startTime = Date.now();

test/extension/suite/treeViews.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ suite("Tree View Integration", () => {
4343
this.timeout(10000);
4444

4545
// Get the current mode from configuration
46-
const config = vscode.workspace.getConfiguration("weAudit");
47-
const modeBefore = config.get<string>("general.treeViewMode");
46+
const modeBefore = vscode.workspace.getConfiguration("weAudit").get<string>("general.treeViewMode");
4847

4948
// Toggle the mode
5049
await vscode.commands.executeCommand("weAudit.toggleTreeViewMode");
5150
await new Promise((resolve) => setTimeout(resolve, 300));
5251

53-
// Verify the configuration changed
54-
const modeAfter = config.get<string>("general.treeViewMode");
52+
// Get a fresh configuration object to see the updated value
53+
const modeAfter = vscode.workspace.getConfiguration("weAudit").get<string>("general.treeViewMode");
5554
assert.notStrictEqual(modeAfter, modeBefore, "Tree view mode should change after toggle");
5655

5756
// Verify it's one of the valid values

test/extension/suite/workspace.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,23 @@ suite("Workspace Operations", () => {
2929
assert.ok(extension, "Extension should be present");
3030

3131
const packageJson = extension.packageJSON;
32-
const configProps = packageJson?.contributes?.configuration?.properties;
32+
const configuration = packageJson?.contributes?.configuration;
33+
34+
assert.ok(configuration, "Configuration should be defined");
35+
36+
// Configuration can be an array or an object - combine all properties
37+
let configProps: Record<string, unknown> = {};
38+
if (Array.isArray(configuration)) {
39+
for (const section of configuration) {
40+
if (section.properties) {
41+
configProps = { ...configProps, ...section.properties };
42+
}
43+
}
44+
} else if (configuration?.properties) {
45+
configProps = configuration.properties;
46+
}
3347

34-
assert.ok(configProps, "Configuration properties should be defined");
48+
assert.ok(Object.keys(configProps).length > 0, "Configuration properties should be defined");
3549

3650
// Verify essential configuration properties exist
3751
const requiredProps = ["weAudit.general.treeViewMode", "weAudit.general.username"];

0 commit comments

Comments
 (0)