From feb5566b57256f4ddd0b577085508f0b18bebc8c Mon Sep 17 00:00:00 2001 From: fry69 <142489379+fry69@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:00:18 +0200 Subject: [PATCH] Comments for untestable codepaths --- files-to-prompt.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files-to-prompt.ts b/files-to-prompt.ts index ce8cb0d..8b44d64 100755 --- a/files-to-prompt.ts +++ b/files-to-prompt.ts @@ -11,6 +11,7 @@ interface ProcessingConfig { gitignoreRules: string[]; } +// These two functions allow redirecting the output via mock functions, they get implicitly tested export function output(...args: any[]) { console.log(...args); } @@ -48,6 +49,10 @@ async function processFile(filePath: string): Promise { output('---'); } } catch (err) { + // This should not happen unless e.g. files get deleted while this tool runs + // I ran into this case as the test framework was cleaning up files before this tool was done + // Remove `Bun.sleep()` from the test script and you will end up here + // TODO: write test case (not trivial) error(`Error processing file ${filePath}: ${err}`); } }