Skip to content

Commit

Permalink
Fix warnings printed during SwiftOutputChannel tests (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
plemarquand authored Nov 6, 2024
1 parent ffae87a commit 38369e8
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/integration-tests/ui/SwiftOutputChannel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@ import { SwiftOutputChannel } from "../../../src/ui/SwiftOutputChannel";

suite("SwiftOutputChannel", function () {
let channel: SwiftOutputChannel;
setup(() => {
channel = new SwiftOutputChannel("SwiftOutputChannel Tests", false, 3);
const channels: SwiftOutputChannel[] = [];
setup(function () {
const channelName = `SwiftOutputChannel Tests ${this.currentTest?.id ?? "<unknown test>"}`;
channel = new SwiftOutputChannel(channelName, false, 3);
channels.push(channel);
});

teardown(() => {
channel.dispose();
suiteTeardown(async function () {
// Output channels are added to their disposable store asynchronously, which leads
// to warnings in the console if we dispose of them immediately after the test.
// https://github.com/microsoft/vscode/blob/1f8fd7adeff6c113f9226787bdf4f417e6bdfb11/src/vs/workbench/api/common/extHostOutput.ts#L150
// As a workaround, we wait for a short period of time before disposing of the channels
await new Promise(resolve =>
setTimeout(() => {
channels.forEach(channel => channel.dispose());
resolve(void 0);
}, 50)
);
});

test("Appends logs", () => {
Expand Down

0 comments on commit 38369e8

Please sign in to comment.