From 28f5c4f0797afdb7624e9260eca37937a2893c58 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 21 Jan 2025 05:43:51 -0800 Subject: [PATCH] Print failing poll results on all similar tests --- .../src/singlefolder-tests/terminal.test.ts | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts index 1719ee4839f..9c1c097aab2 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts @@ -765,7 +765,7 @@ import { assertNoRpc, poll } from '../utils'; // Run sh commands, if this is ever enabled on Windows we would also want to run // the pwsh equivalent - terminal.sendText('echo "$A $B $C'); + terminal.sendText('echo "$A $B $C"'); // Poll for the echo results to show up try { @@ -808,19 +808,19 @@ import { assertNoRpc, poll } from '../utils'; data += sanitizeData(e.data); })); - // Run both PowerShell and sh commands, errors don't matter we're just looking for - // the correct output - terminal.sendText('$env:A'); - terminal.sendText('echo $A'); - terminal.sendText('$env:B'); - terminal.sendText('echo $B'); - terminal.sendText('$env:C'); - terminal.sendText('echo $C'); + // Run sh commands, if this is ever enabled on Windows we would also want to run + // the pwsh equivalent + terminal.sendText('echo "$A $B $C"'); // Poll for the echo results to show up - await poll(() => Promise.resolve(), () => data.includes('~a2~'), '~a2~ should be printed'); - await poll(() => Promise.resolve(), () => data.includes('~b2~'), '~b2~ should be printed'); - await poll(() => Promise.resolve(), () => data.includes('~c2~'), '~c2~ should be printed'); + try { + await poll(() => Promise.resolve(), () => data.includes('~a2~'), '~a2~ should be printed'); + await poll(() => Promise.resolve(), () => data.includes('~b2~'), '~b2~ should be printed'); + await poll(() => Promise.resolve(), () => data.includes('~c2~'), '~c2~ should be printed'); + } catch (err) { + console.error('DATA UP UNTIL NOW:', data); + throw err; + } // Wait for terminal to be disposed await new Promise(r => { @@ -852,16 +852,18 @@ import { assertNoRpc, poll } from '../utils'; data += sanitizeData(e.data); })); - // Run both PowerShell and sh commands, errors don't matter we're just looking for - // the correct output - terminal.sendText('$env:A'); - terminal.sendText('echo $A'); - terminal.sendText('$env:B'); - terminal.sendText('echo $B'); + // Run sh commands, if this is ever enabled on Windows we would also want to run + // the pwsh equivalent + terminal.sendText('echo "$A $B"'); // Poll for the echo results to show up - await poll(() => Promise.resolve(), () => data.includes('~a1~'), '~a1~ should be printed'); - await poll(() => Promise.resolve(), () => data.includes('~b1~'), '~b1~ should be printed'); + try { + await poll(() => Promise.resolve(), () => data.includes('~a1~'), '~a1~ should be printed'); + await poll(() => Promise.resolve(), () => data.includes('~b1~'), '~b1~ should be printed'); + } catch (err) { + console.error('DATA UP UNTIL NOW:', data); + throw err; + } // Wait for terminal to be disposed await new Promise(r => { @@ -893,16 +895,18 @@ import { assertNoRpc, poll } from '../utils'; data += sanitizeData(e.data); })); - // Run both PowerShell and sh commands, errors don't matter we're just looking for - // the correct output - terminal.sendText('$env:A'); - terminal.sendText('echo $A'); - terminal.sendText('$env:B'); - terminal.sendText('echo $B'); + // Run sh commands, if this is ever enabled on Windows we would also want to run + // the pwsh equivalent + terminal.sendText('echo "$A $B"'); // Poll for the echo results to show up - await poll(() => Promise.resolve(), () => data.includes('~a1~'), '~a1~ should be printed'); - await poll(() => Promise.resolve(), () => data.includes('~b2~'), '~b2~ should be printed'); + try { + await poll(() => Promise.resolve(), () => data.includes('~a1~'), '~a1~ should be printed'); + await poll(() => Promise.resolve(), () => data.includes('~b2~'), '~b2~ should be printed'); + } catch (err) { + console.error('DATA UP UNTIL NOW:', data); + throw err; + } // Wait for terminal to be disposed await new Promise(r => {