diff --git a/.circleci/config.yml b/.circleci/config.yml index ad965b33..7365d027 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -100,6 +100,7 @@ commands: command: npm run test:coverage -- --ci --reporters=default --reporters=jest-junit <<#parameters.runInBand>>-i<><<^parameters.runInBand>>--maxWorkers=2<> environment: CHROME_DISABLE_GPU: 1 # Disable GPU acceleration to mitigate flaky tests + DEBUG: marp-cli:jpeg JEST_JUNIT_CLASSNAME: '{filepath}' JEST_JUNIT_OUTPUT_DIR: tmp/test-results MARP_TEST_CI: 1 diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index 61ab1bc4..ea4bbf63 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -49,6 +49,7 @@ jobs: - name: Jest env: CHROME_DISABLE_GPU: 1 # Disable GPU acceleration to mitigate flaky tests + DEBUG: marp-cli:jpeg JEST_JUNIT_CLASSNAME: '{filepath}' JEST_JUNIT_OUTPUT_DIR: tmp/test-results MARP_TEST_CI: 1 diff --git a/src/utils/jpeg.ts b/src/utils/jpeg.ts index e1ead540..a982c998 100644 --- a/src/utils/jpeg.ts +++ b/src/utils/jpeg.ts @@ -1,5 +1,7 @@ +import dbg from 'debug' import { Browser } from '../browser/browser' -import { debug } from './debug' + +const debug = dbg('marp-cli:jpeg') export const png2jpegViaPuppeteer = async ( browser: Browser, @@ -13,6 +15,8 @@ export const png2jpegViaPuppeteer = async ( waitUntil: ['domcontentloaded', 'networkidle0'], }) + debug('Evaluating JavaScript to convert PNG to JPEG') + const jpegDataURL = await page.evaluate( async (pngUri, q, timeout) => { /* c8 ignore start */ @@ -52,6 +56,8 @@ export const png2jpegViaPuppeteer = async ( browser.timeout ) + debug('Evaluated JavaScript to convert PNG to JPEG') + if (!jpegDataURL.startsWith('data:image/jpeg;base64,')) throw new Error('Failed to convert PNG to JPEG')