Skip to content

Commit a96fa70

Browse files
committed
Fix flaky test.
1 parent b2a87d4 commit a96fa70

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/ts-ssg/src/build/pagefind.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ async function populateAndWritePagefindIndex(
175175
state.onlyFiles === undefined
176176
? await indexHtmlDirectory(index, outDir)
177177
: await indexHtmlFiles(index, outDir, htmlFiles, isSkipped)
178-
const writeResult = await index.writeFiles({ outputPath })
178+
// Finish writes in Node before cleanup can stop Pagefind's native backend.
179+
const writeResult = await index.getFiles()
180+
for (const file of writeResult.files) {
181+
const filePath = path.join(outputPath, file.path)
182+
await fs.mkdir(path.dirname(filePath), { recursive: true })
183+
await fs.writeFile(filePath, file.content)
184+
}
179185
return {
180186
indexedPages: indexed.indexedPages,
181187
indexedBytes,

0 commit comments

Comments
 (0)