From bd620284abf0a174fc7f26d9cf66faa4d2bcdd49 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Wed, 30 Sep 2026 23:12:59 +0530 Subject: [PATCH] test: fix Windows-only test failures so CI matrix runs clean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two pre-existing Windows-specific failures blocked the CI release matrix from publishing the Windows build: - tests/main/DailyNotes.test.js: 'joins dir + YYYY-MM-DD.md' used a hard-coded '/tmp/notes/2026-09-13.md' expected value. On POSIX path.join returns '/' and the test passes; on Windows path.join returns '\' and the test fails. Fix: build the expected value via path.join so it matches the platform. - tests/main/PDFBatchOperations.test.js: 'watermarks every PDF including subfolders' used the default 5s Jest timeout. Windows CI runners are slower at pdf-lib / pdfjs-dist cold-start and the test regularly exceeded 5s. Fix: jest.setTimeout(30000) at the start of the watermark describe block. Neither is a regression — both predate this session. The fix gets the Windows job green so the release matrix completes 3/3. Amit Haridas --- tests/main/DailyNotes.test.js | 6 +++++- tests/main/PDFBatchOperations.test.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/main/DailyNotes.test.js b/tests/main/DailyNotes.test.js index 07757ad..a955799 100644 --- a/tests/main/DailyNotes.test.js +++ b/tests/main/DailyNotes.test.js @@ -26,7 +26,11 @@ describe('DailyNotes.dateKey', () => { describe('DailyNotes.pathFor', () => { test('joins dir + YYYY-MM-DD.md', () => { const d = new Date(2026, 8, 13); - expect(DailyNotes.pathFor(d, '/tmp/notes', path)).toBe('/tmp/notes/2026-09-13.md'); + // Use path.join to build the expected value so the test passes on + // Windows (where path.join returns backslashes) as well as POSIX. + expect(DailyNotes.pathFor(d, '/tmp/notes', path)).toBe( + path.join('/tmp/notes', '2026-09-13.md') + ); }); }); diff --git a/tests/main/PDFBatchOperations.test.js b/tests/main/PDFBatchOperations.test.js index 3cff996..f5cb80b 100644 --- a/tests/main/PDFBatchOperations.test.js +++ b/tests/main/PDFBatchOperations.test.js @@ -70,6 +70,10 @@ describe('PDFBatchOperations - runPDFBatchOperation', () => { } describe('watermark across a folder (brief manual-verification stand-in)', () => { + // 30s timeout for this batch — creates + watermarks 3 PDFs; the + // default 5s is too tight on Windows CI runners where pdf-lib / + // pdfjs-dist cold-start can take 10-15s on the first call. + jest.setTimeout(30000); beforeEach(async () => { await writePdfFixture(path.join(inputDir, 'a.pdf'), 2, 'Alpha'); await writePdfFixture(path.join(inputDir, 'b.pdf'), 3, 'Beta'); @@ -81,6 +85,8 @@ describe('PDFBatchOperations - runPDFBatchOperation', () => { // 'DRAFT' extracts back out cleanly via pdfjs; wider centered strings // (e.g. 'CONFIDENTIAL') hit a pdfjs-dist text-extraction quirk that // truncates the returned item even though the full text is drawn. + // 30s timeout — the test creates + watermarks 3 PDFs and the default + // 5s is too tight on Windows CI runners. const { completion } = await runBatch({ operation: 'watermark', data: {