Code change:
}); }); <del> test('onDidCloseTerminal event fires when terminal is disposed', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(terminal, term); } catch (e) { done(e); return; } terminal.dispose(); disposables.push(window.onDidCloseTerminal(() => done())); })); </del> <ins> test('onDidCloseTerminal event fires when terminal is disposed', async () => { </ins> const terminal = window.createTerminal(); <ins> const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); await new Promise<void>(r => { disposables.push(window.onDidCloseTerminal(t => { if (t === terminal) { r(); } })); terminal.dispose(); }); </ins> }); <del> test('processId immediately after createTerminal should fetch the pid', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(terminal, term); } catch (e) { done(e); return; } terminal.processId.then(id => { try { ok(id && id > 0); } catch (e) { done(e); return; } terminal.dispose(); disposables.push(window.onDidCloseTerminal(() => done())); }); })); </del> <ins> test('processId immediately after createTerminal should fetch the pid', async () => { </ins> const terminal = window.createTerminal(); <ins> const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); let pid = await result.processId; equal(true, pid && pid > 0); await new Promise<void>(r => { disposables.push(window.onDidCloseTerminal(t => { if (t === terminal) { r(); } })); terminal.dispose(); }); </ins> }); <del> test('name in constructor should set terminal.name', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(terminal, term); } catch (e) { done(e); return; } terminal.dispose(); disposables.push(window.onDidCloseTerminal(() => done())); })); </del> <ins> test('name in constructor should set terminal.name', async () => { </ins> const terminal = window.createTerminal('a'); <del> try { equal(terminal.name, 'a'); } catch (e) { done(e); return; } </del> <ins> const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); await new Promise<void>(r => { disposables.push(window.onDidCloseTerminal(t => { if (t === terminal) { r(); } })); terminal.dispose(); }); </ins> }); <del> test('creationOptions should be set and readonly for TerminalOptions terminals', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(terminal, term); } catch (e) { done(e); return; } terminal.dispose(); disposables.push(window.onDidCloseTerminal(() => done())); })); </del> <ins> test('creationOptions should be set and readonly for TerminalOptions terminals', async () => { </ins> const options = { name: 'foo', hideFromUser: true }; const terminal = window.createTerminal(options); <del> try { equal(terminal.name, 'foo'); const terminalOptions = terminal.creationOptions as TerminalOptions; equal(terminalOptions.name, 'foo'); equal(terminalOptions.hideFromUser, true); throws(() => terminalOptions.name = 'bad', 'creationOptions should be readonly at runtime'); } catch (e) { done(e); return; } </del> <ins> const terminalOptions = terminal.creationOptions as TerminalOptions; const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); await new Promise<void>(r => { disposables.push(window.onDidCloseTerminal(t => { if (t === terminal) { r(); } })); terminal.dispose(); }); throws(() => terminalOptions.name = 'bad', 'creationOptions should be readonly at runtime'); </ins> }); <del> test('onDidOpenTerminal should fire when a terminal is created', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(term.name, 'b'); } catch (e) { done(e); return; } disposables.push(window.onDidCloseTerminal(() => done())); terminal.dispose(); })); </del> <ins> test('onDidOpenTerminal should fire when a terminal is created', async () => { </ins> const terminal = window.createTerminal('b'); <ins> const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); await new Promise<void>(r => { disposables.push(window.onDidCloseTerminal(t => { if (t === terminal) { r(); } })); terminal.dispose(); }); </ins> }); <del> test('exitStatus.code should be set to undefined after a terminal is disposed', (done) => { disposables.push(window.onDidOpenTerminal(term => { try { equal(term, terminal); } catch (e) { done(e); return; } </del> <ins> test('exitStatus.code should be set to undefined after a terminal is disposed', async () => { const terminal = window.createTerminal(); const result = await new Promise<Terminal>(r => { disposables.push(window.onDidOpenTerminal(t => { if (t === terminal) { r(t); } })); }); equal(result, terminal); await new Promise<void>(r => { </ins> disposables.push(window.onDidCloseTerminal(t => { <del> try { </del> <ins> if (t === terminal) { </ins> deepEqual(t.exitStatus, { code: undefined }); <del> } catch (e) { done(e); return; </del> <ins> r(); </ins> } <del> done(); </del> })); terminal.dispose(); <del> })); const terminal = window.createTerminal(); </del> <ins> }); </ins> }); // test('onDidChangeActiveTerminal should fire when new terminals are created', (done) => {

Related discussion:
text: Seeing 2 test failures today for integration tests in Web ():
feel free to skip them if needed, they're known to be flaky. This was my top priority for debt week but it was completely consumed with the settings sync preview.
you mean flaky in general or only for web?
Flaky in general, it seems especially on web though.
We can leave them running, I am not seeing them failing often, just found this one. It is not something to look at now, but eventually. Will revisit if I see this again more frequently.
ok seeing them fail again today, pushing to disable them when running in web via checking for . Your tests seem to have a questionable use of , I see one error being that is called multiple times. Why do you not rewrite to use async and promises?
Another one:
I ended up disabling them all for web:
Maybe this has now leaked from the tests into the code itself. I'm creating a new terminal within an extension using the API and give it a pseudo terminal. Sometimes the terminal is shown but no output is displayed and does not work. But I can also see no error or trace. This happens for me in vscode 1.44.2 using linux.
Is this still an issue?