Compare commits

...

2 Commits

Author SHA1 Message Date
ae18df6710 Fix Windows installer build in new balena CI workers (qqjs patch)
Change-type: patch
2020-12-01 15:19:26 +00:00
8101ab38a6 Fix 'balena ssh' test cases when using the Windows built-in ssh tool
Change-type: patch
2020-12-01 15:19:26 +00:00
2 changed files with 12 additions and 3 deletions

View File

@ -120,6 +120,13 @@ describe('balena ssh', function () {
async function checkSsh(): Promise<boolean> { async function checkSsh(): Promise<boolean> {
const { which } = await import('../../build/utils/helpers'); const { which } = await import('../../build/utils/helpers');
const sshPath = await which('ssh', false); const sshPath = await which('ssh', false);
if ((sshPath || '').includes('\\Windows\\System32\\OpenSSH\\ssh')) {
// don't use Windows' built-in ssh tool for these test cases
// because it messes up with the terminal window such that
// "line breaks stop working" (and not even '\033c' fixes it)
// and all mocha output gets printed on a single very long line...
return false;
}
return !!sshPath; return !!sshPath;
} }
@ -127,11 +134,13 @@ async function checkSsh(): Promise<boolean> {
async function startMockSshServer(): Promise<[Server, number]> { async function startMockSshServer(): Promise<[Server, number]> {
const server = createServer((c) => { const server = createServer((c) => {
// 'connection' listener // 'connection' listener
c.on('end', () => { const handler = (msg: string) => {
if (process.env.DEBUG) { if (process.env.DEBUG) {
console.error('[debug] mock ssh server: client disconnected'); console.error(`[debug] mock ssh server: ${msg}`);
} }
}); };
c.on('error', (err) => handler(err.message));
c.on('end', () => handler('client disconnected'));
c.end(); c.end();
}); });
server.on('error', (err) => { server.on('error', (err) => {