diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e9b37a0..492d7d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Added -- Introduce parallelism for batch conversion: `--parallel` / `-P` ([#509](https://github.com/marp-team/marp-cli/issues/509), [#628](https://github.com/marp-team/marp-cli/pull/628)) +- Introduce parallelism for batch conversion: `--parallel` / `-P` ([#509](https://github.com/marp-team/marp-cli/issues/509), [#628](https://github.com/marp-team/marp-cli/pull/628), [#629](https://github.com/marp-team/marp-cli/pull/629)) ### Fixed diff --git a/src/converter.ts b/src/converter.ts index 8436692b..89d5ac3d 100644 --- a/src/converter.ts +++ b/src/converter.ts @@ -668,6 +668,15 @@ export class Converter { await page.goto('data:text/html,', waitForOptions) await page.setContent(baseFile.buffer!.toString(), waitForOptions) } + + // Wait for next frame (In parallel rendering, it may be needed to wait for the first rendering) + await page.evaluate(async () => { + /* c8 ignore start */ + await new Promise((resolve) => + window.requestAnimationFrame(() => resolve()) + ) + /* c8 ignore end */ + }) } try { diff --git a/test/converter.ts b/test/converter.ts index ef909cff..18cc2d3d 100644 --- a/test/converter.ts +++ b/test/converter.ts @@ -1271,7 +1271,7 @@ describe('Converter', () => { expect(secondCall[1]).toBeInstanceOf(Buffer) expect((secondCall[1] as Buffer).length).toBeLessThan(jpeg.length) }, - timeout + timeoutLarge ) }) @@ -1315,7 +1315,7 @@ describe('Converter', () => { expect(secondCall[1]).toBeInstanceOf(Buffer) expect((secondCall[1] as Buffer).length).toBeLessThan(jpeg.length) }, - timeout + timeoutLarge ) }) })