Skip to content

Commit

Permalink
fix(testing): Skip puppeteer install
Browse files Browse the repository at this point in the history
fixes #1529

Squashed commit of the following:

commit 8e57e7e
Author: Romulo Cintra <romulocintra@gmail.com>
Date:   Thu May 23 15:44:07 2019 +0200

    feat: conditional Lazyload of puppeteer

commit c58e790
Merge: 1125d3c c4d7c0d
Author: Romulo Cintra <romulocintra@gmail.com>
Date:   Thu May 23 15:21:13 2019 +0200

    Merge branch 'master' of github.com:ionic-team/stencil into feature/skip-install-puppeteer

commit 1125d3c
Author: Romulo Cintra <romulocintra@gmail.com>
Date:   Sat May 18 22:41:35 2019 +0200

    wip: skip puppeteer install
  • Loading branch information
manucorporat committed Jun 25, 2019
1 parent 8acf74e commit 01f0a93
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"jest-cli": "~24.8.0",
"pixelmatch": "4.0.2",
"puppeteer": "~1.17.0",
"puppeteer-core": "~1.17.0",
"workbox-build": "~4.3.1"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions scripts/build-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function bundleTesting() {
'path',
'process',
'puppeteer',
'puppeteer-core',
'readline',
'rollup',
'rollup-plugin-commonjs',
Expand Down
6 changes: 4 additions & 2 deletions src/cli/task-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export async function taskTest(config: d.Config) {

if (config.flags && config.flags.e2e) {
// if it's an e2e test, also make sure we're got
// puppeteer modules installed
// puppeteer modules installed and if browserExecutablePath is provided don't download Chromium use only puppeteer-core instead
const puppeteer = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';

ensureModuleIds.push(
'@types/puppeteer',
'puppeteer'
puppeteer
);

if (config.flags.screenshot) {
Expand Down
3 changes: 2 additions & 1 deletion src/testing/puppeteer/puppeteer-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export async function startPuppeteerBrowser(config: d.Config) {
}

const env: d.E2EProcessEnv = process.env;
const puppeteerDep = config.testing.browserExecutablePath ? 'puppeteer-core' : 'puppeteer';

const puppeteerModulePath = config.sys.lazyRequire.getModulePath('puppeteer');
const puppeteerModulePath = config.sys.lazyRequire.getModulePath(puppeteerDep);
const puppeteer = require(puppeteerModulePath);
env.__STENCIL_PUPPETEER_MODULE__ = puppeteerModulePath;
env.__STENCIL_BROWSER_WAIT_UNTIL = config.testing.browserWaitUntil;
Expand Down

0 comments on commit 01f0a93

Please sign in to comment.