Skip to content

Commit 74cff7d

Browse files
committed
feat: can set chrome args through env variable
1 parent e37e2f7 commit 74cff7d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/global-hooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import puppeteer from 'puppeteer'
33
const globalSetup = async () => {
44
;(global as any).browser = await puppeteer.launch({
55
executablePath: process.env.CHROME_EXECUTABLE_PATH,
6+
args: (process.env.CHROME_EXECUTABLE_PATH || '').split(' ').filter(Boolean),
67
})
78
process.env.PUPPETEER_WS_ENDPOINT = (global as any).browser.wsEndpoint()
89
}

src/puppeteer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const loadPage = async () => {
88
})
99
: puppeteer.launch({
1010
executablePath: process.env.CHROME_EXECUTABLE_PATH,
11+
args: (process.env.CHROME_EXECUTABLE_PATH || '')
12+
.split(' ')
13+
.filter(Boolean),
1114
}))
1215

1316
const page = await browser.newPage()

0 commit comments

Comments
 (0)