From afdb2b594c5c79a747854a939dbaaa1ef30f2326 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Fri, 4 Sep 2026 18:39:37 +0200 Subject: [PATCH] fix: make report:create test independent of log output and line endings The assertion compared stdout against a template literal that could never match: - The file was converted from LF to CRLF in 25fa704e14, so the literal carries \r\n while the command's stdout uses \n. - The literal starts with a newline, which only exists when consola prints its [info] lines to stdout ahead of the table. Those are suppressed unless DEBUG is set, so stdout begins directly at the table border. Normalize line endings on both sides and trim the leading newline, so the test asserts what it means to assert: that stdout contains the report table. It now passes with and without DEBUG=true. --- tests/commands/report/create.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/commands/report/create.test.ts b/tests/commands/report/create.test.ts index 3c71b0ca41..704292b2e8 100644 --- a/tests/commands/report/create.test.ts +++ b/tests/commands/report/create.test.ts @@ -10,7 +10,8 @@ describe('report:create', () => { if (process.env.DEBUG === 'true') console.log(cmd, stdout) expect( - stdout.includes(` + normalize(stdout).includes( + normalize(` ┌─────────┬─────────────┬──────────────────┬─────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────┐ │ (index) │ issueNumber │ type │ streamId │ streamUrl │ status │ ├─────────┼─────────────┼──────────────────┼─────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────────┤ @@ -26,7 +27,12 @@ describe('report:create', () => { │ 9 │ 20956 │ 'channel search' │ 'IONTV.us' │ undefined │ 'fulfilled' │ │ 10 │ 25157 │ 'streams:add' │ 'OnTimeSports.eg@SD' │ 'OnTime Sports SD.mu38' │ 'invalid_stream_url' │ │ 11 │ 39097 │ 'streams:edit' │ '~' │ 'https://jmp2.uk/plu-5a74b8e1e22a61737979c6bf.m3u8' │ 'nonexistent_link' │ -└─────────┴─────────────┴──────────────────┴─────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────┘`) +└─────────┴─────────────┴──────────────────┴─────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────┘`).trim() + ) ).toBe(true) }) }) + +function normalize(text: string) { + return text.replace(/\r\n/g, '\n') +}