Skip to content

Commit

Permalink
Disable GPU acceleration in CI tests to mitigate flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Jan 21, 2025
1 parent c74519b commit 4690bb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ commands:
name: Jest
command: npm run test:coverage -- --ci --reporters=default --reporters=jest-junit <<#parameters.runInBand>>-i<</parameters.runInBand>><<^parameters.runInBand>>--maxWorkers=2<</parameters.runInBand>>
environment:
CHROME_DISABLE_GPU: 1 # Disable GPU acceleration to mitigate flaky tests
JEST_JUNIT_CLASSNAME: '{filepath}'
JEST_JUNIT_OUTPUT_DIR: tmp/test-results
MARP_TEST_CI: 1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
# https://stackoverflow.com/a/59365905
- name: Jest
env:
CHROME_DISABLE_GPU: 1 # Disable GPU acceleration to mitigate flaky tests
JEST_JUNIT_CLASSNAME: '{filepath}'
JEST_JUNIT_OUTPUT_DIR: tmp/test-results
MARP_TEST_CI: 1
Expand Down
11 changes: 11 additions & 0 deletions test/browser/browsers/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ describe('ChromeBrowser', () => {
})

describe('Disabling GPU', () => {
it('does not add --disable-gpu argument if CHROME_DISABLE_GPU environment variable is not defined', async () => {
delete process.env.CHROME_DISABLE_GPU
await new ChromeBrowser({ path: '/path/to/chrome' }).launch()

expect(puppeteer.launch).toHaveBeenCalledWith(
expect.objectContaining({
args: expect.not.arrayContaining(['--disable-gpu']),
})
)
})

it('adds --disable-gpu argument if CHROME_DISABLE_GPU environment variable is defined', async () => {
process.env.CHROME_DISABLE_GPU = '1'
await new ChromeBrowser({ path: '/path/to/chrome' }).launch()
Expand Down

0 comments on commit 4690bb4

Please sign in to comment.