From 7f9be6c1403337894be130e5878a5cdb6e4f093c Mon Sep 17 00:00:00 2001 From: Pascal Jufer Date: Mon, 22 Aug 2022 14:46:15 +0200 Subject: [PATCH] Fix expected output in SIGINT test on Windows --- bin/concurrently.spec.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/concurrently.spec.ts b/bin/concurrently.spec.ts index 4f9eb061..14eca85c 100644 --- a/bin/concurrently.spec.ts +++ b/bin/concurrently.spec.ts @@ -15,7 +15,8 @@ const isWindows = process.platform === 'win32'; const createKillMessage = (prefix: string, signal: 'SIGTERM' | 'SIGINT') => { const map: Record = { SIGTERM: isWindows ? 1 : '(SIGTERM|143)', - SIGINT: isWindows ? 3221225786 : '(SIGINT|130)', + // Could theoretically be anything (e.g. 0) if process has SIGINT handler + SIGINT: isWindows ? '(3221225786|0)' : '(SIGINT|130|0)', }; return new RegExp(escapeRegExp(prefix) + ' exited with code ' + map[signal]); }; @@ -188,7 +189,15 @@ describe('exiting conditions', () => { expect(exit.code).toBe(0); expect(lines).toContainEqual( - expect.stringMatching(createKillMessage('[0] node fixtures/read-echo.js', 'SIGINT')) + expect.stringMatching( + createKillMessage( + isWindows + ? // '^C' is echoed by read-echo.js (also happens without the wrapper) + '[0] ^Cnode fixtures/read-echo.js' + : '[0] node fixtures/read-echo.js', + 'SIGINT' + ) + ) ); }); });