Skip to content

Commit 1557efa

Browse files
wenytang-msCopilot
andcommitted
fix: address lint errors in UI test helpers
- Use const instead of let for simpleItem (prefer-const) - Add braces to all single-line if statements (curly) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 68fc676 commit 1557efa

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/ui/command.test.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ describe("Command Tests", function() {
277277
await sleep(1000);
278278
referencedItem = await section.findItem("Referenced Libraries") as TreeItem;
279279
await referencedItem.expand();
280-
let simpleItem = await waitForTreeItem(section, "simple.jar") as TreeItem;
280+
const simpleItem = await waitForTreeItem(section, "simple.jar") as TreeItem;
281281
assert.ok(simpleItem, `Library "simple.jar" should be found`);
282282
await simpleItem.click();
283283
await clickActionButton(simpleItem, 'Remove from Project Classpath');
@@ -431,7 +431,9 @@ async function waitForTreeItem(section: ViewSection, label: string, timeoutMs =
431431
const start = Date.now();
432432
while (Date.now() - start < timeoutMs) {
433433
const item = await section.findItem(label) as TreeItem;
434-
if (item) return item;
434+
if (item) {
435+
return item;
436+
}
435437
await sleep(1000);
436438
}
437439
return undefined;
@@ -441,7 +443,9 @@ async function waitForTreeItemGone(section: ViewSection, label: string, timeoutM
441443
const start = Date.now();
442444
while (Date.now() - start < timeoutMs) {
443445
const item = await section.findItem(label) as TreeItem;
444-
if (!item) return true;
446+
if (!item) {
447+
return true;
448+
}
445449
await sleep(1000);
446450
}
447451
return false;
@@ -450,7 +454,9 @@ async function waitForTreeItemGone(section: ViewSection, label: string, timeoutM
450454
async function waitForFileExists(filePath: string, timeoutMs = 15000): Promise<boolean> {
451455
const start = Date.now();
452456
while (Date.now() - start < timeoutMs) {
453-
if (await fse.pathExists(filePath)) return true;
457+
if (await fse.pathExists(filePath)) {
458+
return true;
459+
}
454460
await sleep(1000);
455461
}
456462
return false;
@@ -459,7 +465,9 @@ async function waitForFileExists(filePath: string, timeoutMs = 15000): Promise<b
459465
async function waitForFileGone(filePath: string, timeoutMs = 15000): Promise<boolean> {
460466
const start = Date.now();
461467
while (Date.now() - start < timeoutMs) {
462-
if (!await fse.pathExists(filePath)) return true;
468+
if (!await fse.pathExists(filePath)) {
469+
return true;
470+
}
463471
await sleep(1000);
464472
}
465473
return false;
@@ -484,7 +492,9 @@ async function waitForEditorTitle(expectedTitle: string, timeoutMs = 15000): Pro
484492
while (Date.now() - start < timeoutMs) {
485493
try {
486494
const editor = new TextEditor();
487-
if (await editor.getTitle() === expectedTitle) return editor;
495+
if (await editor.getTitle() === expectedTitle) {
496+
return editor;
497+
}
488498
} catch (_e) {
489499
// Editor may not be ready yet
490500
}

0 commit comments

Comments
 (0)