Skip to content

Commit

Permalink
Merge branch 'master' into jscpd/changedlines
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 12, 2024
2 parents a82f098 + a77ec12 commit b3d5b6b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/core/src/test/testUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,30 +490,30 @@ export async function closeAllEditors(): Promise<void> {
/amazonwebservices\.[a-z\-]+-vscode\./,
/nullExtensionDescription./, // Sometimes exists instead of the prior line, see https://github.com/aws/aws-toolkit-vscode/issues/4658
]
const editors: vscode.TextEditor[] = []
const editorsToClose: vscode.TextEditor[] = []

const noVisibleEditor: boolean | undefined = await waitUntil(
async () => {
// Race: documents could appear after the call to closeAllEditors(), so retry.
await vscode.commands.executeCommand(closeAllCmd)
editors.length = 0
editors.push(
editorsToClose.length = 0
editorsToClose.push(
...vscode.window.visibleTextEditors.filter(
(editor) => !ignorePatterns.some((p) => p.test(editor.document.fileName))
)
)

return editors.length === 0
return editorsToClose.length === 0
},
{
timeout: 5000, // Arbitrary values. Should succeed except when VS Code is lagging heavily.
timeout: 1000, // Arbitrary values. Should succeed except when VS Code is lagging heavily.
interval: 250,
truthy: true,
}
)

if (!noVisibleEditor) {
const editorNames = editors.map((editor) => `\t${editor.document.fileName}`)
if (!noVisibleEditor && editorsToClose.length > 0) {
const editorNames = editorsToClose.map((editor) => `\t${editor.document.fileName}`)
throw new Error(`Editors were still open after closeAllEditors():\n${editorNames.join('\n')}`)
}
}
Expand Down

0 comments on commit b3d5b6b

Please sign in to comment.