From 91faefd57cd372db33022f911d583848de554800 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Sun, 17 Mar 2024 15:28:22 +0100 Subject: [PATCH] test: fix issue when initializing the fixture files --- src/utils/__tests__/jsonl.test.ts | 2 ++ src/utils/__tests__/stats.test.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/utils/__tests__/jsonl.test.ts b/src/utils/__tests__/jsonl.test.ts index 5a8ad07..bfd49d9 100644 --- a/src/utils/__tests__/jsonl.test.ts +++ b/src/utils/__tests__/jsonl.test.ts @@ -83,6 +83,8 @@ function fixture(name: string, { temporary = false }: { temporary?: boolean } = ? path.join(__dirname, 'fixtures/jsonl', `${name}.temp.jsonl`) : path.join(__dirname, 'fixtures/jsonl', `${name}.jsonl`); + fs.mkdirSync(path.dirname(file), { recursive: true }); + if (temporary) { fs.writeFileSync(file, ''); } diff --git a/src/utils/__tests__/stats.test.ts b/src/utils/__tests__/stats.test.ts index 4a0587c..a0dd202 100644 --- a/src/utils/__tests__/stats.test.ts +++ b/src/utils/__tests__/stats.test.ts @@ -83,6 +83,8 @@ function fixture(name: string, { temporary = false }: { temporary?: boolean } = ? path.join(__dirname, 'fixtures/stats', `${name}.temp.jsonl`) : path.join(__dirname, 'fixtures/stats', `${name}.jsonl`); + fs.mkdirSync(path.dirname(file), { recursive: true }); + if (temporary) { fs.writeFileSync(file, ''); }