Skip to content

Commit 940a36f

Browse files
authored
chore: use puppeteer-core (#4929)
1 parent cdec133 commit 940a36f

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

.circleci/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ jobs:
147147

148148
test-types:
149149
<<: *defaults
150-
docker:
151-
- image: circleci/node:latest-browsers
152150
steps:
153151
- checkout
154152
- attach_workspace:

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"node-fetch": "^2.3.0",
6363
"pug": "^2.0.3",
6464
"pug-plain-loader": "^1.0.0",
65-
"puppeteer": "~1.11.0",
65+
"puppeteer-core": "^1.12.1",
6666
"request": "^2.88.0",
6767
"request-promise-native": "^1.0.5",
6868
"rimraf": "^2.6.3",
@@ -80,7 +80,8 @@
8080
"tslint": "^5.12.1",
8181
"typescript": "^3.3.1",
8282
"vue-jest": "^3.0.2",
83-
"vue-property-decorator": "^7.3.0"
83+
"vue-property-decorator": "^7.3.0",
84+
"which": "^1.3.1"
8485
},
8586
"repository": {
8687
"type": "git",

test/utils/browser.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
import puppeteer from 'puppeteer'
1+
import puppeteer from 'puppeteer-core'
2+
import which from 'which'
23

34
export default class Browser {
45
async start(options = {}) {
56
// https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
6-
this.browser = await puppeteer.launch(
7-
Object.assign(
8-
{
9-
args: ['--no-sandbox', '--disable-setuid-sandbox'],
10-
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH
11-
},
12-
options
13-
)
14-
)
7+
const _opts = {
8+
args: [
9+
'--no-sandbox',
10+
'--disable-setuid-sandbox'
11+
],
12+
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
13+
...options
14+
}
15+
16+
if (!_opts.executablePath) {
17+
const resolve = cmd => which.sync(cmd, { nothrow: true })
18+
_opts.executablePath = resolve('google-chrome') || resolve('chromium')
19+
}
20+
21+
this.browser = await puppeteer.launch(_opts)
1522
}
1623

1724
async close() {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9231,10 +9231,10 @@ punycode@^2.1.0, punycode@^2.1.1:
92319231
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
92329232
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
92339233

9234-
puppeteer@~1.11.0:
9235-
version "1.11.0"
9236-
resolved "https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0.tgz#63cdbe12b07275cd6e0b94bce41f3fcb20305770"
9237-
integrity sha512-iG4iMOHixc2EpzqRV+pv7o3GgmU2dNYEMkvKwSaQO/vMZURakwSOn/EYJ6OIRFYOque1qorzIBvrytPIQB3YzQ==
9234+
puppeteer-core@^1.12.1:
9235+
version "1.12.1"
9236+
resolved "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-1.12.1.tgz#aec39d9c199ceff6ddd4da00e0733bb73fce4156"
9237+
integrity sha512-arGXPRe1dkX3+tOh1GMQ0Ny3CoOCRurkHAW4AZEBIBMX/LdY6ReFqRTT9YSV3d9zzxiIat9kJc3v9h9nkxAu3g==
92389238
dependencies:
92399239
debug "^4.1.0"
92409240
extract-zip "^1.6.6"

0 commit comments

Comments
 (0)